Commit f53a3601 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Do not display empty NFT attributes (#2348)

Fixes #2337
parent f93310d4
...@@ -23,7 +23,7 @@ const TruncatedValue = ({ className, isLoading, value, tooltipPlacement }: Props ...@@ -23,7 +23,7 @@ const TruncatedValue = ({ className, isLoading, value, tooltipPlacement }: Props
textOverflow="ellipsis" textOverflow="ellipsis"
height="fit-content" height="fit-content"
> >
{ value } <span>{ value }</span>
</Skeleton> </Skeleton>
</TruncatedTextTooltip> </TruncatedTextTooltip>
); );
......
...@@ -57,9 +57,16 @@ const Item = ({ data, isLoading }: ItemProps) => { ...@@ -57,9 +57,16 @@ const Item = ({ data, isLoading }: ItemProps) => {
flexDir="column" flexDir="column"
alignItems="flex-start" alignItems="flex-start"
> >
<Skeleton isLoaded={ !isLoading } fontSize="xs" lineHeight={ 4 } color="text_secondary" fontWeight={ 500 } mb={ 1 }> <TruncatedValue
<span>{ data.trait_type }</span> value={ data.trait_type }
</Skeleton> fontSize="xs"
w="100%"
lineHeight={ 4 }
color="text_secondary"
fontWeight={ 500 }
mb={ 1 }
isLoading={ isLoading }
/>
{ value } { value }
</GridItem> </GridItem>
); );
...@@ -126,7 +133,9 @@ const TokenInstanceMetadataInfo = ({ data, isLoading: isLoadingProp }: Props) => ...@@ -126,7 +133,9 @@ const TokenInstanceMetadataInfo = ({ data, isLoading: isLoadingProp }: Props) =>
</DetailsInfoItem.Label> </DetailsInfoItem.Label>
<DetailsInfoItem.Value> <DetailsInfoItem.Value>
<Grid gap={ 2 } templateColumns="repeat(auto-fill,minmax(160px, 1fr))" w="100%" whiteSpace="normal"> <Grid gap={ 2 } templateColumns="repeat(auto-fill,minmax(160px, 1fr))" w="100%" whiteSpace="normal">
{ metadata.attributes.map((attribute, index) => <Item key={ index } data={ attribute } isLoading={ isLoading }/>) } { metadata.attributes
.filter((attribute) => attribute.value)
.map((attribute, index) => <Item key={ index } data={ attribute } isLoading={ isLoading }/>) }
</Grid> </Grid>
</DetailsInfoItem.Value> </DetailsInfoItem.Value>
</> </>
......
...@@ -27,6 +27,9 @@ const MetadataItemPrimitive = ({ name, value, isItem = true, isFlat, level }: Pr ...@@ -27,6 +27,9 @@ const MetadataItemPrimitive = ({ name, value, isItem = true, isFlat, level }: Pr
if (url) { if (url) {
return <LinkExternal href={ url.toString() }>{ value }</LinkExternal>; return <LinkExternal href={ url.toString() }>{ value }</LinkExternal>;
} }
if (value === '') {
return <div>&quot;&quot;</div>;
}
} }
// eslint-disable-next-line no-fallthrough // eslint-disable-next-line no-fallthrough
default: { default: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment