Skip to content

Commit

Permalink
Not possible to remove address filter in token inventory for an addre…
Browse files Browse the repository at this point in the history
…ss with no NFTs

Fixes blockscout#1514
  • Loading branch information
tom2drum authored and havan committed Feb 28, 2024
1 parent 7770abd commit 5886142
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ui/address/tokens/AddressCollections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const AddressCollections = ({ collectionsQuery, address, hasActiveFilters }: Pro
</ActionBar>
);

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: {
Expand Down
13 changes: 6 additions & 7 deletions ui/shared/EmptySearchResult.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,11 +17,7 @@ const EmptySearchResult = ({ text }: Props) => {
flexDirection="column"
alignItems="center"
>
<IconSvg
name="empty_search_result"
boxSize={ 60 }
display="block"
/>
<Icon as={ emptySearchResultIcon } boxSize={ 60 }/>

<Heading
as="h3"
Expand Down
4 changes: 4 additions & 0 deletions ui/token/TokenInventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const TokenInventory = ({ inventoryQuery, tokenQuery, ownerFilter }: Props) => {
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 }
/>
Expand Down

0 comments on commit 5886142

Please sign in to comment.