From 1a5b3d0c7673e3f074e18a285f5692f02a63afd9 Mon Sep 17 00:00:00 2001 From: Harsh R <53080940+fullstackninja864@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:39:24 +0530 Subject: [PATCH] fix(ui-ux): hide Get DFI btn on empty portfolio screen (#4080) --- .../screens/TokenSelectionScreen.tsx | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx index 65c4ac8720..780e3af56a 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx @@ -68,8 +68,9 @@ export function TokenSelectionScreen(): JSX.Element { const [isSearchFocus, setIsSearchFocus] = useState(false); const searchRef = useRef(); + const isEvmDomain = domain === DomainType.EVM; - const filteredTokensByDomain = domain === DomainType.EVM ? evmTokens : tokens; + const filteredTokensByDomain = isEvmDomain ? evmTokens : tokens; const tokensWithBalance = getTokensWithBalance( filteredTokensByDomain, @@ -80,9 +81,9 @@ export function TokenSelectionScreen(): JSX.Element { }, [tokensWithBalance, debouncedSearchTerm]); const hasFetchedDvmEvmTokens = - hasFetchedToken || (domain === DomainType.EVM && hasFetchedEvmTokens); + hasFetchedToken || (isEvmDomain && hasFetchedEvmTokens); if (hasFetchedDvmEvmTokens && tokensWithBalance.length === 0) { - return ; + return ; } return ( @@ -97,7 +98,7 @@ export function TokenSelectionScreen(): JSX.Element { return ( { navigation.navigate({ name: "SendScreen", @@ -195,13 +196,13 @@ export function TokenSelectionScreen(): JSX.Element { interface TokenSelectionRowProps { item: TokenSelectionItem; onPress: any; - domain: DomainType; + isEvmDomain: boolean; } function TokenSelectionRow({ item, onPress, - domain, + isEvmDomain, }: TokenSelectionRowProps): JSX.Element { return ( @@ -257,8 +258,10 @@ function TokenSelectionRow({ function EmptyAsset({ navigation, + isEvmDomain, }: { navigation: NavigationProp; + isEvmDomain: boolean; }): JSX.Element { return ( - navigation.navigate("GetDFIScreen" as any)} - styleProps="w-full mb-14 pb-1" - label={translate("screens/GetDFIScreen", "Get DFI")} - /> + {!isEvmDomain && ( + navigation.navigate("GetDFIScreen" as any)} + styleProps="w-full mb-14 pb-1" + label={translate("screens/GetDFIScreen", "Get DFI")} + /> + )} ); }