import Stack from "@mui/material/Stack"; import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; import { ToggleButtonGroup, ToggleButton } from "@/Components/inputs"; import { useTheme } from "@mui/material/styles"; import CircularProgress from "@mui/material/CircularProgress"; import { useTranslation } from "react-i18next"; import { useMediaQuery } from "@mui/material"; interface MonitorTimeFrameHeaderProps { isLoading?: boolean; hasDateRange?: boolean; dateRange: string; setDateRange: (dateRange: string) => void; } export const HeaderTimeRange = ({ isLoading = false, hasDateRange = true, dateRange, setDateRange, }: MonitorTimeFrameHeaderProps) => { const theme = useTheme(); const { t } = useTranslation(); const isSmallScreen = useMediaQuery(theme.breakpoints.down("md")); const handleChange = ( _event: React.MouseEvent, newValue: string | null ) => { if (newValue !== null) { setDateRange(newValue); } }; let timeFramePicker = null; if (hasDateRange) { timeFramePicker = ( {t("components.headerTimeRange.labels.recent")} {t("components.headerTimeRange.labels.day")} {t("components.headerTimeRange.labels.week")} {t("components.headerTimeRange.labels.month")} ); } return ( {isLoading && } {t(`components.headerTimeRange.description.${dateRange}`)} {timeFramePicker} ); };