// Components
import { Stack, Typography } from "@mui/material";
import Breadcrumbs from "../../../Components/Breadcrumbs";
import Fallback from "../../../Components/Fallback";
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
import GenericFallback from "../../../Components/GenericFallback";
// Utils
import { useTheme } from "@emotion/react";
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
import { useNavigate } from "react-router";
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
const StatusPages = () => {
// Utils
const theme = useTheme();
const isAdmin = useIsAdmin();
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
const navigate = useNavigate();
// Handlers
const handleStatusPageClick = (statusPage) => {
if (statusPage.type === "distributed") {
navigate(`/status/distributed/${statusPage.url}`);
} else if (statusPage.type === "uptime") {
navigate(`/status/uptime/${statusPage.url}`);
}
};
if (!isLoading && typeof statusPages === "undefined") {
return (
);
}
if (networkError === true) {
return (
Network error
Please check your connection
);
}
return (
{statusPages?.map((statusPage) => {
return (
handleStatusPageClick(statusPage)}
sx={{ cursor: "pointer" }}
>
Company Name: {statusPage.companyName}
Status page URL: {statusPage.url}
Type: {statusPage.type}
);
})}
);
};
export default StatusPages;