From 4f8b3e41bfcf9baef231d1dac34341c4cce5646c Mon Sep 17 00:00:00 2001 From: sahar-fehri Date: Wed, 15 Jan 2025 16:40:25 +0100 Subject: [PATCH 1/3] fix: tokens list to display with hideTokensWithoutBalance setting --- app/components/UI/Tokens/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/UI/Tokens/index.tsx b/app/components/UI/Tokens/index.tsx index c386fbd714c..0e8510e8fc9 100644 --- a/app/components/UI/Tokens/index.tsx +++ b/app/components/UI/Tokens/index.tsx @@ -178,7 +178,7 @@ const Tokens: React.FC = ({ tokens }) => { const balance = multiChainTokenBalances?.[curToken.address as Hex] || curToken.balance; - return !isZero(balance) || curToken.isStaked; + return curToken.isNative || !isZero(balance) || curToken.isStaked; }); } } else { From 646b0d534e64b53d92f501d4e4343825fa006e82 Mon Sep 17 00:00:00 2001 From: sahar-fehri Date: Thu, 16 Jan 2025 10:29:00 +0100 Subject: [PATCH 2/3] fix: update no tokens msg --- app/components/UI/Tokens/TokenList/index.tsx | 28 +++++++++++++++++--- app/components/UI/Tokens/index.tsx | 2 +- app/components/UI/Tokens/styles.ts | 7 +++++ locales/languages/en.json | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/components/UI/Tokens/TokenList/index.tsx b/app/components/UI/Tokens/TokenList/index.tsx index af16dce0af4..516cf9ca821 100644 --- a/app/components/UI/Tokens/TokenList/index.tsx +++ b/app/components/UI/Tokens/TokenList/index.tsx @@ -4,12 +4,16 @@ import { useSelector } from 'react-redux'; import { useTheme } from '../../../../util/theme'; import { selectPrivacyMode } from '../../../../selectors/preferencesController'; import createStyles from '../styles'; -import Text from '../../../../component-library/components/Texts/Text'; +import Text, { + TextColor, +} from '../../../../component-library/components/Texts/Text'; import { TokenI } from '../types'; import { strings } from '../../../../../locales/i18n'; import { TokenListFooter } from './TokenListFooter'; import { TokenListItem } from './TokenListItem'; import { WalletViewSelectorsIDs } from '../../../../../e2e/selectors/wallet/WalletView.selectors'; +import { useNavigation } from '@react-navigation/native'; +import Routes from '../../../../constants/navigation/Routes'; interface TokenListProps { tokens: TokenI[]; @@ -34,6 +38,13 @@ export const TokenList = ({ const [showScamWarningModal, setShowScamWarningModal] = useState(false); const styles = createStyles(colors); + const navigation = useNavigation(); + + const handleLink = () => { + navigation.navigate(Routes.SETTINGS_VIEW, { + screen: Routes.ONBOARDING.GENERAL_SETTINGS, + }); + }; return tokens?.length ? ( ) : ( - {strings('wallet.no_tokens')} - + + + {strings('wallet.no_tokens')} + + + {strings('wallet.show_tokens_without_balance')} + + + // TO see tokens without balance, Click here. ); }; diff --git a/app/components/UI/Tokens/index.tsx b/app/components/UI/Tokens/index.tsx index 0e8510e8fc9..c386fbd714c 100644 --- a/app/components/UI/Tokens/index.tsx +++ b/app/components/UI/Tokens/index.tsx @@ -178,7 +178,7 @@ const Tokens: React.FC = ({ tokens }) => { const balance = multiChainTokenBalances?.[curToken.address as Hex] || curToken.balance; - return curToken.isNative || !isZero(balance) || curToken.isStaked; + return !isZero(balance) || curToken.isStaked; }); } } else { diff --git a/app/components/UI/Tokens/styles.ts b/app/components/UI/Tokens/styles.ts index fcb3c758960..8839d5806ba 100644 --- a/app/components/UI/Tokens/styles.ts +++ b/app/components/UI/Tokens/styles.ts @@ -26,6 +26,13 @@ const createStyles = (colors: Colors) => alignItems: 'center', marginTop: 50, }, + emptyTokensView: { + alignItems: 'center', + marginTop: 130, + }, + emptyTokensViewText: { + fontFamily: 'EuclidCircularB-Medium', + }, text: { fontSize: 20, color: colors.text.default, diff --git a/locales/languages/en.json b/locales/languages/en.json index ef1821c1fff..2302938f9df 100644 --- a/locales/languages/en.json +++ b/locales/languages/en.json @@ -449,6 +449,7 @@ "next": "Next", "buy_asset": "Buy {{asset}}", "no_tokens": "You don't have any tokens!", + "show_tokens_without_balance": "Show tokens without balance", "no_nfts_yet": "No NFTs yet", "nfts_autodetection_title": "NFT detection", "nfts_autodetection_desc": "Let MetaMask automatically detect and display NFTs in your wallet.", From 26e12d1e49dfb86cfa76e2ce91f2226b6a98cbe4 Mon Sep 17 00:00:00 2001 From: sahar-fehri Date: Fri, 17 Jan 2025 17:30:44 +0100 Subject: [PATCH 3/3] fix: fix snapshot --- .../Tokens/__snapshots__/index.test.tsx.snap | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap b/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap index 338a3185459..f159be58597 100644 --- a/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap +++ b/app/components/UI/Tokens/__snapshots__/index.test.tsx.snap @@ -478,21 +478,46 @@ exports[`Tokens Portfolio View should match the snapshot when portfolio view is } } > - - You don't have any tokens! - + + You don't have any tokens! + + + Show tokens without balance + +