Skip to content

Commit

Permalink
average -> normal
Browse files Browse the repository at this point in the history
  • Loading branch information
tom2drum committed Jan 15, 2024
1 parent 1bc0b94 commit 18b7f4b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 40 deletions.
8 changes: 3 additions & 5 deletions ui/shared/GasInfoTooltipContent/GasInfoRow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GridItem, chakra, useColorModeValue } from '@chakra-ui/react';
import { GridItem, chakra } from '@chakra-ui/react';
import React from 'react';

import type { GasPriceInfo } from 'types/api/stats';
Expand All @@ -11,8 +11,6 @@ interface Props {
}

const GasInfoRow = ({ name, info }: Props) => {
const labelColor = useColorModeValue('blue.100', 'blue.600');

const content = (() => {
if (!info || info.price === null) {
return 'N/A';
Expand All @@ -32,8 +30,8 @@ const GasInfoRow = ({ name, info }: Props) => {

return (
<>
<GridItem color={ labelColor }>{ name }</GridItem>
<GridItem textAlign="right">{ content }</GridItem>
<GridItem color="blue.100">{ name }</GridItem>
<GridItem color="text" textAlign="right">{ content }</GridItem>
</>
);
};
Expand Down
32 changes: 17 additions & 15 deletions ui/shared/GasInfoTooltipContent/GasInfoTooltipContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Grid, GridItem } from '@chakra-ui/react';
import { DarkMode, Grid, GridItem } from '@chakra-ui/react';
import React from 'react';

import type { HomeStats } from 'types/api/stats';
Expand All @@ -20,21 +20,23 @@ const GasInfoTooltipContent = ({ data, dataUpdatedAt }: Props) => {
}

return (
<Grid templateColumns="repeat(2, max-content)" rowGap={ 2 } columnGap={ 4 } padding={ 4 } fontSize="xs" lineHeight={ 4 }>
{ data.gas_price_updated_at && (
<>
<GridItem color="text_secondary">Last update</GridItem>
<GridItem color="text_secondary" display="flex" justifyContent="flex-end" columnGap={ 2 }>
{ dayjs(data.gas_price_updated_at).format('MMM DD, HH:mm:ss') }
{ data.gas_prices_update_in !== 0 &&
<DarkMode>
<Grid templateColumns="repeat(2, max-content)" rowGap={ 2 } columnGap={ 4 } padding={ 4 } fontSize="xs" lineHeight={ 4 }>
{ data.gas_price_updated_at && (
<>
<GridItem color="text_secondary">Last update</GridItem>
<GridItem color="text_secondary" display="flex" justifyContent="flex-end" columnGap={ 2 }>
{ dayjs(data.gas_price_updated_at).format('MMM DD, HH:mm:ss') }
{ data.gas_prices_update_in !== 0 &&
<GasInfoUpdateTimer key={ dataUpdatedAt } startTime={ dataUpdatedAt } duration={ data.gas_prices_update_in }/> }
</GridItem>
</>
) }
<GasInfoRow name="Slow" info={ data.gas_prices.slow }/>
<GasInfoRow name="Average" info={ data.gas_prices.average }/>
<GasInfoRow name="Fast" info={ data.gas_prices.fast }/>
</Grid>
</GridItem>
</>
) }
<GasInfoRow name="Slow" info={ data.gas_prices.slow }/>
<GasInfoRow name="Normal" info={ data.gas_prices.average }/>
<GasInfoRow name="Fast" info={ data.gas_prices.fast }/>
</Grid>
</DarkMode>
);
};

Expand Down
38 changes: 18 additions & 20 deletions ui/snippets/topBar/TopBarStats.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, LightMode, Link, Skeleton, Tooltip, chakra, useDisclosure } from '@chakra-ui/react';
import { Flex, Link, Skeleton, Tooltip, chakra, useDisclosure } from '@chakra-ui/react';
import React from 'react';

import config from 'configs/app';
Expand Down Expand Up @@ -79,26 +79,24 @@ const TopBarStats = () => {
{ data?.gas_prices && data.gas_prices.average !== null && config.UI.homepage.showGasTracker && (
<Skeleton isLoaded={ !isPlaceholderData }>
<chakra.span color="text_secondary">Gas </chakra.span>
<LightMode>
<Tooltip
label={ <GasInfoTooltipContent data={ data } dataUpdatedAt={ dataUpdatedAt }/> }
hasArrow={ false }
borderRadius="md"
offset={ [ 0, 16 ] }
bgColor="blackAlpha.900"
p={ 0 }
isOpen={ isOpen }
<Tooltip
label={ <GasInfoTooltipContent data={ data } dataUpdatedAt={ dataUpdatedAt }/> }
hasArrow={ false }
borderRadius="md"
offset={ [ 0, 16 ] }
bgColor="blackAlpha.900"
p={ 0 }
isOpen={ isOpen }
>
<Link
_hover={{ textDecoration: 'none', color: 'link_hovered' }}
onClick={ handleClick }
onMouseEnter={ onOpen }
onMouseLeave={ onClose }
>
<Link
_hover={{ textDecoration: 'none', color: 'link_hovered' }}
onClick={ handleClick }
onMouseEnter={ onOpen }
onMouseLeave={ onClose }
>
{ data.gas_prices.average.fiat_price ? `$${ data.gas_prices.average.fiat_price }` : `${ data.gas_prices.average.price } Gwei` }
</Link>
</Tooltip>
</LightMode>
{ data.gas_prices.average.fiat_price ? `$${ data.gas_prices.average.fiat_price }` : `${ data.gas_prices.average.price } Gwei` }
</Link>
</Tooltip>
</Skeleton>
) }
</Flex>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 18b7f4b

Please sign in to comment.