Improve Latest Incidents panel layout

- Simplify incident rows to single line with grid layout
- Remove redundant "Monitor:" and "Status:" labels
- Align columns vertically (monitor name, status badge, duration)
- Center-align status badge column
- Match icon styling with General Statistics (18px, strokeWidth 1.5)
- Remove pointer cursor (click not implemented)
- Add dividers and minHeight to Statistics panel for alignment
This commit is contained in:
gorkem-bwl committed 2026-01-15 21:19:34 -05:00
1 parent 54ecf02d9a
commit c60d07c3a0
2 files changed
+83 -124

No files matched your search

@@ -4,7 +4,6 @@ import { useTheme } from "@emotion/react";
import { StatusLabel } from "@/Components/v1/Label/index.jsx"; import { StatusLabel } from "@/Components/v1/Label/index.jsx";
import { getHumanReadableDuration } from "@/Utils/timeUtils.js"; import { getHumanReadableDuration } from "@/Utils/timeUtils.js";
import Monitors from "@/assets/icons/monitors.svg?react"; import Monitors from "@/assets/icons/monitors.svg?react";
import AverageResponseIcon from "@/assets/icons/status-pages.svg?react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const IncidentItem = ({ incident }) => { const IncidentItem = ({ incident }) => {
@@ -37,101 +36,65 @@ const IncidentItem = ({ incident }) => {
const duration = calculateDuration(); const duration = calculateDuration();
const iconWrapperStyle = { const iconWrapperStyle = {
px: theme.spacing(2),
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
mx: theme.spacing(2),
color: theme.palette.primary.contrastTextTertiary, color: theme.palette.primary.contrastTextTertiary,
"& svg": {
width: 18,
height: 18,
},
"& svg path": { "& svg path": {
stroke: "currentColor", stroke: "currentColor",
strokeWidth: 1.5,
}, },
}; };
return ( return (
<Box <Box
sx={{ sx={{
cursor: "pointer", display: "grid",
gridTemplateColumns: "1fr 100px 80px",
alignItems: "center",
gap: theme.spacing(2),
width: "100%", width: "100%",
py: theme.spacing(0.5), py: theme.spacing(0.5),
"&:hover": { opacity: 0.8 },
}} }}
> >
<Stack <Stack
direction="column" direction="row"
gap={theme.spacing(1.5)} alignItems="center"
gap={theme.spacing(2)}
> >
<Stack <Box sx={iconWrapperStyle}>
direction="row" <Monitors />
alignItems="center" </Box>
gap={theme.spacing(1)} <Typography
variant="body1"
fontWeight={500}
noWrap
> >
<Box {incident.monitorName || t("incidentsPage.unknownMonitor")}
sx={{ </Typography>
...iconWrapperStyle,
}}
>
<Monitors />
</Box>
<Stack
direction="row"
gap={theme.spacing(4)}
alignItems="baseline"
>
<Typography variant="body1">
{t("incidentsPage.incidentItemMonitor")}:
</Typography>
<Typography
variant="body1"
fontWeight={600}
>
{incident.monitorName || t("incidentsPage.unknownMonitor")}
</Typography>
</Stack>
</Stack>
<Stack
direction="row"
alignItems="center"
width="100%"
marginTop={theme.spacing(1)}
>
<Stack
direction="row"
alignItems="center"
gap={theme.spacing(3)}
>
<Box sx={{ ...iconWrapperStyle }}>
<AverageResponseIcon />
</Box>
<Stack
direction="row"
alignItems="center"
spacing={2}
>
<Typography variant="body1">
{t("incidentsPage.incidentItemStatus")}:
</Typography>
</Stack>
<StatusLabel
status={isActive ? "down" : "up"}
text={isActive ? t("incidentsPage.active") : t("incidentsPage.resolved")}
customStyles={{
textTransform: "capitalize",
}}
/>
</Stack>
<Box sx={{ flexGrow: 1 }} />
<Typography
variant="body1"
fontWeight={500}
>
{duration}
</Typography>
</Stack>
</Stack> </Stack>
<Box sx={{ display: "flex", justifyContent: "center" }}>
<StatusLabel
status={isActive ? "down" : "up"}
text={isActive ? t("incidentsPage.active") : t("incidentsPage.resolved")}
customStyles={{
textTransform: "capitalize",
}}
/>
</Box>
<Typography
variant="body1"
fontWeight={500}
textAlign="right"
>
{duration}
</Typography>
</Box> </Box>
); );
}; };
@@ -1,5 +1,5 @@
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Box, Stack, Typography } from "@mui/material"; import { Box, Stack, Typography, Divider } from "@mui/material";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import PanelSkeleton from "../IncidentsSummaryPanel/skeleton.jsx"; import PanelSkeleton from "../IncidentsSummaryPanel/skeleton.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -86,74 +86,70 @@ const StatisticsPanel = ({ isLoading = false, error = null, summary = {} }) => {
return summary.topMonitor?.monitorName || t("incidentsPage.none"); return summary.topMonitor?.monitorName || t("incidentsPage.none");
}; };
const rowStyle = {
py: theme.spacing(0.5),
minHeight: 32,
};
return ( return (
<SummaryCard title={t("incidentsPage.incidentsStatisticsPanelTitle")}> <SummaryCard title={t("incidentsPage.incidentsStatisticsPanelTitle")}>
<Stack gap={theme.spacing(4)}> <Stack gap={theme.spacing(4)}>
<Stack <Box>
direction="row" <Stack
alignItems="center" direction="row"
gap={theme.spacing(3)} alignItems="center"
> gap={theme.spacing(2)}
<Box sx={rowStyle}
sx={{
...iconWrapperStyle,
}}
> >
<NotificationIcon /> <Box sx={iconWrapperStyle}>
</Box> <NotificationIcon />
<Box> </Box>
<Typography <Typography
variant="body1" variant="body1"
sx={{ fontWeight={500}
fontWeight: 500,
lineHeight: 1.2,
}}
> >
{t("incidentsPage.totalIncidents")}: {summary.total || 0} {t("incidentsPage.totalIncidents")}: {summary.total || 0}
</Typography> </Typography>
</Box> </Stack>
</Stack> <Divider sx={{ mt: theme.spacing(2) }} />
<Stack </Box>
direction="row" <Box>
alignItems="center" <Stack
gap={theme.spacing(2)} direction="row"
> alignItems="center"
<Box sx={iconWrapperStyle}> gap={theme.spacing(2)}
<Incidents /> sx={rowStyle}
</Box> >
<Box> <Box sx={iconWrapperStyle}>
<Incidents />
</Box>
<Typography <Typography
variant="body1" variant="body1"
sx={{ fontWeight={500}
fontWeight: 500,
lineHeight: 1.2,
}}
> >
{t("incidentsPage.mostAffectedMonitor")}: {getMostAffectedMonitor()} {t("incidentsPage.mostAffectedMonitor")}: {getMostAffectedMonitor()}
</Typography> </Typography>
</Box> </Stack>
</Stack> <Divider sx={{ mt: theme.spacing(2) }} />
</Box>
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
gap={theme.spacing(2)} gap={theme.spacing(2)}
sx={rowStyle}
> >
<Box sx={iconWrapperStyle}> <Box sx={iconWrapperStyle}>
<Clock /> <Clock />
</Box> </Box>
<Box> <Typography
<Typography variant="body1"
variant="body1" fontWeight={500}
sx={{ >
fontWeight: 500, {t("incidentsPage.avgResolutionTime")}:{" "}
}} {summary.total > 0
> ? `${summary.avgResolutionTimeHours || 0} ${t("incidentsPage.hours")}`
{t("incidentsPage.avgResolutionTime")}:{" "} : "N/A"}
{summary.total > 0 </Typography>
? `${summary.avgResolutionTimeHours || 0} ${t("incidentsPage.hours")}`
: "N/A"}
</Typography>
</Box>
</Stack> </Stack>
</Stack> </Stack>
</SummaryCard> </SummaryCard>