import { HeaderCreate } from "@/Components/common"; import { ColoredLabel, MonitorBasePageWithStates } from "@/Components/design-elements"; import { BulkActionsBar } from "@/Components/monitors/BulkActionsBar"; import { ControlsFilter } from "@/Components/monitors/ControlsFilter"; import { HeaderMonitorsSummary } from "@/Components/monitors/HeaderMonitorsSummary"; import { useIsAdmin } from "@/Hooks/useIsAdmin"; import type { MonitorListController } from "@/Hooks/useMonitorListController"; import { useMediaQuery, useTheme } from "@mui/material"; import { SPACING } from "@/Utils/Theme/constants"; import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; import { TextField, Button, Dialog } from "@/Components/inputs"; import type { ReactNode } from "react"; import { useTranslation } from "react-i18next"; import { Pause, Play } from "lucide-react"; interface MonitorListPageProps { headerKey: string; page: string; actionLink: string; controller: MonitorListController; bulkActions?: boolean; showTypeFilter?: boolean; summaryProps?: { showBreached?: boolean }; priorityFallback?: ReactNode; extraLoading?: boolean; extraError?: unknown; children: ReactNode; } // Base monitor list page, all monitors pages are nearly identical, but with different tables. export const MonitorListPage = ({ headerKey, page, actionLink, controller, bulkActions, showTypeFilter, summaryProps, priorityFallback, extraLoading, extraError, children, }: MonitorListPageProps) => { const { t } = useTranslation(); const theme = useTheme(); const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isAdmin = useIsAdmin(); const isLoading = controller.isLoading || Boolean(extraLoading); return ( { controller.setSearch(event.target.value); }} /> {controller.selectedTags.length > 0 && ( {t("pages.uptime.filters.activeTags")} {controller.selectedTags.map((tagId) => { const tag = controller.tags?.find((t) => t.id === tagId); if (!tag) return null; return ( ); })} )} {bulkActions && !isLoading && ( )} {children} ); };