From 47e6848fbf12c416b96585704f87c0c51515884e Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Mon, 15 Nov 2021 13:45:49 +0100 Subject: [PATCH] explorer: Display more decimals for small token prices (#21276) --- explorer/src/components/account/TokenAccountSection.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/explorer/src/components/account/TokenAccountSection.tsx b/explorer/src/components/account/TokenAccountSection.tsx index dc6dcdaeb..56c5bba18 100644 --- a/explorer/src/components/account/TokenAccountSection.tsx +++ b/explorer/src/components/account/TokenAccountSection.tsx @@ -108,8 +108,12 @@ function FungibleTokenMintAccountCard({ const coinInfo = useCoinGecko(tokenInfo?.extensions?.coingeckoId); let tokenPriceInfo; + let tokenPriceDecimals = 2; if (coinInfo?.status === CoingeckoStatus.Success) { tokenPriceInfo = coinInfo.coinInfo; + if (tokenPriceInfo && tokenPriceInfo.price < 1) { + tokenPriceDecimals = 6; + } } return ( @@ -130,7 +134,7 @@ function FungibleTokenMintAccountCard({

- ${tokenPriceInfo.price.toFixed(2)}{" "} + ${tokenPriceInfo.price.toFixed(tokenPriceDecimals)}{" "} {tokenPriceInfo.price_change_percentage_24h > 0 && ( ↑{" "}