Commit 3b389328 authored by tom's avatar tom

stats and chart updates

parent 7a0ef608
...@@ -110,7 +110,7 @@ const LatestBlocks = () => { ...@@ -110,7 +110,7 @@ const LatestBlocks = () => {
return ( return (
<> <>
<Heading as="h4" size="sm" mb={{ base: 4, lg: 7 }}>Latest Blocks</Heading> <Heading as="h4" size="sm" mb={ 4 }>Latest Blocks</Heading>
{ content } { content }
</> </>
); );
......
...@@ -79,10 +79,10 @@ const Stats = () => { ...@@ -79,10 +79,10 @@ const Stats = () => {
return ( return (
<Grid <Grid
gridTemplateColumns={{ lg: `repeat(${ itemsCount }, 1fr)`, base: 'none' }} gridTemplateColumns={{ lg: `repeat(${ itemsCount }, 1fr)`, base: '1fr 1fr' }}
gridTemplateRows={{ lg: 'none', base: `repeat(${ itemsCount }, 1fr)` }} gridTemplateRows={{ lg: 'none', base: undefined }}
gridGap="10px" gridGap="10px"
marginTop="32px" marginTop="24px"
> >
{ content } { content }
</Grid> </Grid>
......
import { Flex, Icon, Center, Text, LightMode } from '@chakra-ui/react'; import { Flex, Icon, Text, useColorModeValue } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
type Props = { type Props = {
...@@ -9,30 +9,21 @@ type Props = { ...@@ -9,30 +9,21 @@ type Props = {
const StatsItem = ({ icon, title, value }: Props) => { const StatsItem = ({ icon, title, value }: Props) => {
return ( return (
<LightMode>
<Flex <Flex
backgroundColor="blue.50" backgroundColor={ useColorModeValue('blue.50', 'blue.800') }
padding={ 5 } padding={ 3 }
borderRadius="16px" borderRadius="md"
flexDirection={{ base: 'row', lg: 'column', xl: 'row' }} flexDirection={{ base: 'row', lg: 'column', xl: 'row' }}
alignItems="center" alignItems="center"
columnGap={ 3 }
rowGap={ 2 }
> >
<Center <Icon as={ icon } boxSize={ 7 }/>
backgroundColor="green.100"
borderRadius="12px"
w={ 10 }
h={ 10 }
mr={{ base: 4, lg: 0, xl: 4 }}
mb={{ base: 0, lg: 2, xl: 0 }}
>
<Icon as={ icon } boxSize={ 7 } color="black"/>
</Center>
<Flex flexDirection="column" alignItems={{ base: 'start', lg: 'center', xl: 'start' }}> <Flex flexDirection="column" alignItems={{ base: 'start', lg: 'center', xl: 'start' }}>
<Text variant="secondary" fontSize="xs" lineHeight="16px">{ title }</Text> <Text variant="secondary" fontSize="xs" lineHeight="16px">{ title }</Text>
<Text fontWeight={ 500 } fontSize="md">{ value }</Text> <Text fontWeight={ 500 } fontSize="md">{ value }</Text>
</Flex> </Flex>
</Flex> </Flex>
</LightMode>
); );
}; };
......
...@@ -7,16 +7,16 @@ const StatsItemSkeleton = () => { ...@@ -7,16 +7,16 @@ const StatsItemSkeleton = () => {
return ( return (
<Flex <Flex
backgroundColor={ bgColor } backgroundColor={ bgColor }
padding={ 5 } padding={ 3 }
borderRadius="16px" borderRadius="md"
flexDirection={{ base: 'row', lg: 'column', xl: 'row' }} flexDirection={{ base: 'row', lg: 'column', xl: 'row' }}
alignItems="center" alignItems="center"
columnGap={ 3 }
rowGap={ 2 }
> >
<Skeleton <Skeleton
w="40px" w="40px"
h="40px" h="40px"
mr={{ base: 4, lg: 0, xl: 4 }}
mb={{ base: 0, lg: 2, xl: 0 }}
/> />
<Flex flexDirection="column" alignItems={{ base: 'start', lg: 'center', xl: 'start' }}> <Flex flexDirection="column" alignItems={{ base: 'start', lg: 'center', xl: 'start' }}>
<Skeleton w="69px" h="10px" mt="4px" mb="8px"/> <Skeleton w="69px" h="10px" mt="4px" mb="8px"/>
......
...@@ -18,9 +18,12 @@ interface Props { ...@@ -18,9 +18,12 @@ interface Props {
} }
const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats }: Props) => { const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats }: Props) => {
const bgColor = useColorModeValue('white', 'black');
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const activeBgColorDesktop = useColorModeValue('white', 'gray.900');
const activeBgColorMobile = useColorModeValue('white', 'black');
const activeBgColor = isMobile ? activeBgColorMobile : activeBgColorDesktop;
const handleClick = React.useCallback(() => { const handleClick = React.useCallback(() => {
onClick(id); onClick(id);
}, [ id, onClick ]); }, [ id, onClick ]);
...@@ -58,11 +61,11 @@ const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats ...@@ -58,11 +61,11 @@ const ChainIndicatorItem = ({ id, title, value, icon, isSelected, onClick, stats
borderRadius="md" borderRadius="md"
cursor="pointer" cursor="pointer"
onClick={ handleClick } onClick={ handleClick }
bgColor={ isSelected ? bgColor : 'inherit' } bgColor={ isSelected ? activeBgColor : 'inherit' }
boxShadow={ isSelected ? 'lg' : 'none' } boxShadow={ isSelected ? 'lg' : 'none' }
zIndex={ isSelected ? 1 : 'initial' } zIndex={ isSelected ? 1 : 'initial' }
_hover={{ _hover={{
bgColor, activeBgColor,
zIndex: 1, zIndex: 1,
}} }}
> >
......
...@@ -40,8 +40,10 @@ const ChainIndicators = () => { ...@@ -40,8 +40,10 @@ const ChainIndicators = () => {
() => fetch('/node-api/stats'), () => fetch('/node-api/stats'),
); );
const bgColor = useColorModeValue('white', 'black'); const bgColorDesktop = useColorModeValue('white', 'gray.900');
const listBgColor = useColorModeValue('gray.50', 'gray.900'); const bgColorMobile = useColorModeValue('white', 'black');
const listBgColorDesktop = useColorModeValue('gray.50', 'black');
const listBgColorMobile = useColorModeValue('gray.50', 'gray.900');
if (indicators.length === 0) { if (indicators.length === 0) {
return null; return null;
...@@ -68,7 +70,7 @@ const ChainIndicators = () => { ...@@ -68,7 +70,7 @@ const ChainIndicators = () => {
p={{ base: 0, lg: 8 }} p={{ base: 0, lg: 8 }}
borderRadius={{ base: 'none', lg: 'lg' }} borderRadius={{ base: 'none', lg: 'lg' }}
boxShadow={{ base: 'none', lg: 'xl' }} boxShadow={{ base: 'none', lg: 'xl' }}
bgColor={ bgColor } bgColor={{ base: bgColorMobile, lg: bgColorDesktop }}
columnGap={ 12 } columnGap={ 12 }
rowGap={ 0 } rowGap={ 0 }
flexDir={{ base: 'column', lg: 'row' }} flexDir={{ base: 'column', lg: 'row' }}
...@@ -97,7 +99,7 @@ const ChainIndicators = () => { ...@@ -97,7 +99,7 @@ const ChainIndicators = () => {
as="ul" as="ul"
p={ 3 } p={ 3 }
borderRadius="lg" borderRadius="lg"
bgColor={ listBgColor } bgColor={{ base: listBgColorMobile, lg: listBgColorDesktop }}
rowGap={ 3 } rowGap={ 3 }
order={{ base: 1, lg: 2 }} order={{ base: 1, lg: 2 }}
> >
......
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