Added placeholder checks

This commit is contained in:
Daniel Cojocea committed 2024-08-23 14:25:55 -04:00
1 parent 8d75c52a72
commit 931d15c451
1 file changed
+28 -2
@@ -6,6 +6,16 @@ import "./index.css";
const BarChart = ({ checks = [] }) => { const BarChart = ({ checks = [] }) => {
const theme = useTheme(); const theme = useTheme();
// set responseTime to average if there's only one check
if (checks.length === 1) {
checks[0] = { ...checks[0], responseTime: 50 };
}
if (checks.length !== 25) {
const placeholders = Array(25 - checks.length).fill("placeholder");
checks = [...checks, ...placeholders];
}
return ( return (
<Stack <Stack
direction="row" direction="row"
@@ -18,7 +28,19 @@ const BarChart = ({ checks = [] }) => {
cursor: "default", cursor: "default",
}} }}
> >
{checks.map((check) => ( {checks.map((check, index) =>
check === "placeholder" ? (
<Box
key={`${check}-${index}`}
position="relative"
width="9px"
height="100%"
backgroundColor={theme.palette.otherColors.fillGray}
sx={{
borderRadius: "3px",
}}
/>
) : (
<Tooltip <Tooltip
title={ title={
<> <>
@@ -83,6 +105,9 @@ const BarChart = ({ checks = [] }) => {
} }
sx={{ sx={{
borderRadius: "3px", borderRadius: "3px",
"&:hover > .MuiBox-root": {
filter: "brightness(0.8)",
},
}} }}
> >
<Box <Box
@@ -101,7 +126,8 @@ const BarChart = ({ checks = [] }) => {
/> />
</Box> </Box>
</Tooltip> </Tooltip>
))} )
)}
</Stack> </Stack>
); );
}; };