From 453032eb38656c70a4c25322cb7e0e03afd415e8 Mon Sep 17 00:00:00 2001 From: salimtb Date: Tue, 2 Jul 2024 11:26:33 +0200 Subject: [PATCH] fix: fix PR comments --- .../asset-picker-modal/Asset.tsx | 2 +- .../asset-picker-modal/AssetList.test.tsx | 4 ---- .../asset-picker-modal/AssetList.tsx | 3 +-- .../multichain/token-list-item/token-list-item.js | 14 +++++++------- ui/hooks/useTokenFiatAmount.js | 1 - 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/ui/components/multichain/asset-picker-amount/asset-picker-modal/Asset.tsx b/ui/components/multichain/asset-picker-amount/asset-picker-modal/Asset.tsx index a9f56285588f..24160acfbbb9 100644 --- a/ui/components/multichain/asset-picker-amount/asset-picker-modal/Asset.tsx +++ b/ui/components/multichain/asset-picker-amount/asset-picker-modal/Asset.tsx @@ -55,7 +55,7 @@ export default function Asset({ secondary={formattedFiat} title={title} tooltipText={tooltipText} - hidePercentage + showPercentage={false} /> ); } diff --git a/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.test.tsx b/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.test.tsx index 23f482694c9c..aba7ac7173b6 100644 --- a/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.test.tsx +++ b/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.test.tsx @@ -120,10 +120,6 @@ describe('AssetList', () => { return ['1 ETH', { value: '1', suffix: 'ETH' }]; }); - // (useCurrencyDisplay as jest.Mock) - // .mockReturnValueOnce(['100 USD', { value: '100', suffix: 'USD' }]) - // .mockReturnValueOnce(['1 ETH', { value: '1', suffix: 'ETH' }]); - handleAssetChangeMock.mockClear(); }); diff --git a/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.tsx b/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.tsx index d6320c228d5b..0813ef386e80 100644 --- a/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.tsx +++ b/ui/components/multichain/asset-picker-amount/asset-picker-modal/AssetList.tsx @@ -134,7 +134,6 @@ export default function AssetList({ display={Display.Block} flexWrap={FlexWrap.NoWrap} alignItems={AlignItems.center} - style={{ cursor: 'pointer' }} > {token.type === AssetType.native ? ( @@ -162,7 +161,7 @@ export default function AssetList({ tokenImage={token.image} isNativeCurrency isOriginalTokenSymbol={isOriginalNativeSymbol} - hidePercentage + showPercentage={false} /> ) : ( { const t = useI18nContext(); const isEvm = useSelector(getMultichainIsEvm); @@ -87,7 +87,7 @@ export const TokenListItem = ({ // Scam warning const showScamWarning = - isNativeCurrency && !isOriginalTokenSymbol && !hidePercentage; + isNativeCurrency && !isOriginalTokenSymbol && showPercentage; const dispatch = useDispatch(); const [showScamWarningModal, setShowScamWarningModal] = useState(false); @@ -160,7 +160,7 @@ export const TokenListItem = ({ // Used for badge icon const currentNetwork = useSelector(getMultichainCurrentNetwork); const testNetworkBackgroundColor = useSelector(getTestNetworkBackgroundColor); - const tokenMainTitleToDisplay = hidePercentage ? tokenSymbol : tokenTitle; + const tokenMainTitleToDisplay = showPercentage ? tokenTitle : tokenSymbol; return ( )} - {isEvm && hidePercentage ? ( + {isEvm && !showPercentage ? ( {tokenTitle} @@ -454,7 +454,7 @@ TokenListItem.propTypes = { address: PropTypes.string, /** - * hidePercentage represents if the increase decrease percentage will be hidden + * showPercentage represents if the increase decrease percentage will be hidden */ - hidePercentage: PropTypes.bool, + showPercentage: PropTypes.bool, }; diff --git a/ui/hooks/useTokenFiatAmount.js b/ui/hooks/useTokenFiatAmount.js index 9d6d6a3b2ef3..dfa4144b90e3 100644 --- a/ui/hooks/useTokenFiatAmount.js +++ b/ui/hooks/useTokenFiatAmount.js @@ -49,7 +49,6 @@ export function useTokenFiatAmount( const tokenExchangeRate = overrides.exchangeRate ?? (contractExchangeTokenKey && mergedRates[contractExchangeTokenKey]); - const formattedFiat = useMemo( () => getTokenFiatAmount(