Commit d02f1603 authored by tom's avatar tom

fix gas price tooltip

parent 426251f5
...@@ -7,7 +7,7 @@ export type HomeStats = { ...@@ -7,7 +7,7 @@ export type HomeStats = {
total_gas_used: string; total_gas_used: string;
transactions_today: string; transactions_today: string;
gas_used_today: string; gas_used_today: string;
gas_prices: GasPrices; gas_prices: GasPrices | null;
static_gas_price: string; static_gas_price: string;
market_cap: string; market_cap: string;
network_utilization_percentage: number; network_utilization_percentage: number;
......
...@@ -45,7 +45,7 @@ const Stats = () => { ...@@ -45,7 +45,7 @@ const Stats = () => {
const lastItemTouchStyle = { gridColumn: { base: 'span 2', lg: 'unset' } }; const lastItemTouchStyle = { gridColumn: { base: 'span 2', lg: 'unset' } };
if (data) { if (data) {
const gasLabel = hasGasTracker ? <StatsGasPrices gasPrices={ data.gas_prices }/> : null; const gasLabel = hasGasTracker && data.gas_prices ? <StatsGasPrices gasPrices={ data.gas_prices }/> : null;
content = ( content = (
<> <>
<StatsItem <StatsItem
...@@ -71,7 +71,7 @@ const Stats = () => { ...@@ -71,7 +71,7 @@ const Stats = () => {
value={ Number(data.total_addresses).toLocaleString() } value={ Number(data.total_addresses).toLocaleString() }
_last={ itemsCount % 2 ? lastItemTouchStyle : undefined } _last={ itemsCount % 2 ? lastItemTouchStyle : undefined }
/> />
{ hasGasTracker && ( { hasGasTracker && data.gas_prices && (
<StatsItem <StatsItem
icon={ gasIcon } icon={ gasIcon }
title="Gas tracker" title="Gas tracker"
......
import { Box, Flex, Icon, Text, useColorModeValue, chakra, Tooltip } from '@chakra-ui/react'; import { Box, Flex, Icon, Text, useColorModeValue, chakra, Tooltip, LightMode } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import infoIcon from 'icons/info.svg'; import infoIcon from 'icons/info.svg';
...@@ -49,18 +49,20 @@ const StatsItem = ({ icon, title, value, className, tooltipLabel }: Props) => { ...@@ -49,18 +49,20 @@ const StatsItem = ({ icon, title, value, className, tooltipLabel }: Props) => {
<Text fontWeight={ 500 } fontSize="md" color={ useColorModeValue('black', 'white') }>{ value }</Text> <Text fontWeight={ 500 } fontSize="md" color={ useColorModeValue('black', 'white') }>{ value }</Text>
</Flex> </Flex>
{ tooltipLabel && ( { tooltipLabel && (
<Tooltip label={ tooltipLabel } hasArrow={ false } borderRadius="12px" placement="bottom-end" offset={ [ 0, 0 ] }> <LightMode>
<Box <Tooltip label={ tooltipLabel } hasArrow={ false } borderRadius="12px" placement="bottom-end" offset={ [ 0, 0 ] } bgColor="blackAlpha.900">
position="absolute" <Box
top={{ base: 'calc(50% - 12px)', lg: '10px', xl: 'calc(50% - 12px)' }} position="absolute"
right="10px"> top={{ base: 'calc(50% - 12px)', lg: '10px', xl: 'calc(50% - 12px)' }}
<Icon right="10px">
as={ infoIcon } <Icon
boxSize={ 6 } as={ infoIcon }
color={ infoColor } boxSize={ 6 }
/> color={ infoColor }
</Box> />
</Tooltip> </Box>
</Tooltip>
</LightMode>
) } ) }
</Flex> </Flex>
); );
......
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