@@ -7,35 +7,49 @@ import { isDefined } from '@/utils/is-defined'
77import Decimal from 'decimal.js'
88import { AccountLink } from '@/features/accounts/components/account-link'
99import { ZERO_ADDRESS } from '@/features/common/constants'
10+ import {
11+ assetAddressesLabel ,
12+ assetClawbackLabel ,
13+ assetCreatorLabel ,
14+ assetDecimalsLabel ,
15+ assetDefaultFrozenLabel ,
16+ assetDetailsLabel ,
17+ assetFreezeLabel ,
18+ assetIdLabel ,
19+ assetJsonLabel ,
20+ assetManagerLabel ,
21+ assetNameLabel ,
22+ assetReserveLabel ,
23+ assetTotalSupplyLabel ,
24+ assetTransactionsLabel ,
25+ assetUnitNameLabel ,
26+ assetUrlLabel ,
27+ } from './labels'
28+ import { Badge } from '@/features/common/components/badge'
29+ import { AssetMedia } from './asset-media'
30+ import { AssetTraits } from './asset-traits'
31+ import { AssetMetadata } from './asset-metadata'
1032
1133type Props = {
1234 asset : Asset
1335}
1436
15- export const assetIdLabel = 'Asset ID'
16- export const assetNameLabel = 'Name'
17- export const assetUnitNameLabel = 'Unit'
18- export const assetDecimalsLabel = 'Decimals'
19- export const assetTotalSupplyLabel = 'Total Supply'
20- export const assetMetadataHashLabel = 'Metadata Hash'
21- export const assetDefaultFrozenLabel = 'Default Frozen'
22- export const assetUrlLabel = 'URL'
23-
24- export const assetAddressesLabel = 'Asset Addresses'
25- export const assetCreatorLabel = 'Creator'
26- export const assetManagerLabel = 'Manager'
27- export const assetReserveLabel = 'Reserve'
28- export const assetFreezeLabel = 'Freeze'
29- export const assetClawbackLabel = 'Clawback'
30-
31- export const assetJsonLabel = 'Asset JSON'
32-
3337export function AssetDetails ( { asset } : Props ) {
3438 const assetItems = useMemo (
3539 ( ) => [
3640 {
3741 dt : assetIdLabel ,
38- dd : asset . id ,
42+ dd : (
43+ < >
44+ < span > { asset . id } </ span >
45+ { asset . standardsUsed . map ( ( s , i ) => (
46+ < Badge key = { i } variant = "outline" >
47+ { s }
48+ </ Badge >
49+ ) ) }
50+ < Badge variant = "outline" > { asset . type } </ Badge >
51+ </ >
52+ ) ,
3953 } ,
4054 asset . name
4155 ? {
@@ -51,7 +65,7 @@ export function AssetDetails({ asset }: Props) {
5165 : undefined ,
5266 {
5367 dt : assetTotalSupplyLabel ,
54- dd : `${ new Decimal ( asset . total . toString ( ) ) . div ( new Decimal ( 10 ) . pow ( asset . decimals . toString ( ) ) ) } ${ asset . unitName } ` ,
68+ dd : `${ new Decimal ( asset . total . toString ( ) ) . div ( new Decimal ( 10 ) . pow ( asset . decimals . toString ( ) ) ) } ${ asset . unitName ?? '' } ` ,
5569 } ,
5670 {
5771 dt : assetDecimalsLabel ,
@@ -72,7 +86,7 @@ export function AssetDetails({ asset }: Props) {
7286 }
7387 : undefined ,
7488 ] ,
75- [ asset . decimals , asset . defaultFrozen , asset . id , asset . name , asset . total , asset . unitName , asset . url ]
89+ [ asset . id , asset . name , asset . standardsUsed , asset . type , asset . unitName , asset . total , asset . decimals , asset . defaultFrozen , asset . url ]
7690 ) . filter ( isDefined )
7791
7892 const assetAddresses = useMemo (
@@ -111,25 +125,42 @@ export function AssetDetails({ asset }: Props) {
111125
112126 return (
113127 < div className = { cn ( 'space-y-6 pt-7' ) } >
114- < Card className = { cn ( 'p-4' ) } >
115- < CardContent className = { cn ( 'text-sm space-y-2' ) } >
116- < DescriptionList items = { assetItems } />
117- </ CardContent >
118- </ Card >
119- < Card className = { cn ( 'p-4' ) } >
128+ < Card aria-label = { assetDetailsLabel } className = { cn ( 'p-4' ) } >
120129 < CardContent className = { cn ( 'text-sm space-y-2' ) } >
121- < h1 className = { cn ( 'text-2xl text-primary font-bold' ) } > { assetAddressesLabel } </ h1 >
122- < DescriptionList items = { assetAddresses } />
123- </ CardContent >
124- </ Card >
125- < Card className = { cn ( 'p-4' ) } >
126- < CardContent className = { cn ( 'text-sm space-y-2' ) } >
127- < h1 className = { cn ( 'text-2xl text-primary font-bold' ) } > { assetJsonLabel } </ h1 >
128- < div className = { cn ( 'border-solid border-2 border-border h-96 grid' ) } >
129- < pre className = { cn ( 'overflow-scroll p-4' ) } > { asset . json } </ pre >
130+ < div className = { cn ( 'grid grid-cols-[1fr_max-content]' ) } >
131+ < DescriptionList items = { assetItems } />
132+ < AssetMedia asset = { asset } />
130133 </ div >
131134 </ CardContent >
132135 </ Card >
136+ { asset . id !== 0 && (
137+ < >
138+ < Card className = { cn ( 'p-4' ) } >
139+ < CardContent className = { cn ( 'text-sm space-y-2' ) } >
140+ < h1 className = { cn ( 'text-2xl text-primary font-bold' ) } > { assetAddressesLabel } </ h1 >
141+ < DescriptionList items = { assetAddresses } />
142+ </ CardContent >
143+ </ Card >
144+
145+ < AssetMetadata metadata = { asset . metadata } />
146+ < AssetTraits traits = { asset . traits } />
147+ < Card className = { cn ( 'p-4' ) } >
148+ < CardContent className = { cn ( 'text-sm space-y-2' ) } >
149+ < h1 className = { cn ( 'text-2xl text-primary font-bold' ) } > { assetJsonLabel } </ h1 >
150+ < div className = { cn ( 'border-solid border-2 border-border h-96 grid' ) } >
151+ < pre className = { cn ( 'overflow-scroll p-4' ) } > { asset . json } </ pre >
152+ </ div >
153+ </ CardContent >
154+ </ Card >
155+
156+ < Card className = { cn ( 'p-4' ) } >
157+ < CardContent className = { cn ( 'text-sm space-y-2' ) } >
158+ < h1 className = { cn ( 'text-2xl text-primary font-bold' ) } > { assetTransactionsLabel } </ h1 >
159+ < div className = { cn ( 'border-solid border-2 grid p-4' ) } > { /* <TransactionsTable transactions={asset.transactions} /> */ } </ div >
160+ </ CardContent >
161+ </ Card >
162+ </ >
163+ ) }
133164 </ div >
134165 )
135166}
0 commit comments