From 853e21623e9a3c08174f8a6d5850a1fbc54e8a73 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 2 Feb 2026 19:20:59 +0000 Subject: [PATCH] new status pages --- .../Components/StatusPagesTable.tsx | 109 ++++++++++++++++++ .../Pages/StatusPage/StatusPages/index.tsx | 33 ++++++ .../StatusPages/{index.jsx => old.jsx} | 0 client/src/Routes/index.jsx | 10 +- client/src/Types/StatusPage.ts | 24 ++++ client/src/locales/en.json | 56 +++++++++ 6 files changed, 230 insertions(+), 2 deletions(-) create mode 100644 client/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable.tsx create mode 100644 client/src/Pages/StatusPage/StatusPages/index.tsx rename client/src/Pages/StatusPage/StatusPages/{index.jsx => old.jsx} (100%) create mode 100644 client/src/Types/StatusPage.ts diff --git a/client/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable.tsx b/client/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable.tsx new file mode 100644 index 000000000..1741aeadf --- /dev/null +++ b/client/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable.tsx @@ -0,0 +1,109 @@ +import Box from "@mui/material/Box"; +import Stack from "@mui/material/Stack"; +import Typography from "@mui/material/Typography"; +import { Table, type Header, ValueLabel } from "@/Components/v2/design-elements"; +import { ExternalLink } from "lucide-react"; + +import { useTranslation } from "react-i18next"; +import { useTheme } from "@mui/material/styles"; +import { useNavigate } from "react-router-dom"; + +import type { StatusPage } from "@/Types/StatusPage"; + +interface StatusPagesTableProps { + data: StatusPage[]; +} + +export const StatusPagesTable = ({ data }: StatusPagesTableProps) => { + const { t } = useTranslation(); + const theme = useTheme(); + const navigate = useNavigate(); + + const handleUrlClick = (e: React.MouseEvent, row: StatusPage) => { + if (row.isPublished) { + e.stopPropagation(); + const url = `/status/uptime/public/${row.url}`; + window.open(url, "_blank", "noopener,noreferrer"); + } + }; + + const getHeaders = (): Header[] => { + return [ + { + id: "name", + content: t("pages.statusPages.table.headers.name"), + render: (row) => row.companyName, + }, + { + id: "url", + content: t("pages.statusPages.table.headers.url"), + render: (row) => { + const content = row.isPublished + ? `/${row.url}` + : t("pages.statusPages.table.unpublished"); + return ( + handleUrlClick(e, row)} + sx={{ + ...(row.isPublished && { + display: "inline-flex", + ":hover": { + cursor: "pointer", + borderBottom: 1, + }, + }), + }} + > + {content} + {row.isPublished && } + + ); + }, + }, + { + id: "type", + content: t("common.table.headers.type"), + render: (row) => row.type, + }, + { + id: "status", + content: t("common.table.headers.status"), + render: (row) => { + return ( + + ); + }, + }, + ]; + }; + + const handleRowClick = (statusPage: StatusPage) => { + navigate(`/status/uptime/${statusPage.url}`); + }; + + return ( + + + + ); +}; + +export default StatusPagesTable; diff --git a/client/src/Pages/StatusPage/StatusPages/index.tsx b/client/src/Pages/StatusPage/StatusPages/index.tsx new file mode 100644 index 000000000..ad1a39b29 --- /dev/null +++ b/client/src/Pages/StatusPage/StatusPages/index.tsx @@ -0,0 +1,33 @@ +import { BasePageWithStates } from "@/Components/v2/design-elements"; +import { StatusPagesTable } from "./Components/StatusPagesTable"; +import { useGet } from "@/Hooks/UseApi"; +import type { StatusPage } from "@/Types/StatusPage"; +import { useTranslation } from "react-i18next"; + +const StatusPages = () => { + const { t } = useTranslation(); + + const { + data: statusPages, + isLoading, + error, + } = useGet("/status-page/team"); + + return ( + + + + ); +}; + +export default StatusPages; diff --git a/client/src/Pages/StatusPage/StatusPages/index.jsx b/client/src/Pages/StatusPage/StatusPages/old.jsx similarity index 100% rename from client/src/Pages/StatusPage/StatusPages/index.jsx rename to client/src/Pages/StatusPage/StatusPages/old.jsx diff --git a/client/src/Routes/index.jsx b/client/src/Routes/index.jsx index ecda66cd1..aec872a0f 100644 --- a/client/src/Routes/index.jsx +++ b/client/src/Routes/index.jsx @@ -37,7 +37,7 @@ import Incidents from "../Pages/Incidents/"; // Status pages import CreateStatus from "../Pages/StatusPage/Create/index.jsx"; -import StatusPages from "../Pages/StatusPage/StatusPages/index.jsx"; +import StatusPages from "../Pages/StatusPage/StatusPages"; import Status from "../Pages/StatusPage/Status/index.jsx"; import Notifications from "../Pages/Notifications"; @@ -227,7 +227,13 @@ const Routes = () => { } + element={ + <> + + + + + } />