Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not display empty NFT attributes #2348

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/shared/TruncatedValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const TruncatedValue = ({ className, isLoading, value, tooltipPlacement }: Props
textOverflow="ellipsis"
height="fit-content"
>
{ value }
<span>{ value }</span>
</Skeleton>
</TruncatedTextTooltip>
);
Expand Down
17 changes: 13 additions & 4 deletions ui/tokenInstance/details/TokenInstanceMetadataInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ const Item = ({ data, isLoading }: ItemProps) => {
flexDir="column"
alignItems="flex-start"
>
<Skeleton isLoaded={ !isLoading } fontSize="xs" lineHeight={ 4 } color="text_secondary" fontWeight={ 500 } mb={ 1 }>
<span>{ data.trait_type }</span>
</Skeleton>
<TruncatedValue
value={ data.trait_type }
fontSize="xs"
w="100%"
lineHeight={ 4 }
color="text_secondary"
fontWeight={ 500 }
mb={ 1 }
isLoading={ isLoading }
/>
{ value }
</GridItem>
);
Expand Down Expand Up @@ -126,7 +133,9 @@ const TokenInstanceMetadataInfo = ({ data, isLoading: isLoadingProp }: Props) =>
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<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>
</DetailsInfoItem.Value>
</>
Expand Down
3 changes: 3 additions & 0 deletions ui/tokenInstance/metadata/MetadataItemPrimitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const MetadataItemPrimitive = ({ name, value, isItem = true, isFlat, level }: Pr
if (url) {
return <LinkExternal href={ url.toString() }>{ value }</LinkExternal>;
}
if (value === '') {
return <div>&quot;&quot;</div>;
}
}
// eslint-disable-next-line no-fallthrough
default: {
Expand Down
Loading