-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathTokenDetails.tsx
More file actions
90 lines (83 loc) · 2.91 KB
/
TokenDetails.tsx
File metadata and controls
90 lines (83 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { FC } from 'react'
import { EvmToken } from '../../../oasis-nexus/api'
import { TextSkeleton } from '../Skeleton'
import { StyledDescriptionList } from '../StyledDescriptionList'
import { useScreenSize } from '../../hooks/useScreensize'
import { useTranslation } from 'react-i18next'
import { TokenLinkWithIcon } from './TokenLinkWithIcon'
import { CopyToClipboard } from '../CopyToClipboard'
import { AccountLink } from '../Account/AccountLink'
import { DashboardLink } from '../../pages/ParatimeDashboardPage/DashboardLink'
import { VerificationIcon } from '../ContractVerificationIcon'
import { TokenTypeTag } from './TokenList'
import { RoundedBalance } from '../RoundedBalance'
import { HighlightedText } from '../HighlightedText'
export const TokenDetails: FC<{
isLoading?: boolean
token: EvmToken | undefined
showLayer?: boolean
standalone?: boolean
}> = ({ isLoading, token, showLayer, standalone = false }) => {
const { t } = useTranslation()
const { isMobile } = useScreenSize()
if (isLoading) return <TextSkeleton numberOfRows={7} />
if (!token) return null
return (
<StyledDescriptionList titleWidth={isMobile ? '100px' : '200px'} standalone={standalone}>
{showLayer && (
<>
<dt>{t('common.paratime')}</dt>
<dd>
<DashboardLink scope={token} />
</dd>
</>
)}
<dt>{t('common.name')}</dt>
<dd>
<TokenLinkWithIcon
scope={token}
address={token.eth_contract_addr ?? token.contract_addr}
name={token.name}
/>
<div className="ml-2 font-bold text-muted-foreground whitespace-nowrap">
<HighlightedText text={token.symbol} />
</div>
</dd>
<dt>{t('common.type')}</dt>
<dd>
<TokenTypeTag tokenType={token.type} />
</dd>
<dt>{t(isMobile ? 'common.smartContract_short' : 'common.smartContract')}</dt>
<dd>
<div className="inline-flex items-center">
<AccountLink
showOnlyAddress
scope={token}
address={token.eth_contract_addr ?? token.contract_addr}
/>
<CopyToClipboard value={token.eth_contract_addr ?? token.contract_addr} />
</div>
</dd>
<dt>{t('contract.verification.title')}</dt>
<dd>
<VerificationIcon
address_eth={token.eth_contract_addr}
scope={token}
verificationLevel={token.verification_level}
/>
</dd>
<dt>{t(isMobile ? 'tokens.holders' : 'tokens.holdersCount')}</dt>
<dd>
{typeof token.num_holders === 'number' ? token.num_holders.toLocaleString() : t('common.missing')}
</dd>
<dt>{t('tokens.totalSupply')}</dt>
<dd>
{token.total_supply ? (
<RoundedBalance compactLargeNumbers value={token.total_supply} ticker={token?.symbol} />
) : (
t('common.missing')
)}
</dd>
</StyledDescriptionList>
)
}