Files
Checkmate/client/src/components/status-pages/StatusPageRow.tsx
T

57 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-11-13 13:47:26 -08:00
import Grid from "@mui/material/Grid";
import Typography from "@mui/material/Typography";
2025-11-25 19:03:48 +00:00
import { HeatmapResponseTime } from "../common/HeatmapResponseTime";
2025-11-25 23:37:56 +00:00
import { HistogramResponseTime } from "../common/HistogramResponseTime";
2025-11-13 13:47:26 -08:00
import { StatusLabel } from "@/components/design-elements";
2025-11-25 23:37:56 +00:00
import { useTheme } from "@mui/material/styles";
import { useAppSelector } from "@/hooks/AppHooks";
2025-11-13 13:47:26 -08:00
import type { IMonitor } from "@/types/monitor";
export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => {
2025-11-25 19:56:26 +00:00
const theme = useTheme();
2025-11-25 23:37:56 +00:00
const type = useAppSelector((state) => state?.ui?.chartType || "heatmap");
2025-11-25 19:56:26 +00:00
2025-11-13 13:47:26 -08:00
return (
<Grid container>
2025-11-25 19:03:48 +00:00
<Grid size={6} display={"flex"} alignItems={"center"}>
2025-11-13 13:47:26 -08:00
<Typography>{monitor?.name}</Typography>
</Grid>
<Grid
2025-11-25 19:03:48 +00:00
size={6}
2025-11-13 13:47:26 -08:00
display={"flex"}
alignItems={"center"}
2025-11-25 19:03:48 +00:00
justifyContent={"flex-end"}
2025-11-13 13:47:26 -08:00
>
2025-11-25 19:56:26 +00:00
<StatusLabel status={monitor?.status} sx={{ py: 1 }} />
2025-11-13 13:47:26 -08:00
</Grid>
2025-11-25 19:56:26 +00:00
<Grid size={12} marginTop={theme.spacing(2)}>
2025-11-25 23:37:56 +00:00
{type === "heatmap" && (
<HeatmapResponseTime
gap={{ xs: theme.spacing(0.5), md: theme.spacing(2) }}
checks={monitor?.latestChecks}
availabilityCellSx={{
borderRadius: {
xs: theme.spacing(0.5),
md: theme.shape.borderRadius,
},
}}
responseCellSx={{
borderRadius: {
xs: theme.spacing(0.5),
md: theme.shape.borderRadius,
},
}}
/>
)}
{type === "histogram" && (
<HistogramResponseTime
checks={monitor?.latestChecks}
height={{ xs: 50, md: 100 }}
gap={{ xs: 0.5, md: theme.spacing(4) }}
/>
)}
2025-11-25 19:03:48 +00:00
</Grid>
2025-11-13 13:47:26 -08:00
</Grid>
);
};