Files
Checkmate/src/Pages/StatusPage/StatusPages/index.jsx
T

67 lines
1.9 KiB
React
Raw Normal View History

2025-02-10 13:45:01 -08:00
// Components
import { Stack, Typography } from "@mui/material";
import Breadcrumbs from "../../../Components/Breadcrumbs";
import Fallback from "../../../Components/Fallback";
2025-02-10 14:02:52 -08:00
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
2025-02-10 13:45:01 -08:00
import GenericFallback from "../../../Components/GenericFallback";
2025-02-10 16:17:35 -08:00
import StatusPagesTable from "./Components/StatusPagesTable";
2025-02-11 07:18:09 -08:00
import SkeletonLayout from "../../../Components/Skeletons/FullPage";
2025-02-10 13:45:01 -08:00
// Utils
import { useTheme } from "@emotion/react";
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
2025-02-10 14:02:52 -08:00
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
2025-02-10 13:45:01 -08:00
const StatusPages = () => {
// Utils
const theme = useTheme();
const isAdmin = useIsAdmin();
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
2025-02-11 07:18:09 -08:00
if (isLoading) {
return <SkeletonLayout />;
2025-02-10 13:45:01 -08:00
}
if (networkError === true) {
return (
<GenericFallback>
<Typography
variant="h1"
marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary}
>
Network error
</Typography>
<Typography>Please check your connection</Typography>
</GenericFallback>
);
}
2025-02-11 07:18:09 -08:00
if (!isLoading && typeof statusPages !== "undefined" && statusPages.length === 0) {
return (
<Fallback
title="status page"
checks={[
"Monitor and display the health of your services in real time",
"Track multiple services and share their status",
"Keep users informed about outages and performance",
]}
link="/status/uptime/create"
isAdmin={isAdmin}
/>
);
}
2025-02-10 13:45:01 -08:00
return (
<Stack gap={theme.spacing(10)}>
<Breadcrumbs list={BREADCRUMBS} />
2025-02-10 14:02:52 -08:00
<MonitorCreateHeader
label="Create status page"
isAdmin={isAdmin}
path="/status/uptime/create"
/>
2025-02-10 16:17:35 -08:00
<StatusPagesTable data={statusPages} />
2025-02-10 13:45:01 -08:00
</Stack>
);
};
export default StatusPages;