diff --git a/client/src/Pages/StatusPage/Status/themes/shared/ThemedChartTooltip.tsx b/client/src/Pages/StatusPage/Status/themes/shared/ThemedChartTooltip.tsx new file mode 100644 index 000000000..c4a528731 --- /dev/null +++ b/client/src/Pages/StatusPage/Status/themes/shared/ThemedChartTooltip.tsx @@ -0,0 +1,28 @@ +import type { CheckSnapshot } from "@/Types/Check"; +import Stack from "@mui/material/Stack"; +import Typography from "@mui/material/Typography"; +import prettyMilliseconds from "pretty-ms"; +import { formatDateWithTz } from "@/Utils/TimeUtils"; +import { useStatusPageTheme } from "@/Pages/StatusPage/Status/themes/StatusPageThemeProvider"; + +export const ThemedChartTooltip = ({ check }: { check: CheckSnapshot }) => { + const { timezone } = useStatusPageTheme(); + return ( + + + {check.status + ? `${prettyMilliseconds(check.responseTime, { compact: true })}` + : t("pages.statusPages.monitorsList.chart.downTooltip")} + + + {formatDateWithTz(check.createdAt, "ddd, MMMM D, YYYY, HH:mm A", timezone)} + + + ); +}; diff --git a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx index 2a7d92b1e..5340f4637 100644 --- a/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx +++ b/client/src/Pages/StatusPage/Status/themes/shared/ThemedHeatmap.tsx @@ -9,6 +9,7 @@ import { formatDateWithTz } from "@/Utils/TimeUtils"; import { MAX_RECENT_CHECKS } from "@/Types/Monitor"; import { useStatusPageTheme } from "../StatusPageThemeProvider"; import prettyMilliseconds from "pretty-ms"; +import { ThemedChartTooltip } from "@/Pages/StatusPage/Status/themes/shared/ThemedChartTooltip"; const CELLS = MAX_RECENT_CHECKS; @@ -54,24 +55,7 @@ export const ThemedHeatmap = ({ checks, containerSx, cellSx }: Props) => { ); } const kind = classify(check); - const tooltipContent = ( - - - {check.status - ? `${prettyMilliseconds(check.responseTime, { compact: true })}` - : t("pages.statusPages.monitorsList.chart.downTooltip")} - - - {formatDateWithTz(check.createdAt, "ddd, MMMM D, YYYY, HH:mm A", timezone)} - - - ); + const tooltipContent = ; return ( - - {check.status - ? `${prettyMilliseconds(check.responseTime, { compact: true })}` - : t("pages.statusPages.monitorsList.chart.downTooltip")} - - - {formatDateWithTz( - check.createdAt, - "ddd, MMMM D, YYYY, HH:mm A", - timezone - )} - - - ); + const tooltipContent = ; return (