Add skeleton
This commit is contained in:
1 parent
f6f2ae5b3a
commit
af0f940c22
1 file changed
+18
-24
@@ -5,11 +5,11 @@ import Fallback from "../../../Components/Fallback";
|
|||||||
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
import GenericFallback from "../../../Components/GenericFallback";
|
||||||
import StatusPagesTable from "./Components/StatusPagesTable";
|
import StatusPagesTable from "./Components/StatusPagesTable";
|
||||||
|
import SkeletonLayout from "../../../Components/Skeletons/FullPage";
|
||||||
// Utils
|
// Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
|
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
|
||||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
import { useNavigate } from "react-router";
|
|
||||||
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
|
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
|
||||||
|
|
||||||
const StatusPages = () => {
|
const StatusPages = () => {
|
||||||
@@ -17,30 +17,9 @@ const StatusPages = () => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isAdmin = useIsAdmin();
|
const isAdmin = useIsAdmin();
|
||||||
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
|
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
// Handlers
|
if (isLoading) {
|
||||||
const handleStatusPageClick = (statusPage) => {
|
return <SkeletonLayout />;
|
||||||
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 (
|
|
||||||
<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}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (networkError === true) {
|
if (networkError === true) {
|
||||||
@@ -57,6 +36,21 @@ const StatusPages = () => {
|
|||||||
</GenericFallback>
|
</GenericFallback>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<Stack gap={theme.spacing(10)}>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
|
|||||||
Reference in new issue
Block a user