diff --git a/Client/src/Pages/StatusPage/Status/Hooks/useStatusPageDelete.jsx b/Client/src/Pages/StatusPage/Status/Hooks/useStatusPageDelete.jsx index 6f8368f37..00b1401a3 100644 --- a/Client/src/Pages/StatusPage/Status/Hooks/useStatusPageDelete.jsx +++ b/Client/src/Pages/StatusPage/Status/Hooks/useStatusPageDelete.jsx @@ -2,11 +2,9 @@ import { useSelector } from "react-redux"; import { useState } from "react"; import { networkService } from "../../../../main"; import { createToast } from "../../../../Utils/toastUtils"; -import { useNavigate } from "react-router-dom"; const useStatusPageDelete = (fetchStatusPage, url) => { const [isLoading, setIsLoading] = useState(false); - const navigate = useNavigate(); const { authToken } = useSelector((state) => state.auth); const deleteStatusPage = async () => { try { diff --git a/Client/src/Pages/StatusPage/Status/index.jsx b/Client/src/Pages/StatusPage/Status/index.jsx index abf2271cb..ac5877815 100644 --- a/Client/src/Pages/StatusPage/Status/index.jsx +++ b/Client/src/Pages/StatusPage/Status/index.jsx @@ -1,7 +1,6 @@ // Components import { Typography, Stack } from "@mui/material"; import GenericFallback from "../../../Components/GenericFallback"; -import Fallback from "../../../Components/Fallback"; import AdminLink from "./Components/AdminLink"; import ControlsHeader from "./Components/ControlsHeader"; import SkeletonLayout from "./Components/Skeleton"; @@ -17,7 +16,7 @@ import { useLocation } from "react-router-dom"; import { useStatusPageDelete } from "./Hooks/useStatusPageDelete"; import { useState } from "react"; import { useParams } from "react-router-dom"; - +import { useNavigate } from "react-router-dom"; const PublicStatus = () => { const { url } = useParams(); @@ -26,17 +25,18 @@ const PublicStatus = () => { // Utils const theme = useTheme(); const isAdmin = useIsAdmin(); + const location = useLocation(); + const navigate = useNavigate(); + const [statusPage, monitors, isLoading, networkError, fetchStatusPage] = useStatusPageFetch(false, url); const [deleteStatusPage, isDeleting] = useStatusPageDelete(fetchStatusPage, url); - const location = useLocation(); // Setup const currentPath = location.pathname; let sx = { paddingLeft: theme.spacing(20), paddingRight: theme.spacing(20) }; let link = undefined; const isPublic = location.pathname.startsWith("/status/uptime/public"); - // Public status page if (isPublic) { sx = { @@ -142,6 +142,7 @@ const PublicStatus = () => { onConfirm={() => { deleteStatusPage(); setIsDeleteOpen(false); + navigate("/status"); }} onCancel={() => { setIsDeleteOpen(false); diff --git a/Client/src/Pages/StatusPage/StatusPages/index.jsx b/Client/src/Pages/StatusPage/StatusPages/index.jsx index 0f9ba0aa5..cf5b83289 100644 --- a/Client/src/Pages/StatusPage/StatusPages/index.jsx +++ b/Client/src/Pages/StatusPage/StatusPages/index.jsx @@ -2,13 +2,14 @@ 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: "/distributed-uptime/status-pages" }]; +const BREADCRUMBS = [{ name: `Status Pages`, path: "" }]; const StatusPages = () => { // Utils @@ -57,6 +58,11 @@ const StatusPages = () => { return ( + {statusPages?.map((statusPage) => { return (