From 4b9bd7009bf5a095bc46ffb7c01975a6c4ab7912 Mon Sep 17 00:00:00 2001 From: armaniferrante Date: Thu, 19 Aug 2021 17:46:09 -0700 Subject: [PATCH] Toggle token details --- src/components/BalancesList.js | 74 ++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/src/components/BalancesList.js b/src/components/BalancesList.js index c820d9b..3fdfceb 100644 --- a/src/components/BalancesList.js +++ b/src/components/BalancesList.js @@ -201,30 +201,37 @@ export default function BalancesList() { { - setIsCopied(true) + setIsCopied(true); setTimeout(() => { - setIsCopied(false) - }, 1000) + setIsCopied(false); + }, 1000); }} > - {isCopied - ? 'Copied' - : 'Copy to clipboard'} + {isCopied ? 'Copied' : 'Copy to clipboard'} } - style={{fontSize: '10rem'}} + style={{ fontSize: '10rem' }} > {selectedAccount && selectedAccount.name} - {isExtensionWidth ? '' : ` (${selectedAccount && shortenAddress(selectedAccount.address.toBase58())})`}{' '} + {isExtensionWidth + ? '' + : ` (${ + selectedAccount && + shortenAddress(selectedAccount.address.toBase58()) + })`}{' '} {allTokensLoaded && ( <>({numberFormat.format(totalUsdValue.toFixed(2))}) )} @@ -368,6 +375,11 @@ const useStyles = makeStyles((theme) => ({ marginTop: theme.spacing(1), marginBottom: theme.spacing(1), }, + viewDetails: { + '&:hover': { + cursor: 'pointer', + }, + }, })); export function BalanceListItem({ publicKey, expandable, setUsdValue }) { @@ -572,6 +584,7 @@ function BalanceListItemDetails({ closeTokenAccountDialogOpen, setCloseTokenAccountDialogOpen, ] = useState(false); + const [showDetails, setShowDetails] = useState(false); const wallet = useWallet(); const isProdNetwork = useIsProdNetwork(); const [swapInfo] = useAsyncData(async () => { @@ -620,24 +633,13 @@ function BalanceListItemDetails({ Token Symbol: {tokenSymbol ?? 'Unknown'} - {mint ? ( - - Token Address: {mint.toBase58()} - - ) : null} - {!isSolAddress && ( - - {isAssociatedToken ? 'Associated' : ''} Token Metadata:{' '} - {publicKey.toBase58()} - - )} - {!isSolAddress && isAssociatedToken === false && ( -
- This is an auxiliary token account. -
- )}
+ {!isSolAddress && isAssociatedToken === false && ( +
+ This is an auxiliary token account. +
+ )} )} + {!isSolAddress && ( + + setShowDetails(!showDetails)} + > + View Details + + + )} + {showDetails && + (mint ? ( + + Mint Address: {mint.toBase58()} + + ) : null)} + {!isSolAddress && showDetails && ( + + {isAssociatedToken ? 'Associated' : ''} Token Metadata:{' '} + {publicKey.toBase58()} + + )}
{exportNeedsDisplay && wallet.allowsExport && (