moved PublicStatus directory to Status

This commit is contained in:
Alex Holliday committed 2025-02-04 14:06:37 -08:00
1 parent 6cedf992a7
commit 51e828c07e
4 files changed
+55 -1

No files matched your search

@@ -0,0 +1,14 @@
import { Stack, Skeleton } from "@mui/material";
const SkeletonLayout = () => {
return (
<Stack>
<Skeleton
variant="rectangular"
height={"90vh"}
/>
</Stack>
);
};
export default SkeletonLayout;
@@ -8,6 +8,8 @@ import Host from "../../Uptime/Monitors/Components/Host";
import { StatusLabel } from "../../../Components/Label";
import SettingsIcon from "../../../assets/icons/settings-bold.svg?react";
import Image from "../../../Components/Image";
import SkeletonLayout from "./Components/Skeleton";
// Utils
import { useState, useEffect } from "react";
import { useStatusPageFetch } from "./Hooks/useStatusPageFetch";
@@ -17,6 +19,7 @@ import useUtils from "../../Uptime/Monitors/Hooks/useUtils";
import { useLocation } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { useStatusPageDelete } from "./Hooks/useStatusPageDelete";
const PublicStatus = () => {
// Local state
const [status, setStatus] = useState(undefined);
@@ -93,7 +96,9 @@ const PublicStatus = () => {
setStatus(monitorsStatus);
}, [monitors, theme]);
//Handlers
if (isLoading) {
return <SkeletonLayout />;
}
if (networkError === true) {
return (
@@ -110,6 +115,23 @@ const PublicStatus = () => {
);
}
if (!isLoading && typeof status === "undefined" && currentPath === "/status/public") {
return (
<Stack sx={sx}>
<GenericFallback>
<Typography
variant="h1"
marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary}
>
A public status page is not set up.
</Typography>
<Typography>Please contact to your administrator</Typography>
</GenericFallback>
</Stack>
);
}
if (!isLoading && typeof statusPage === "undefined") {
return (
<Fallback
@@ -124,6 +146,23 @@ const PublicStatus = () => {
);
}
if (!isLoading && statusPage.isPublic === false) {
return (
<Stack sx={sx}>
<GenericFallback>
<Typography
variant="h1"
marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary}
>
This status page is not public.
</Typography>
<Typography>Please contact to your administrator</Typography>
</GenericFallback>
</Stack>
);
}
return (
<Stack
gap={theme.spacing(10)}
@@ -163,6 +202,7 @@ const PublicStatus = () => {
variant="contained"
color="error"
onClick={deleteStatusPage}
loading={isDeleting}
>
Delete
</Button>