From a7424c630a6c0f555378a1bc31f3571531edb325 Mon Sep 17 00:00:00 2001 From: tom Date: Fri, 23 Feb 2024 18:56:23 +0400 Subject: [PATCH] Not possible to remove address filter in token inventory for an address with no NFTs Fixes #1514 --- ui/address/tokens/AddressCollections.tsx | 2 +- ui/shared/EmptySearchResult.tsx | 13 ++++++------- ui/token/TokenInventory.tsx | 4 ++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ui/address/tokens/AddressCollections.tsx b/ui/address/tokens/AddressCollections.tsx index 96b8326116..2be76c5c87 100644 --- a/ui/address/tokens/AddressCollections.tsx +++ b/ui/address/tokens/AddressCollections.tsx @@ -33,7 +33,7 @@ const AddressCollections = ({ collectionsQuery, address, hasActiveFilters }: Pro ); - const content = data?.items ? data?.items.map((item, index) => { + const content = data?.items ? data?.items.filter((item) => item.token_instances.length > 0).map((item, index) => { const collectionUrl = route({ pathname: '/token/[hash]', query: { diff --git a/ui/shared/EmptySearchResult.tsx b/ui/shared/EmptySearchResult.tsx index ed6e71875d..92c27fbecc 100644 --- a/ui/shared/EmptySearchResult.tsx +++ b/ui/shared/EmptySearchResult.tsx @@ -1,7 +1,10 @@ -import { Box, Heading, Text } from '@chakra-ui/react'; +import { Box, Heading, Text, Icon } from '@chakra-ui/react'; import React from 'react'; -import IconSvg from 'ui/shared/IconSvg'; +// This icon doesn't work properly when it is in the sprite +// Probably because of radial gradient +// eslint-disable-next-line no-restricted-imports +import emptySearchResultIcon from 'icons/empty_search_result.svg'; interface Props { text: string | JSX.Element; @@ -14,11 +17,7 @@ const EmptySearchResult = ({ text }: Props) => { flexDirection="column" alignItems="center" > - + { isError={ inventoryQuery.isError } items={ items } emptyText="There are no tokens." + filterProps={{ + hasActiveFilters: Boolean(ownerFilter), + emptyFilteredText: 'No tokens found for the selected owner.', + }} content={ content } actionBar={ actionBar } />