From 9dccf1964e5a5800851d69852733a36c3a15123c Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 31 Oct 2024 14:01:07 +0100 Subject: [PATCH] Do not display empty NFT attributes Fixes #2337 --- ui/shared/TruncatedValue.tsx | 2 +- .../details/TokenInstanceMetadataInfo.tsx | 17 +++++++++++++---- .../metadata/MetadataItemPrimitive.tsx | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ui/shared/TruncatedValue.tsx b/ui/shared/TruncatedValue.tsx index f953477b08..3266df076b 100644 --- a/ui/shared/TruncatedValue.tsx +++ b/ui/shared/TruncatedValue.tsx @@ -23,7 +23,7 @@ const TruncatedValue = ({ className, isLoading, value, tooltipPlacement }: Props textOverflow="ellipsis" height="fit-content" > - { value } + { value } ); diff --git a/ui/tokenInstance/details/TokenInstanceMetadataInfo.tsx b/ui/tokenInstance/details/TokenInstanceMetadataInfo.tsx index 4839358912..55c528d572 100644 --- a/ui/tokenInstance/details/TokenInstanceMetadataInfo.tsx +++ b/ui/tokenInstance/details/TokenInstanceMetadataInfo.tsx @@ -57,9 +57,16 @@ const Item = ({ data, isLoading }: ItemProps) => { flexDir="column" alignItems="flex-start" > - - { data.trait_type } - + { value } ); @@ -126,7 +133,9 @@ const TokenInstanceMetadataInfo = ({ data, isLoading: isLoadingProp }: Props) => - { metadata.attributes.map((attribute, index) => ) } + { metadata.attributes + .filter((attribute) => attribute.value) + .map((attribute, index) => ) } diff --git a/ui/tokenInstance/metadata/MetadataItemPrimitive.tsx b/ui/tokenInstance/metadata/MetadataItemPrimitive.tsx index 256290b5e7..286149c765 100644 --- a/ui/tokenInstance/metadata/MetadataItemPrimitive.tsx +++ b/ui/tokenInstance/metadata/MetadataItemPrimitive.tsx @@ -27,6 +27,9 @@ const MetadataItemPrimitive = ({ name, value, isItem = true, isFlat, level }: Pr if (url) { return { value }; } + if (value === '') { + return
""
; + } } // eslint-disable-next-line no-fallthrough default: {