import { BasePage, BaseFallback } from "@/Components/design-elements"; import { StatusBar } from "@/Pages/StatusPage/Status/Components/StatusBar"; import { MonitorsList } from "@/Pages/StatusPage/Status/Components/MonitorsList"; import Typography from "@mui/material/Typography"; import { Link } from "react-router-dom"; import Stack from "@mui/material/Stack"; import Box from "@mui/material/Box"; import { useMediaQuery, useTheme } from "@mui/material"; import { useTranslation } from "react-i18next"; import { useIsAdmin } from "@/Hooks/useIsAdmin"; import { useLocation, useParams } from "react-router-dom"; import { useGet } from "@/Hooks/UseApi"; import type { StatusPageResponse } from "@/Types/StatusPage"; import { HeaderStatusPageControls } from "./Components/HeaderStatusPageControls"; const StatusPageView = () => { const theme = useTheme(); const { t } = useTranslation(); const { url } = useParams(); const isAdmin = useIsAdmin(); const location = useLocation(); const isSmall = useMediaQuery(theme.breakpoints.down("md")); const isPublic = location.pathname.startsWith("/status/public"); const apiUrl = url ? `/status-page/${url}?type=uptime&type=infrastructure` : null; const { data, isLoading, error } = useGet(apiUrl); const statusPage = data?.statusPage; const monitors = data?.monitors ?? []; const infrastructureMonitors = data?.infrastructureMonitors ?? []; if (!statusPage) return null; if (monitors?.length === 0 && infrastructureMonitors?.length === 0) { return ( {t("pages.statusPages.details.empty.title")} {isAdmin && ( {t("pages.statusPages.details.empty.addMonitor")} )} ); } let sx: React.CSSProperties = {}; if (isPublic) { sx.paddingTop = theme.spacing(20); sx.paddingLeft = isSmall ? "5vw" : "20vw"; sx.paddingRight = isSmall ? "5vw" : "20vw"; } const logoSrc = statusPage.logo?.data ? `data:${statusPage.logo.contentType};base64,${statusPage.logo.data}` : null; return ( {logoSrc && ( )} ); }; export default StatusPageView;