import Box from "@mui/material/Box"; import { BaseBox } from "@/Components/v2/design-elements"; import Typography from "@mui/material/Typography"; 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"; import { useTranslation } from "react-i18next"; export const ValueTypes = ["positive", "negative", "neutral"] as const; export type ValueType = (typeof ValueTypes)[number]; export const StatusLabel = ({ status, isActive, sx, }: { status: MonitorStatus; isActive?: boolean; sx?: SxProps; }) => { const { t } = useTranslation(); const theme = useTheme(); const palette = getStatusPalette(status); const determineStatus = ( isActive: boolean | undefined, status: MonitorStatus ): string => { if (isActive === false) { return t("pages.common.monitors.status.paused"); } if (status === true) { return t("pages.common.monitors.status.up"); } if (status === false) { return t("pages.common.monitors.status.down"); } return t("pages.common.monitors.status.initializing"); }; return ( {determineStatus(isActive, status)} ); }; export const ValueLabel = ({ value, text }: { value: ValueType; text: string }) => { const theme = useTheme(); const palette = getValuePalette(value); const transformedText = text.charAt(0).toUpperCase() + text.slice(1).toLowerCase(); return ( {transformedText} ); };