Commit 2099d37d authored by tom's avatar tom

display USD value

parent 6e68889c
...@@ -53,6 +53,18 @@ const Stats = () => { ...@@ -53,6 +53,18 @@ const Stats = () => {
const isOdd = Boolean(itemsCount % 2); const isOdd = Boolean(itemsCount % 2);
const gasLabel = hasGasTracker && data.gas_prices ? <GasInfoTooltipContent data={ data }/> : null; 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 = ( content = (
<> <>
{ config.features.zkEvmRollup.isEnabled ? ( { config.features.zkEvmRollup.isEnabled ? (
...@@ -98,10 +110,7 @@ const Stats = () => { ...@@ -98,10 +110,7 @@ const Stats = () => {
<StatsItem <StatsItem
icon="gas" icon="gas"
title="Gas tracker" title="Gas tracker"
value={ data.gas_prices.average && data.gas_prices.average.price !== null ? value={ gasPriceText }
`${ Number(data.gas_prices.average.price).toLocaleString() } Gwei` :
'N/A'
}
_last={ isOdd ? lastItemTouchStyle : undefined } _last={ isOdd ? lastItemTouchStyle : undefined }
tooltipLabel={ gasLabel } tooltipLabel={ gasLabel }
isLoading={ isPlaceholderData } isLoading={ isPlaceholderData }
......
...@@ -20,7 +20,7 @@ const GasInfoRow = ({ name, info }: Props) => { ...@@ -20,7 +20,7 @@ const GasInfoRow = ({ name, info }: Props) => {
return ( return (
<> <>
<span>{ info.price } Gwei</span> <span>{ info.fiat_price ? `$${ info.fiat_price }` : `${ info.price } Gwei` }</span>
{ info.time && ( { info.time && (
<chakra.span color="text_secondary"> <chakra.span color="text_secondary">
{ space }per tx { asymp } { (info.time / 1000).toLocaleString(undefined, { maximumFractionDigits: 1 }) }s { space }per tx { asymp } { (info.time / 1000).toLocaleString(undefined, { maximumFractionDigits: 1 }) }s
......
...@@ -96,7 +96,7 @@ const TopBarStats = () => { ...@@ -96,7 +96,7 @@ const TopBarStats = () => {
onMouseEnter={ onOpen } onMouseEnter={ onOpen }
onMouseLeave={ onClose } 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> </Link>
</Tooltip> </Tooltip>
</LightMode> </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