2026-02-02 20:39:16 +00:00
|
|
|
import { BasePage } from "@/Components/v2/design-elements";
|
|
|
|
|
import { StatusBar } from "@/Pages/StatusPage/Status/Components/StatusBar";
|
2026-02-02 20:42:27 +00:00
|
|
|
import { MonitorsList } from "@/Pages/StatusPage/Status/Components/MonitorsList";
|
2026-02-02 20:39:16 +00:00
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
|
|
2026-02-02 21:51:06 +00:00
|
|
|
import { useTheme } from "@mui/material";
|
2026-02-02 20:39:16 +00:00
|
|
|
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 = () => {
|
2026-02-02 21:51:06 +00:00
|
|
|
const theme = useTheme();
|
2026-02-02 20:39:16 +00:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const { url } = useParams();
|
|
|
|
|
const isAdmin = useIsAdmin();
|
|
|
|
|
const location = useLocation();
|
|
|
|
|
const isPublic = location.pathname.startsWith("/status/uptime/public");
|
|
|
|
|
|
|
|
|
|
const apiUrl = url ? `/status-page/${url}?type=uptime` : null;
|
|
|
|
|
|
|
|
|
|
const { data, isLoading, error } = useGet<StatusPageResponse>(apiUrl);
|
|
|
|
|
|
|
|
|
|
const statusPage = data?.statusPage;
|
|
|
|
|
const monitors = data?.monitors ?? [];
|
|
|
|
|
|
2026-02-02 21:51:06 +00:00
|
|
|
if (!statusPage) return null;
|
2026-02-02 20:39:16 +00:00
|
|
|
|
2026-02-02 21:51:06 +00:00
|
|
|
let sx: React.CSSProperties = {};
|
|
|
|
|
if (isPublic) {
|
|
|
|
|
sx.paddingTop = theme.spacing(20);
|
|
|
|
|
sx.paddingLeft = "20vw";
|
|
|
|
|
sx.paddingRight = "20vw";
|
2026-02-02 20:39:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<BasePage
|
|
|
|
|
loading={isLoading}
|
|
|
|
|
error={error}
|
2026-02-02 21:51:06 +00:00
|
|
|
sx={sx}
|
|
|
|
|
breadcrumbOverride={isPublic ? [] : undefined}
|
2026-02-02 20:39:16 +00:00
|
|
|
>
|
|
|
|
|
<HeaderStatusPageControls
|
|
|
|
|
isAdmin={isAdmin}
|
|
|
|
|
statusPage={statusPage}
|
|
|
|
|
isPublic={isPublic}
|
|
|
|
|
/>
|
|
|
|
|
<Typography variant="h2">{t("statusPageStatusServiceStatus")}</Typography>
|
|
|
|
|
<StatusBar monitors={monitors} />
|
2026-02-02 20:42:27 +00:00
|
|
|
<MonitorsList
|
2026-02-02 21:51:06 +00:00
|
|
|
statusPage={statusPage}
|
2026-02-02 20:42:27 +00:00
|
|
|
monitors={monitors}
|
|
|
|
|
/>
|
2026-02-02 20:39:16 +00:00
|
|
|
</BasePage>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StatusPageView;
|