update empty view, use table
This commit is contained in:
1 parent
5217292125
commit
771a9c6c99
2 files changed
+90
-15
No files matched your search
@@ -0,0 +1,85 @@
|
|||||||
|
import DataTable from "../../../../../Components/Table";
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { ColoredLabel } from "../../../../../Components/Label";
|
||||||
|
import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward";
|
||||||
|
import { Stack, Typography } from "@mui/material";
|
||||||
|
const StatusPagesTable = ({ data }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const headers = [
|
||||||
|
{
|
||||||
|
id: "name",
|
||||||
|
content: "Status page name",
|
||||||
|
render: (row) => {
|
||||||
|
return row.companyName;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "url",
|
||||||
|
content: "URL",
|
||||||
|
render: (row) => {
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
gap={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Typography>{row.url}</Typography>
|
||||||
|
<ArrowOutwardIcon />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "type",
|
||||||
|
content: "Type",
|
||||||
|
render: (row) => {
|
||||||
|
return row.type;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "status",
|
||||||
|
content: "Status",
|
||||||
|
render: (row) => {
|
||||||
|
return (
|
||||||
|
<ColoredLabel
|
||||||
|
label={row.isPublished ? "Published" : "Unpublished"}
|
||||||
|
color={
|
||||||
|
row.isPublished ? theme.palette.success.main : theme.palette.warning.main
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleRowClick = (statusPage) => {
|
||||||
|
if (statusPage.type === "distributed") {
|
||||||
|
navigate(`/status/distributed/${statusPage.url}`);
|
||||||
|
} else if (statusPage.type === "uptime") {
|
||||||
|
navigate(`/status/uptime/${statusPage.url}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DataTable
|
||||||
|
config={{
|
||||||
|
rowSX: {
|
||||||
|
cursor: "pointer",
|
||||||
|
"&:hover td": {
|
||||||
|
backgroundColor: theme.palette.tertiary.main,
|
||||||
|
transition: "background-color .3s ease",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onRowClick: (row) => {
|
||||||
|
handleRowClick(row);
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
headers={headers}
|
||||||
|
data={data}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StatusPagesTable;
|
||||||
@@ -4,6 +4,7 @@ import Breadcrumbs from "../../../Components/Breadcrumbs";
|
|||||||
import Fallback from "../../../Components/Fallback";
|
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";
|
||||||
// Utils
|
// Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
|
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
|
||||||
@@ -32,8 +33,9 @@ const StatusPages = () => {
|
|||||||
<Fallback
|
<Fallback
|
||||||
title="status page"
|
title="status page"
|
||||||
checks={[
|
checks={[
|
||||||
"Display a list of monitors to track",
|
"Monitor and display the health of your services in real time",
|
||||||
"Share your monitors with the public",
|
"Track multiple services and share their status",
|
||||||
|
"Keep users informed about outages and performance",
|
||||||
]}
|
]}
|
||||||
link="/status/uptime/create"
|
link="/status/uptime/create"
|
||||||
isAdmin={isAdmin}
|
isAdmin={isAdmin}
|
||||||
@@ -63,19 +65,7 @@ const StatusPages = () => {
|
|||||||
isAdmin={isAdmin}
|
isAdmin={isAdmin}
|
||||||
path="/status/uptime/create"
|
path="/status/uptime/create"
|
||||||
/>
|
/>
|
||||||
{statusPages?.map((statusPage) => {
|
<StatusPagesTable data={statusPages} />
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
key={statusPage._id}
|
|
||||||
onClick={() => handleStatusPageClick(statusPage)}
|
|
||||||
sx={{ cursor: "pointer" }}
|
|
||||||
>
|
|
||||||
<Typography variant="h2">Company Name: {statusPage.companyName}</Typography>
|
|
||||||
<Typography variant="h2">Status page URL: {statusPage.url}</Typography>
|
|
||||||
<Typography variant="h2">Type: {statusPage.type}</Typography>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user