Commit 39b27554 authored by isstuev's avatar isstuev

stats gap fix

parent 6e48647c
...@@ -30,13 +30,14 @@ const Stats = () => { ...@@ -30,13 +30,14 @@ const Stats = () => {
let content; let content;
const lastItemTouchStyle = { gridColumn: { base: 'span 2', lg: 'unset' } };
if (isLoading) { if (isLoading) {
content = Array.from(Array(itemsCount)).map((item, index) => <StatsItemSkeleton key={ index }/>); content = Array.from(Array(itemsCount)).map((item, index) => <StatsItemSkeleton key={ index } _last={ itemsCount % 2 ? lastItemTouchStyle : undefined }/>);
} }
const lastItemTouchStyle = { gridColumn: { base: 'span 2', lg: 'unset' } };
if (data) { if (data) {
const isOdd = Boolean(hasGasTracker && !data.gas_prices ? (itemsCount - 1) % 2 : itemsCount % 2);
const gasLabel = hasGasTracker && data.gas_prices ? <StatsGasPrices gasPrices={ data.gas_prices }/> : null; const gasLabel = hasGasTracker && data.gas_prices ? <StatsGasPrices gasPrices={ data.gas_prices }/> : null;
content = ( content = (
<> <>
...@@ -63,14 +64,14 @@ const Stats = () => { ...@@ -63,14 +64,14 @@ const Stats = () => {
icon={ walletIcon } icon={ walletIcon }
title="Wallet addresses" title="Wallet addresses"
value={ Number(data.total_addresses).toLocaleString() } value={ Number(data.total_addresses).toLocaleString() }
_last={ itemsCount % 2 ? lastItemTouchStyle : undefined } _last={ isOdd ? lastItemTouchStyle : undefined }
/> />
{ hasGasTracker && data.gas_prices && ( { hasGasTracker && data.gas_prices && (
<StatsItem <StatsItem
icon={ gasIcon } icon={ gasIcon }
title="Gas tracker" title="Gas tracker"
value={ `${ Number(data.gas_prices.average).toLocaleString() } Gwei` } value={ `${ Number(data.gas_prices.average).toLocaleString() } Gwei` }
_last={ itemsCount % 2 ? lastItemTouchStyle : undefined } _last={ isOdd ? lastItemTouchStyle : undefined }
tooltipLabel={ gasLabel } tooltipLabel={ gasLabel }
/> />
) } ) }
......
import { Flex, Skeleton, useColorModeValue } from '@chakra-ui/react'; import { Flex, Skeleton, useColorModeValue, chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
const StatsItemSkeleton = () => { const StatsItemSkeleton = ({ className }: {className?: string}) => {
const bgColor = useColorModeValue('blackAlpha.50', 'whiteAlpha.50'); const bgColor = useColorModeValue('blackAlpha.50', 'whiteAlpha.50');
return ( return (
...@@ -13,6 +13,7 @@ const StatsItemSkeleton = () => { ...@@ -13,6 +13,7 @@ const StatsItemSkeleton = () => {
alignItems="center" alignItems="center"
columnGap={ 3 } columnGap={ 3 }
rowGap={ 2 } rowGap={ 2 }
className={ className }
> >
<Skeleton <Skeleton
w="40px" w="40px"
...@@ -26,4 +27,4 @@ const StatsItemSkeleton = () => { ...@@ -26,4 +27,4 @@ const StatsItemSkeleton = () => {
); );
}; };
export default StatsItemSkeleton; export default chakra(StatsItemSkeleton);
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