incidents repo and data reversal

This commit is contained in:
Alex Holliday committed 2026-01-06 20:49:06 +00:00
1 parent 605b4713af
commit 51081a6a0e
32 files changed
+537 -241

No files matched your search

@@ -24,18 +24,17 @@ export const HeatmapResponseTime = ({
}
if (!checks || checks.length === 0) return null;
let data = Array<any>();
if (!checks || checks.length === 0) {
checks = [];
}
if (checks.length !== 25) {
const placeholders = Array(25 - checks.length).fill({
status: "placeholder",
const latestChecks = checks.slice(-25).reverse();
let data: Array<ICheck | { status: "placeholder" }>;
if (latestChecks.length !== 25) {
const placeholders = Array(25 - latestChecks.length).fill({
status: "placeholder" as const,
});
data = [...checks, ...placeholders];
data = [...latestChecks, ...placeholders];
} else {
data = checks;
data = latestChecks;
}
return (
<Box sx={{ width: "100%" }}>
@@ -3,15 +3,17 @@ import Tooltip from "@mui/material/Tooltip";
import Typography from "@mui/material/Typography";
import { formatDateWithTz } from "@/utils/TimeUtils";
import { useAppSelector } from "@/hooks/AppHooks";
import type { LatestCheck } from "@/types/check";
import type { Check } from "@/types/check";
import { useTheme } from "@mui/material/styles";
type HeatmapCheck = Check | { status: "placeholder" };
export const HeatmapResponseTimeTooltip = ({
children,
check,
}: {
children: React.ReactElement;
check: LatestCheck;
check: HeatmapCheck;
}) => {
const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
const theme = useTheme();
@@ -47,7 +49,7 @@ export const HeatmapResponseTimeTooltip = ({
>
<Typography>
{formatDateWithTz(
check?.checkedAt,
check?.createdAt,
"ddd, MMMM D, YYYY, HH:mm A",
uiTimezone
)}
@@ -22,7 +22,10 @@ export const HistogramResponseTime = ({
if (!Array.isArray(checks) || checks.length === 0) return null;
const normalized = normalizeResponseTimes(checks.slice(-25), "responseTime");
const normalized = normalizeResponseTimes(
checks.slice(-25).reverse(),
"responseTime"
);
let data = Array<any>();
if (!normalized || normalized.length === 0) {
@@ -36,7 +39,6 @@ export const HistogramResponseTime = ({
} else {
data = normalized;
}
const chartHeight = typeof height === "number" ? `${height}px` : height;
const gridGap = gap ?? theme.spacing(0.5);