diff --git a/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx b/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx index 20dc058fe..ae475ff67 100644 --- a/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx +++ b/src/ui/views/Dashboard/components/TokenDetailPopup/TokenDetail.tsx @@ -10,45 +10,26 @@ import { last } from 'lodash'; import React, { useCallback, useMemo, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory, useLocation } from 'react-router-dom'; -import { ReactComponent as RcIconExternal } from 'ui/assets/icon-share-currentcolor.svg'; -import { Copy, TokenWithChain } from 'ui/component'; import IconUnknown from '@/ui/assets/token-default.svg'; import { Image } from 'antd'; -import { - splitNumberByStep, - useWallet, - openInTab, - useCommonPopupView, - getUITypeName, -} from 'ui/utils'; -import { getAddressScanLink, getChain } from '@/utils'; -import ChainIcon from '../NFT/ChainIcon'; +import { splitNumberByStep, useWallet, useCommonPopupView } from 'ui/utils'; +import { getChain } from '@/utils'; import { HistoryItem } from './HistoryItem'; import { Loading } from './Loading'; import './style.less'; -import { CHAINS } from 'consts'; import { ellipsisOverflowedText } from 'ui/utils'; import { getTokenSymbol } from '@/ui/utils/token'; -import { SWAP_SUPPORT_CHAINS } from '@/constant'; -import { CustomizedSwitch } from './CustomizedButton'; import { BlockedButton } from './BlockedButton'; -import { useRabbySelector } from '@/ui/store'; import { TooltipWithMagnetArrow } from '@/ui/component/Tooltip/TooltipWithMagnetArrow'; -import ThemeIcon from '@/ui/component/ThemeMode/ThemeIcon'; -import { findChain } from '@/utils/chain'; import TokenChainAndContract from './TokenInfo'; import { TokenCharts } from '@/ui/component/TokenChart'; import { BlockedTopTips } from './BlockedTopTips'; import { ScamTokenTips } from './ScamTokenTips'; import { useGetHandleTokenSelectInTokenDetails } from '@/ui/component/TokenSelector/context'; -import { useExternalSwapBridgeDapps } from '@/ui/component/ExternalSwapBridgeDappPopup/hooks'; import { Account } from '@/background/service/preference'; import { useCurrentAccount } from '@/ui/hooks/backgroundState/useAccount'; const PAGE_COUNT = 10; -const ellipsis = (text: string) => { - return text.replace(/^(.{6})(.*)(.{4})$/, '$1...$3'); -}; interface TokenDetailProps { onClose?(): void; @@ -87,29 +68,6 @@ const TokenDetail = ({ const _currentAccount = useCurrentAccount(); const currentAccount = account || _currentAccount; - const bridgeSupportedChains = useRabbySelector( - (s) => s.bridge.supportedChains - ); - - const tokenChain = useMemo(() => { - return getChain(token?.chain); - }, [token?.chain]); - - const { - isSupportedChain, - data: externalSwapDapps, - } = useExternalSwapBridgeDapps(tokenChain!.enum, 'swap'); - - const tokenSupportSwap = useMemo( - () => isSupportedChain || externalSwapDapps.length > 0, - [isSupportedChain, externalSwapDapps] - ); - - const tokenSupportBridge = useMemo(() => { - const tokenChain = getChain(token?.chain)?.enum; - return !!tokenChain && bridgeSupportedChains.includes(tokenChain as any); - }, [token]); - const ref = useRef(null); const getTokenAmount = React.useCallback(async () => { @@ -303,28 +261,19 @@ const TokenDetail = ({ return (
- - - + {t('page.dashboard.tokenDetail.swap')} +