@@ -3,7 +3,6 @@ import { Address } from 'wagmi';
3
3
import { ImageResponse } from '@/components/cactiComponents' ;
4
4
import { ImageVariant } from '@/components/cactiComponents/ImageResponse' ;
5
5
import { InlineChip } from '@/components/cactiComponents/InlineChip' ;
6
- import useNft from '@/hooks/useNft' ;
7
6
8
7
export interface NftAssetProps {
9
8
network : Network ;
@@ -14,6 +13,20 @@ export interface NftAssetProps {
14
13
previewImageUrl ?: string ;
15
14
variant ?: ImageVariant ; // widget variant
16
15
price ?: string ;
16
+ attributes ?: { trait_type : string , value : string } [ ] ;
17
+ }
18
+
19
+ const TraitList = ( { attributes } : { attributes : { trait_type : string , value : string } [ ] } ) => {
20
+ return (
21
+ < div className = "" >
22
+ { attributes . map ( ( attribute , index ) => (
23
+ < div key = { index } className = "text-xs mr-2 mb-2" >
24
+ < span className = "font-bold" > { attribute . trait_type } </ span > : { attribute . value }
25
+ </ div >
26
+ ) ) }
27
+ </ div >
28
+ )
29
+
17
30
}
18
31
19
32
export const NftAsset = ( {
@@ -25,25 +38,26 @@ export const NftAsset = ({
25
38
previewImageUrl,
26
39
variant,
27
40
price,
41
+ attributes
28
42
} : NftAssetProps ) => {
29
- const { data : nftData } = useNft ( { network, address, tokenId } ) ;
30
43
31
44
return (
32
45
< ImageResponse
33
- image = { nftData . smallPreviewImageUrl || previewImageUrl }
46
+ image = { previewImageUrl }
34
47
imageTags = {
35
48
variant === ImageVariant . SHOWCASE
36
49
? [ `Token Id: ${ tokenId } ` , `${ network . replace ( '-mainnet' , '' ) } ` ]
37
50
: [ `Token Id: ${ tokenId } ` ] // always show the token id
38
51
}
39
- title = { nftData . name || name }
40
- subTitle = { nftData . collectionName || collectionName }
52
+ title = { name }
53
+ subTitle = { collectionName }
41
54
imageLink = { `https://center.app/${ network } /collections/${ address } /${ tokenId } ` }
42
55
variant = { variant }
43
56
>
44
- { variant === ImageVariant . SHOWCASE && (
57
+ { /* { variant === ImageVariant.SHOWCASE && (
45
58
<div className="text-xs">{nftData.metadata?.description}</div>
46
- ) }
59
+ )} */ }
60
+ { attributes && < TraitList attributes = { attributes } /> }
47
61
{ price && (
48
62
< InlineChip
49
63
className = "text-xs"
0 commit comments