+
+
+
+ {getTokenSymbol(token)}
+
+
+ {findChainByServerID(token.chain)?.name || ''}
+
-
-
-
-
+
+
+
+
+
+
-
-
- {token?.trade_volume_level === 'high'
- ? t('component.TokenSelector.bridge.high')
- : t('component.TokenSelector.bridge.low')}
-
-
+ />
+
+ {token?.trade_volume_level === 'high'
+ ? t('component.TokenSelector.bridge.high')
+ : t('component.TokenSelector.bridge.low')}
+
-
-
- );
- })}
-
- }
+
+
+
+ );
+ })}
+
);
};
diff --git a/src/ui/views/Bridge/Component/BridgeToken.tsx b/src/ui/views/Bridge/Component/BridgeToken.tsx
index 7b2690a59fa..266bbc1612b 100644
--- a/src/ui/views/Bridge/Component/BridgeToken.tsx
+++ b/src/ui/views/Bridge/Component/BridgeToken.tsx
@@ -5,7 +5,7 @@ import { CHAINS_ENUM } from '@debank/common';
import { TokenItem } from '@rabby-wallet/rabby-api/dist/types';
import { Input } from 'antd';
import clsx from 'clsx';
-import React, { useMemo } from 'react';
+import React, { useLayoutEffect, useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { TokenRender } from '../../Swap/Component/TokenRender';
import { formatTokenAmount, formatUsdValue } from '@/ui/utils';
@@ -17,16 +17,16 @@ import styled from 'styled-components';
import BridgeToTokenSelect from './BridgeToTokenSelect';
import { ReactComponent as RcIconInfoCC } from 'ui/assets/info-cc.svg';
import { useSetSettingVisible } from '../hooks';
+import { useRabbySelector } from '@/ui/store';
const StyledInput = styled(Input)`
- /* height: 46px; */
color: var(--r-neutral-title1, #192945);
font-size: 24px;
font-style: normal;
font-weight: 500;
line-height: normal;
- /* border: 1px solid var(--r-neutral-line, #d3d8e0); */
background: transparent !important;
+ padding-left: 0;
& > .ant-input {
color: var(--r-neutral-title1, #192945);
font-size: 24px;
@@ -36,27 +36,11 @@ const StyledInput = styled(Input)`
border-width: 0px !important;
border-color: transparent;
}
- /* &.ant-input-affix-wrapper:not(.ant-input-affix-wrapper-disabled):hover {
- border-width: 1px !important;
- } */
-
- /* &:active {
- border: 1px solid transparent;
- } */
- /* &:focus,
- &:focus-within {
- border-width: 1px !important;
- border-color: var(--r-blue-default, #7084ff) !important;
- }
- &:hover {
- border-width: 1px !important;
- border-color: var(--r-blue-default, #7084ff) !important;
- box-shadow: none;
- } */
- &:placeholder-shown {
+ &::placeholder {
color: var(--r-neutral-foot, #6a7587);
}
+
&::-webkit-inner-spin-button,
&::-webkit-outer-spin-button {
-webkit-appearance: none;
@@ -77,6 +61,7 @@ export const BridgeToken = ({
valueLoading,
fromChainId,
fromTokenId,
+ noQuote,
}: {
type?: 'from' | 'to';
token?: TokenItem;
@@ -87,12 +72,16 @@ export const BridgeToken = ({
onChangeChain: (chain: CHAINS_ENUM) => void;
value?: string | number;
onInputChange?: (v: string) => void;
+
valueLoading?: boolean;
fromChainId?: string;
fromTokenId?: string;
+ noQuote?: boolean;
}) => {
const { t } = useTranslation();
+ const supportedChains = useRabbySelector((s) => s.bridge.supportedChains);
+
const isFromToken = type === 'from';
const name = type === 'from' ? t('page.bridge.From') : t('page.bridge.To');
@@ -100,6 +89,19 @@ export const BridgeToken = ({
const openFeePopup = useSetSettingVisible();
+ const inputRef = useRef
();
+
+ useLayoutEffect(() => {
+ if (type === 'from') {
+ inputRef.current?.focus();
+ }
+ }, []);
+
+ const showNoQuote = useMemo(() => type === 'to' && !!noQuote, [
+ type,
+ noQuote,
+ ]);
+
const useValue = useMemo(() => {
if (token && value) {
return formatUsdValue(
@@ -144,6 +146,8 @@ export const BridgeToken = ({
onChange={onChangeChain}
title={t('page.bridge.select-chain')}
excludeChains={excludeChains}
+ supportChains={supportedChains}
+ drawerHeight={540}
/>
@@ -160,14 +164,16 @@ export const BridgeToken = ({
/>
) : (