From 35a9c081b5909a51385802b34e79c4259a6bedd1 Mon Sep 17 00:00:00 2001 From: Br0wnHammer Date: Tue, 1 Jul 2025 15:54:50 +0530 Subject: [PATCH] Feat: Status Boxes in Incidents Page --- .../Components/OptionsHeader/index.jsx | 4 +- .../Components/StatusBoxes/StatusBox.jsx | 116 ++++++++++++++++++ .../Components/StatusBoxes/index.jsx | 43 +++++++ .../Components/StatusBoxes/skeleton.jsx | 36 ++++++ client/src/Pages/Incidents/index.jsx | 4 + 5 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 client/src/Pages/Incidents/Components/StatusBoxes/StatusBox.jsx create mode 100644 client/src/Pages/Incidents/Components/StatusBoxes/index.jsx create mode 100644 client/src/Pages/Incidents/Components/StatusBoxes/skeleton.jsx diff --git a/client/src/Pages/Incidents/Components/OptionsHeader/index.jsx b/client/src/Pages/Incidents/Components/OptionsHeader/index.jsx index 457c6fd96..08a9bcf1c 100644 --- a/client/src/Pages/Incidents/Components/OptionsHeader/index.jsx +++ b/client/src/Pages/Incidents/Components/OptionsHeader/index.jsx @@ -87,13 +87,13 @@ const OptionsHeader = ({ > {t("incidentsOptionsHeaderFilterCannotResolve")} - {/* */} + diff --git a/client/src/Pages/Incidents/Components/StatusBoxes/StatusBox.jsx b/client/src/Pages/Incidents/Components/StatusBoxes/StatusBox.jsx new file mode 100644 index 000000000..ef7457a9e --- /dev/null +++ b/client/src/Pages/Incidents/Components/StatusBoxes/StatusBox.jsx @@ -0,0 +1,116 @@ +import PropTypes from "prop-types"; +import { useTheme } from "@emotion/react"; +import { Box, Stack, Typography } from "@mui/material"; +import Background from "../../../../assets/Images/background-grid.svg?react"; +import MonitorHeartOutlinedIcon from "@mui/icons-material/MonitorHeartOutlined"; +import TaskAltOutlinedIcon from "@mui/icons-material/TaskAltOutlined"; +import CancelOutlinedIcon from "@mui/icons-material/CancelOutlined"; +import WarningAmberRoundedIcon from "@mui/icons-material/WarningAmberRounded"; + +const StatusBox = ({ title, value, status }) => { + const theme = useTheme(); + let sharedStyles = { + position: "absolute", + right: 8, + opacity: 0.5, + "& svg path": { stroke: theme.palette.primary.contrastTextTertiary }, + }; + + let color; + let icon; + if (status === "up") { + color = theme.palette.success.lowContrast; + icon = ( + + + + ); + } else if (status === "down") { + color = theme.palette.error.lowContrast; + icon = ( + + + + ); + } else if (status === "paused") { + color = theme.palette.warning.lowContrast; + icon = ( + + + + ); + } else { + color = theme.palette.accent.main; + icon = ( + + + + ); + } + + return ( + + + + + + + + {title} + + {icon} + + + {value} + + + # + + + + + ); +}; + +StatusBox.propTypes = { + title: PropTypes.string, + value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, + status: PropTypes.string, +}; + +export default StatusBox; \ No newline at end of file diff --git a/client/src/Pages/Incidents/Components/StatusBoxes/index.jsx b/client/src/Pages/Incidents/Components/StatusBoxes/index.jsx new file mode 100644 index 000000000..ae29f4a8f --- /dev/null +++ b/client/src/Pages/Incidents/Components/StatusBoxes/index.jsx @@ -0,0 +1,43 @@ +import PropTypes from "prop-types"; +import { Stack } from "@mui/material"; +import StatusBox from "./StatusBox"; +import { useTheme } from "@emotion/react"; +import SkeletonLayout from "./skeleton"; + +const StatusBoxes = ({ shouldRender }) => { + const theme = useTheme(); + if (!shouldRender) return ; + return ( + + + + + + + ); +}; + +StatusBoxes.propTypes = { + shouldRender: PropTypes.bool, +}; + +export default StatusBoxes; \ No newline at end of file diff --git a/client/src/Pages/Incidents/Components/StatusBoxes/skeleton.jsx b/client/src/Pages/Incidents/Components/StatusBoxes/skeleton.jsx new file mode 100644 index 000000000..b9aa016b7 --- /dev/null +++ b/client/src/Pages/Incidents/Components/StatusBoxes/skeleton.jsx @@ -0,0 +1,36 @@ +import { Skeleton, Stack } from "@mui/material"; +import { useTheme } from "@emotion/react"; + +const SkeletonLayout = () => { + const theme = useTheme(); + return ( + + + + + + + ); +}; + +export default SkeletonLayout; diff --git a/client/src/Pages/Incidents/index.jsx b/client/src/Pages/Incidents/index.jsx index 09d4f0e25..8d668cb01 100644 --- a/client/src/Pages/Incidents/index.jsx +++ b/client/src/Pages/Incidents/index.jsx @@ -4,6 +4,7 @@ import Breadcrumbs from "../../Components/Breadcrumbs"; import GenericFallback from "../../Components/GenericFallback"; import IncidentTable from "./Components/IncidentTable"; import OptionsHeader from "./Components/OptionsHeader"; +import StatusBoxes from "./Components/StatusBoxes"; //Utils import { useTheme } from "@emotion/react"; @@ -62,6 +63,9 @@ const Incidents = () => { return ( +