Toggle token details
This commit is contained in:
parent
c2090ff427
commit
4b9bd7009b
|
@ -201,30 +201,37 @@ export default function BalancesList() {
|
||||||
<CopyToClipboard
|
<CopyToClipboard
|
||||||
text={selectedAccount && selectedAccount.address.toBase58()}
|
text={selectedAccount && selectedAccount.address.toBase58()}
|
||||||
onCopy={() => {
|
onCopy={() => {
|
||||||
setIsCopied(true)
|
setIsCopied(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setIsCopied(false)
|
setIsCopied(false);
|
||||||
}, 1000)
|
}, 1000);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
<Typography>
|
<Typography>
|
||||||
{isCopied
|
{isCopied ? 'Copied' : 'Copy to clipboard'}
|
||||||
? 'Copied'
|
|
||||||
: 'Copy to clipboard'}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
style={{fontSize: '10rem'}}
|
style={{ fontSize: '10rem' }}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
style={{ flexGrow: 1, fontSize: isExtensionWidth && '1rem', cursor: 'pointer' }}
|
style={{
|
||||||
|
flexGrow: 1,
|
||||||
|
fontSize: isExtensionWidth && '1rem',
|
||||||
|
cursor: 'pointer',
|
||||||
|
}}
|
||||||
hover={true}
|
hover={true}
|
||||||
component="h2"
|
component="h2"
|
||||||
>
|
>
|
||||||
{selectedAccount && selectedAccount.name}
|
{selectedAccount && selectedAccount.name}
|
||||||
{isExtensionWidth ? '' : ` (${selectedAccount && shortenAddress(selectedAccount.address.toBase58())})`}{' '}
|
{isExtensionWidth
|
||||||
|
? ''
|
||||||
|
: ` (${
|
||||||
|
selectedAccount &&
|
||||||
|
shortenAddress(selectedAccount.address.toBase58())
|
||||||
|
})`}{' '}
|
||||||
{allTokensLoaded && (
|
{allTokensLoaded && (
|
||||||
<>({numberFormat.format(totalUsdValue.toFixed(2))})</>
|
<>({numberFormat.format(totalUsdValue.toFixed(2))})</>
|
||||||
)}
|
)}
|
||||||
|
@ -368,6 +375,11 @@ const useStyles = makeStyles((theme) => ({
|
||||||
marginTop: theme.spacing(1),
|
marginTop: theme.spacing(1),
|
||||||
marginBottom: theme.spacing(1),
|
marginBottom: theme.spacing(1),
|
||||||
},
|
},
|
||||||
|
viewDetails: {
|
||||||
|
'&:hover': {
|
||||||
|
cursor: 'pointer',
|
||||||
|
},
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export function BalanceListItem({ publicKey, expandable, setUsdValue }) {
|
export function BalanceListItem({ publicKey, expandable, setUsdValue }) {
|
||||||
|
@ -572,6 +584,7 @@ function BalanceListItemDetails({
|
||||||
closeTokenAccountDialogOpen,
|
closeTokenAccountDialogOpen,
|
||||||
setCloseTokenAccountDialogOpen,
|
setCloseTokenAccountDialogOpen,
|
||||||
] = useState(false);
|
] = useState(false);
|
||||||
|
const [showDetails, setShowDetails] = useState(false);
|
||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
const isProdNetwork = useIsProdNetwork();
|
const isProdNetwork = useIsProdNetwork();
|
||||||
const [swapInfo] = useAsyncData(async () => {
|
const [swapInfo] = useAsyncData(async () => {
|
||||||
|
@ -620,24 +633,13 @@ function BalanceListItemDetails({
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
Token Symbol: {tokenSymbol ?? 'Unknown'}
|
Token Symbol: {tokenSymbol ?? 'Unknown'}
|
||||||
</Typography>
|
</Typography>
|
||||||
{mint ? (
|
|
||||||
<Typography variant="body2" className={classes.address}>
|
|
||||||
Token Address: {mint.toBase58()}
|
|
||||||
</Typography>
|
|
||||||
) : null}
|
|
||||||
{!isSolAddress && (
|
|
||||||
<Typography variant="body2" className={classes.address}>
|
|
||||||
{isAssociatedToken ? 'Associated' : ''} Token Metadata:{' '}
|
|
||||||
{publicKey.toBase58()}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
{!isSolAddress && isAssociatedToken === false && (
|
|
||||||
<div style={{ display: 'flex' }}>
|
|
||||||
This is an auxiliary token account.
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||||
<div>
|
<div>
|
||||||
|
{!isSolAddress && isAssociatedToken === false && (
|
||||||
|
<div style={{ display: 'flex' }}>
|
||||||
|
This is an auxiliary token account.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
|
@ -674,6 +676,28 @@ function BalanceListItemDetails({
|
||||||
</Link>
|
</Link>
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
{!isSolAddress && (
|
||||||
|
<Typography variant="body2">
|
||||||
|
<Link
|
||||||
|
className={classes.viewDetails}
|
||||||
|
onClick={() => setShowDetails(!showDetails)}
|
||||||
|
>
|
||||||
|
View Details
|
||||||
|
</Link>
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
{showDetails &&
|
||||||
|
(mint ? (
|
||||||
|
<Typography variant="body2" className={classes.address}>
|
||||||
|
Mint Address: {mint.toBase58()}
|
||||||
|
</Typography>
|
||||||
|
) : null)}
|
||||||
|
{!isSolAddress && showDetails && (
|
||||||
|
<Typography variant="body2" className={classes.address}>
|
||||||
|
{isAssociatedToken ? 'Associated' : ''} Token Metadata:{' '}
|
||||||
|
{publicKey.toBase58()}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{exportNeedsDisplay && wallet.allowsExport && (
|
{exportNeedsDisplay && wallet.allowsExport && (
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in New Issue