diff --git a/apps/core/src/hooks/useNftDetails.ts b/apps/core/src/hooks/useNftDetails.ts index 7eed91a029a..dc65ab58a9a 100644 --- a/apps/core/src/hooks/useNftDetails.ts +++ b/apps/core/src/hooks/useNftDetails.ts @@ -8,7 +8,6 @@ import { useIsAssetTransferable, } from './'; import { formatAddress } from '@iota/iota-sdk/utils'; -import { truncateString } from '../utils'; type NftField = { keys: string[]; values: string[] }; @@ -35,7 +34,7 @@ export function useNftDetails(nftId: string, accountAddress: string | null) { // Extract either the attributes, or use the top-level NFT fields: const { keys: metaKeys, values: metaValues } = - (nftFields as NftFields)?.metadata?.fields?.attributes?.fields || + (nftFields as unknown as NftFields)?.metadata?.fields?.attributes?.fields || Object.entries(nftFields ?? {}) .filter(([key]) => key !== 'id') .reduce( @@ -54,34 +53,6 @@ export function useNftDetails(nftId: string, accountAddress: string | null) { objectData.owner.AddressOwner) || ''; - function formatMetaValue( - value: string | object, - disableLink: boolean = false, - truncateLink: boolean = true, - ) { - if (typeof value === 'object') { - return { - value: JSON.stringify(value), - valueLink: undefined, - }; - } else { - if (value.includes('http')) { - return { - value: value.startsWith('http') - ? truncateLink - ? truncateString(value, 20, 8) - : value - : formatAddress(value), - valueLink: disableLink ? undefined : value, - }; - } - return { - value: value, - valueLink: undefined, - }; - } - } - const isLoading = isNftLoading || isCheckingAssetTransferability || isPendingNftDislpay; return { @@ -95,7 +66,6 @@ export function useNftDetails(nftId: string, accountAddress: string | null) { isAssetTransferable, metaKeys, metaValues, - formatMetaValue, isContainedInKiosk, kioskItem, nftDisplayData, diff --git a/apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx b/apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx index 96e5bd502fe..6fdd9b54013 100644 --- a/apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx +++ b/apps/wallet-dashboard/components/Dialogs/Assets/views/DetailsView.tsx @@ -11,7 +11,6 @@ import { VisualAssetCard, VisualAssetType, } from '@iota/apps-ui-kit'; -import Link from 'next/link'; import { formatAddress } from '@iota/iota-sdk/utils'; import { DialogLayoutBody, DialogLayoutFooter } from '../../layout'; import { IotaObjectData } from '@iota/iota-sdk/client'; @@ -38,7 +37,6 @@ export function DetailsView({ onClose, asset, onSend }: DetailsViewProps) { isAssetTransferable, metaKeys, metaValues, - formatMetaValue, isContainedInKiosk, kioskItem, objectData, @@ -88,11 +86,7 @@ export function DetailsView({ onClose, asset, onSend }: DetailsViewProps) { {nftDisplayData?.projectUrl && ( - {nftDisplayData?.projectUrl} - - } + value={nftDisplayData?.projectUrl} fullwidth /> )} @@ -144,23 +138,14 @@ export function DetailsView({ onClose, asset, onSend }: DetailsViewProps) {
{metaKeys.map((aKey, idx) => { - const { value, valueLink } = formatMetaValue( - metaValues[idx], - true, - false, - ); return ( - {value} - - ) : ( - value - ) + typeof metaValues[idx] === 'object' + ? JSON.stringify(metaValues[idx]) + : metaValues[idx] } fullwidth /> diff --git a/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx b/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx index 148cb2b0b4a..e1dd96934b5 100644 --- a/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx +++ b/apps/wallet/src/ui/app/pages/home/nft-details/index.tsx @@ -8,7 +8,7 @@ import { useUnlockedGuard } from '_src/ui/app/hooks/useUnlockedGuard'; import { useNFTBasicData, useNftDetails, Collapsible } from '@iota/core'; import { formatAddress } from '@iota/iota-sdk/utils'; import cl from 'clsx'; -import { Link, Navigate, useNavigate, useSearchParams } from 'react-router-dom'; +import { Navigate, useNavigate, useSearchParams } from 'react-router-dom'; import { Button, ButtonType, KeyValueInfo } from '@iota/apps-ui-kit'; function NFTDetailsPage() { @@ -23,7 +23,6 @@ function NFTDetailsPage() { objectData, metaKeys, metaValues, - formatMetaValue, isContainedInKiosk, kioskItem, isAssetTransferable, @@ -94,11 +93,7 @@ function NFTDetailsPage() { {nftDisplayData?.projectUrl && ( - {nftDisplayData?.projectUrl} - - } + value={nftDisplayData?.projectUrl} fullwidth /> )} @@ -153,27 +148,17 @@ function NFTDetailsPage() {
{metaKeys.map((aKey, idx) => { - const { value, valueLink } = - formatMetaValue( - metaValues[idx], - true, - false, - ); return ( - {value} - - ) + typeof metaValues[idx] === + 'object' + ? JSON.stringify( + metaValues[idx], + ) + : metaValues[idx] } fullwidth />