From ac8c01fd8173da09706b044ef33fae692606c74a Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 27 Feb 2025 11:27:03 -0800 Subject: [PATCH 1/4] add an onClick and sx config for specific cells to be passed in header config --- src/Components/Table/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Components/Table/index.jsx b/src/Components/Table/index.jsx index b716038e9..93772a712 100644 --- a/src/Components/Table/index.jsx +++ b/src/Components/Table/index.jsx @@ -15,6 +15,8 @@ import { useTheme } from "@emotion/react"; * @typedef {Object} Header * @property {number|string} id - The unique identifier for the header. * @property {React.ReactNode} content - The content to display in the header cell. + * @property {Function} onClick - A function to be called when this cell is clicked, receiving the event and row data as an argument. + * @property {Object} getCellSx - Function that takes a row and returns a style object for the table cell. * @property {Function} render - A function to render the cell content for a given row. */ @@ -107,6 +109,8 @@ const DataTable = ({ header.onClick(e, row) : null} + sx={header.getCellSx ? header.getCellSx(row) : {}} > {header.render(row)} From 69f39e76a04560f16f957b1600a3db25a3172c04 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 27 Feb 2025 11:27:20 -0800 Subject: [PATCH 2/4] add link and style for public status page --- .../Components/StatusPagesTable/index.jsx | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx b/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx index 746d10f42..620fa53ea 100644 --- a/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx +++ b/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx @@ -17,16 +17,38 @@ const StatusPagesTable = ({ data }) => { }, { id: "url", - content: "URL", + content: "Public URL", + onClick: (e, row) => { + if (row.isPublished) { + e.stopPropagation(); + const url = + row.type === "distributed" + ? `/status/distributed/public/${row.url}` + : `/status/uptime/public/${row.url}`; + navigate(url); + } + }, + getCellSx: (row) => { + return { + ...(row.isPublished && { + "&.MuiTableCell-root:hover": { + backgroundColor: `${theme.palette.primary.light}`, + cursor: "pointer", + borderRadius: 1, + }, + }), + }; + }, render: (row) => { + const content = row.isPublished ? `/${row.url}` : "Unpublished"; return ( - {`/${row.url}`} - + {content} + {row.isPublished && } ); }, From 7d3ea8ac190140e0e70f9d2c7f3f965198ade67b Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 27 Feb 2025 14:15:52 -0800 Subject: [PATCH 3/4] move hover to stack --- .../Components/StatusPagesTable/index.jsx | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx b/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx index 620fa53ea..0e43b9012 100644 --- a/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx +++ b/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx @@ -28,17 +28,6 @@ const StatusPagesTable = ({ data }) => { navigate(url); } }, - getCellSx: (row) => { - return { - ...(row.isPublished && { - "&.MuiTableCell-root:hover": { - backgroundColor: `${theme.palette.primary.light}`, - cursor: "pointer", - borderRadius: 1, - }, - }), - }; - }, render: (row) => { const content = row.isPublished ? `/${row.url}` : "Unpublished"; return ( @@ -46,6 +35,18 @@ const StatusPagesTable = ({ data }) => { direction="row" alignItems="center" gap={theme.spacing(2)} + paddingLeft={theme.spacing(2)} + paddingRight={theme.spacing(2)} + borderRadius={theme.spacing(4)} + sx={{ + ...(row.isPublished && { + ":hover": { + backgroundColor: `${theme.palette.primary.light}`, + cursor: "pointer", + borderRadius: 1, + }, + }), + }} > {content} {row.isPublished && } From ccde912c3ee2dee4c8cb97d8c502c389275f8d78 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 27 Feb 2025 14:21:32 -0800 Subject: [PATCH 4/4] center align URL --- .../StatusPage/StatusPages/Components/StatusPagesTable/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx b/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx index 0e43b9012..7c951d420 100644 --- a/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx +++ b/src/Pages/StatusPage/StatusPages/Components/StatusPagesTable/index.jsx @@ -34,6 +34,7 @@ const StatusPagesTable = ({ data }) => {