Skip to content

Commit

Permalink
Merge pull request #1478 from blockscout/fe-1474
Browse files Browse the repository at this point in the history
null gas prices
  • Loading branch information
tom2drum authored Jan 5, 2024
2 parents a078553 + bd68f62 commit 92073ca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions types/api/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export type HomeStats = {
}

export type GasPrices = {
average: number;
fast: number;
slow: number;
average: number | null;
fast: number | null;
slow: number | null;
}

export type Counters = {
Expand Down
2 changes: 1 addition & 1 deletion ui/home/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Stats = () => {
<StatsItem
icon="gas"
title="Gas tracker"
value={ `${ Number(data.gas_prices.average).toLocaleString() } Gwei` }
value={ data.gas_prices.average !== null ? `${ Number(data.gas_prices.average).toLocaleString() } Gwei` : 'N/A' }
_last={ isOdd ? lastItemTouchStyle : undefined }
tooltipLabel={ gasLabel }
isLoading={ isPlaceholderData }
Expand Down
6 changes: 3 additions & 3 deletions ui/shared/GasInfoTooltipContent/GasInfoTooltipContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const GasInfoTooltipContent = ({ gasPrices }: {gasPrices: GasPrices}) => {
return (
<Grid templateColumns="repeat(2, max-content)" rowGap={ 2 } columnGap={ 4 } padding={ 4 } fontSize="xs">
<GridItem { ...nameStyleProps }>Slow</GridItem>
<GridItem>{ `${ gasPrices.slow } Gwei` }</GridItem>
<GridItem>{ gasPrices.slow !== null ? `${ gasPrices.slow } Gwei` : 'N/A' }</GridItem>
<GridItem { ...nameStyleProps }>Average</GridItem>
<GridItem>{ `${ gasPrices.average } Gwei` }</GridItem>
<GridItem>{ gasPrices.average !== null ? `${ gasPrices.average } Gwei` : 'N/A' }</GridItem>
<GridItem { ...nameStyleProps }>Fast</GridItem>
<GridItem>{ `${ gasPrices.fast } Gwei` }</GridItem>
<GridItem>{ gasPrices.fast !== null ? `${ gasPrices.fast } Gwei` : 'N/A' }</GridItem>
</Grid>
);
};
Expand Down
2 changes: 1 addition & 1 deletion ui/snippets/topBar/TopBarStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const TopBarStats = () => {
</Skeleton>
) }
{ data?.coin_price && config.UI.homepage.showGasTracker && <TextSeparator color="divider"/> }
{ data?.gas_prices && config.UI.homepage.showGasTracker && (
{ data?.gas_prices && data.gas_prices.average !== null && config.UI.homepage.showGasTracker && (
<Skeleton isLoaded={ !isPlaceholderData }>
<chakra.span color="text_secondary">Gas </chakra.span>
<LightMode>
Expand Down

0 comments on commit 92073ca

Please sign in to comment.