diff --git a/client/src/components/common/HeatmapResponseTime.tsx b/client/src/components/common/HeatmapResponseTime.tsx index ac44e630d..17d45e775 100644 --- a/client/src/components/common/HeatmapResponseTime.tsx +++ b/client/src/components/common/HeatmapResponseTime.tsx @@ -2,13 +2,19 @@ import Box from "@mui/material/Box"; import { useTheme } from "@mui/material/styles"; import type { ICheck } from "@/types/check"; import { getResponseColor } from "@/utils/DataUtils"; -import { HistogramResponseTimeTooltip } from "@/components/monitors/HistogramResponseTimeTooltip"; - +import { HeatmapResponseTimeTooltip } from "./HeatmapResponseTimeTooltip"; +import type { SxProps } from "@mui/material/styles"; interface HeatmapResponseTimeProps { checks: ICheck[]; + availabilityCellSx?: SxProps; + responseCellSx?: SxProps; } -export const HeatmapResponseTime = ({ checks }: HeatmapResponseTimeProps) => { +export const HeatmapResponseTime = ({ + checks, + availabilityCellSx, + responseCellSx, +}: HeatmapResponseTimeProps) => { const theme = useTheme(); if (!checks || checks.length === 0) return null; @@ -53,35 +59,41 @@ export const HeatmapResponseTime = ({ checks }: HeatmapResponseTimeProps) => { }); return ( - + - + > + + + - + ); })} diff --git a/client/src/components/monitors/HistogramResponseTimeTooltip.tsx b/client/src/components/common/HeatmapResponseTimeTooltip.tsx similarity index 78% rename from client/src/components/monitors/HistogramResponseTimeTooltip.tsx rename to client/src/components/common/HeatmapResponseTimeTooltip.tsx index b18841926..6df36813a 100644 --- a/client/src/components/monitors/HistogramResponseTimeTooltip.tsx +++ b/client/src/components/common/HeatmapResponseTimeTooltip.tsx @@ -6,13 +6,18 @@ import { useAppSelector } from "@/hooks/AppHooks"; import type { LatestCheck } from "@/types/check"; import { useTheme } from "@mui/material/styles"; -export const HistogramResponseTimeTooltip: React.FC<{ +export const HeatmapResponseTimeTooltip: React.FC<{ children: React.ReactElement; check: LatestCheck; }> = ({ children, check }) => { const uiTimezone = useAppSelector((state: any) => state.ui.timezone); const theme = useTheme(); + const getColor = (status: string) => { + if (status === "up") return theme.palette.success.lowContrast; + if (status === "down") return theme.palette.error.lowContrast; + }; + if (check.status === "placeholder") { return children; } @@ -47,8 +52,12 @@ export const HistogramResponseTimeTooltip: React.FC<{ {check?.responseTime && ( Response Time: {check.responseTime} ms )} - - Status: {check?.status} + + + Status:{" "} + + {check?.status} + } diff --git a/client/src/components/design-elements/StatusLabel.tsx b/client/src/components/design-elements/StatusLabel.tsx index a22d8bb4c..7452c49f9 100644 --- a/client/src/components/design-elements/StatusLabel.tsx +++ b/client/src/components/design-elements/StatusLabel.tsx @@ -1,6 +1,7 @@ import Box from "@mui/material/Box"; import { BaseBox } from "@/components/design-elements"; import type { MonitorStatus } from "@/types/monitor"; +import type { SxProps } from "@mui/material/styles"; import { getStatusPalette, getValuePalette } from "@/utils/MonitorUtils"; import { useTheme } from "@mui/material/styles"; @@ -8,7 +9,13 @@ import { useTheme } from "@mui/material/styles"; export const ValueTypes = ["positive", "negative", "neutral"] as const; export type ValueType = (typeof ValueTypes)[number]; -export const StatusLabel = ({ status }: { status: MonitorStatus }) => { +export const StatusLabel = ({ + status, + sx, +}: { + status: MonitorStatus; + sx?: SxProps; +}) => { const theme = useTheme(); const palette = getStatusPalette(status); const transformedText = @@ -27,6 +34,7 @@ export const StatusLabel = ({ status }: { status: MonitorStatus }) => { theme.palette.mode === "dark" ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.08)", + ...sx, }} > { + const theme = useTheme(); + return ( @@ -17,10 +20,24 @@ export const StatusPageRow = ({ monitor }: { monitor: IMonitor }) => { alignItems={"center"} justifyContent={"flex-end"} > - + - - + + );