Commit 2099d37d authored by tom's avatar tom

display USD value

parent 6e68889c
......@@ -53,6 +53,18 @@ const Stats = () => {
const isOdd = Boolean(itemsCount % 2);
const gasLabel = hasGasTracker && data.gas_prices ? <GasInfoTooltipContent data={ data }/> : null;
const gasPriceText = (() => {
if (data.gas_prices?.average?.fiat_price) {
return `$${ data.gas_prices.average.fiat_price }`;
}
if (data.gas_prices?.average?.price) {
return `${ data.gas_prices.average.price.toLocaleString() } Gwei`;
}
return 'N/A';
})();
content = (
<>
{ config.features.zkEvmRollup.isEnabled ? (
......@@ -98,10 +110,7 @@ const Stats = () => {
<StatsItem
icon="gas"
title="Gas tracker"
value={ data.gas_prices.average && data.gas_prices.average.price !== null ?
`${ Number(data.gas_prices.average.price).toLocaleString() } Gwei` :
'N/A'
}
value={ gasPriceText }
_last={ isOdd ? lastItemTouchStyle : undefined }
tooltipLabel={ gasLabel }
isLoading={ isPlaceholderData }
......
......@@ -20,7 +20,7 @@ const GasInfoRow = ({ name, info }: Props) => {
return (
<>
<span>{ info.price } Gwei</span>
<span>{ info.fiat_price ? `$${ info.fiat_price }` : `${ info.price } Gwei` }</span>
{ info.time && (
<chakra.span color="text_secondary">
{ space }per tx { asymp } { (info.time / 1000).toLocaleString(undefined, { maximumFractionDigits: 1 }) }s
......
......@@ -96,7 +96,7 @@ const TopBarStats = () => {
onMouseEnter={ onOpen }
onMouseLeave={ onClose }
>
{ data.gas_prices.average.price } Gwei
{ data.gas_prices.average.fiat_price ? `$${ data.gas_prices.average.fiat_price }` : `${ data.gas_prices.average.price } Gwei` }
</Link>
</Tooltip>
</LightMode>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment