Refactor main screen metrics, fix iPad charts overlay (#177)

* Refactor main screen metrics, fix iPad charts overlay

* Improve metrics styles for tablets
pull/179/head
Artem 3 years ago committed by GitHub
parent 7a0eb3c069
commit 3439d27ca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      package.json
  2. 131
      src/components/metrics/index.tsx

@ -74,6 +74,7 @@
"web-vitals": "^1.0.1" "web-vitals": "^1.0.1"
}, },
"resolutions": { "resolutions": {
"@types/react": "17.0.30" "@types/react": "17.0.30",
"react-error-overlay": "6.0.9"
} }
} }

@ -70,9 +70,9 @@ export const Metrics = (params: {
latency: number; latency: number;
latencyPerBlock: number[]; latencyPerBlock: number[];
}) => { }) => {
const isLessLaptop = useMediaQuery({ maxDeviceWidth: "852px" }); const isLessLaptop = useMediaQuery({ query: '(max-width: 852px)' });
const isLessTablet = useMediaQuery({ maxDeviceWidth: breakpoints.tablet }); const isLessTablet = useMediaQuery({ query: `(max-width: ${breakpoints.tablet})` });
const isLessMobileM = useMediaQuery({ maxDeviceWidth: "468px" }); const isLessMobileM = useMediaQuery({ query: '(max-width: 468px)' });
return ( return (
<BasePage <BasePage
@ -80,78 +80,71 @@ export const Metrics = (params: {
justify="between" justify="between"
wrap={isLessLaptop} wrap={isLessLaptop}
margin={{ bottom: "medium" }} margin={{ bottom: "medium" }}
style={{ width: '100%' }}
> >
<Box <Box
justify="between" direction={'row'}
pad={{ right: isLessMobileM ? "0" : "medium" }} style={{ flexWrap: 'wrap', flexBasis: isLessLaptop ? '100%' : '50%'}}
border={{
size: isLessMobileM ? "0" : "xsmall",
side: "right",
color: "border",
}}
style={{
height: isLessMobileM ? "auto" : "140px",
flex: isLessLaptop ? "1 1 40%" : "1 1 100%",
}}
gap={isLessMobileM ? "small" : "0"}
> >
<ONEPrice /> <Box
{!isLessMobileM && <Line horizontal />} justify="between"
<TransactionsCount /> pad={{ right: isLessMobileM ? "0" : "medium" }}
</Box> border={{
<Box size: isLessMobileM ? "0" : "xsmall",
justify="between" side: "right",
pad={{ left: "medium", right: isLessLaptop ? "0" : "medium" }} color: "border",
border={{ }}
size: isLessLaptop ? "0" : "xsmall", style={{
side: "right", height: isLessMobileM ? "auto" : "140px",
color: "border", flex: 1
}} }}
style={{ gap={isLessMobileM ? "small" : "0"}
height: isLessMobileM ? "auto" : "140px", >
flex: isLessLaptop ? "1 1 50%" : "1 1 100%", <ONEPrice />
}} {!isLessMobileM && <Line horizontal />}
> <TransactionsCount />
<ShardCount /> </Box>
{!isLessMobileM && <Line horizontal />} <Box
<BlockLatency justify="between"
latency={params.latency} pad={{ left: "medium", right: isLessLaptop ? "0" : "medium" }}
latencyPerBlock={params.latencyPerBlock} border={{
/> size: isLessLaptop ? "0" : "xsmall",
</Box> side: "right",
{isLessLaptop && ( color: "border",
<Line }}
horizontal style={{
style={{ marginTop: isLessTablet ? "16px" : "24px" }} height: isLessMobileM ? "auto" : "140px",
/> flex: 1
)} }}
<Box >
justify="between" <ShardCount />
pad={{ {!isLessMobileM && <Line horizontal />}
left: isLessLaptop ? "0" : "medium", <BlockLatency
}} latency={params.latency}
margin={{ top: isLessLaptop ? "medium" : "0" }} latencyPerBlock={params.latencyPerBlock}
style={{ height: "140px", flex: "1 1 100%" }} />
> </Box>
<BlockTransactionsHistory /> {isLessLaptop && (
<Line
horizontal
style={{ marginTop: isLessTablet ? "16px" : "24px" }}
/>
)}
</Box> </Box>
{isLessLaptop && (
<Line
horizontal
style={{ marginTop: isLessTablet ? "16px" : "24px" }}
/>
)}
<Box <Box
justify="between" direction={'row'}
pad={{ justify={'between'}
left: isLessLaptop ? "0" : "medium", wrap={isLessLaptop}
}} pad={{ left: 'medium', top: isLessLaptop ? 'medium' : 'none' }}
margin={{ top: isLessLaptop ? "medium" : "0" }} gap={'large'}
style={{ height: "140px", flex: "1 1 100%" }} style={{ flexWrap: 'wrap', flexBasis: isLessLaptop ? '100%' : '50%' }}
> >
<WalletsHistory /> <Box style={{flex: isLessMobileM ? 'unset' : 1}}>
<BlockTransactionsHistory />
</Box>
<Box style={{flex: isLessMobileM ? 'unset' : 1}}>
<WalletsHistory />
</Box>
</Box> </Box>
</BasePage> </BasePage>
); );

Loading…
Cancel
Save