explorer: Display more decimals for small token prices (#21276)

This commit is contained in:
Justin Starry 2021-11-15 13:45:49 +01:00 committed by GitHub
parent 647aa92667
commit 47e6848fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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({
</span>
</h4>
<h1 className="mb-0">
${tokenPriceInfo.price.toFixed(2)}{" "}
${tokenPriceInfo.price.toFixed(tokenPriceDecimals)}{" "}
{tokenPriceInfo.price_change_percentage_24h > 0 && (
<small className="change-positive">
&uarr;{" "}