Merge pull request #3594 from bluewave-labs/feat/incidents-page-polish

feat(incidents): consistent typography, icons, and layout across the page
This commit is contained in:
Alexander Holliday authored and GitHub committed 2026-04-29 09:56:27 -07:00
commit 53e04e6af2
4 files changed
+90 -91

No files matched your search

@@ -13,6 +13,7 @@ import { useSelector } from "react-redux";
import type { RootState } from "@/Types/state"; import type { RootState } from "@/Types/state";
import { formatDateWithTz } from "@/Utils/TimeUtils"; import { formatDateWithTz } from "@/Utils/TimeUtils";
import { getIncidentsDuration } from "@/Pages/Incidents/utils"; import { getIncidentsDuration } from "@/Pages/Incidents/utils";
import { theme } from "@/Utils/Theme/Theme";
interface CardDetailsProps { interface CardDetailsProps {
incident: Incident | null; incident: Incident | null;
@@ -20,6 +21,24 @@ interface CardDetailsProps {
sx?: object; sx?: object;
} }
const SectionHeading = ({ children }: { children: React.ReactNode }) => {
const theme = useTheme();
return (
<Typography
component="h2"
variant="eyebrow"
color={theme.palette.text.secondary}
>
{children}
</Typography>
);
};
const Cell = ({ children }: { children: React.ReactNode }) => (
<Typography variant="body1">{children}</Typography>
);
export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => { export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
@@ -33,22 +52,18 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
gap={theme.spacing(LAYOUT.MD)} gap={theme.spacing(LAYOUT.MD)}
sx={sx} sx={sx}
> >
<Typography textTransform={"uppercase"}> <SectionHeading>{t("pages.incidents.dialog.details.title")}</SectionHeading>
{t("pages.incidents.dialog.details.title")}
</Typography>
<BaseBox padding={LAYOUT.MD}> <BaseBox padding={LAYOUT.MD}>
<Stack gap={theme.spacing(LAYOUT.MD)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<Typography textTransform={"uppercase"}> <SectionHeading>{t("pages.incidents.dialog.details.overview")}</SectionHeading>
{t("pages.incidents.dialog.details.overview")}
</Typography>
<Divider />
<Grid <Grid
container container
spacing={theme.spacing(LAYOUT.MD)} spacing={theme.spacing(LAYOUT.MD)}
alignItems="center" alignItems="center"
> >
<Grid size={2}>{t("pages.incidents.dialog.details.status")}</Grid> <Grid size={2}>
<Cell>{t("pages.incidents.dialog.details.status")}</Cell>
</Grid>
<Grid size={10}> <Grid size={10}>
<ValueLabel <ValueLabel
value={incident.status ? "negative" : "positive"} value={incident.status ? "negative" : "positive"}
@@ -61,15 +76,17 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
</Grid> </Grid>
{monitor && ( {monitor && (
<> <>
<Grid size={2}>{t("pages.incidents.dialog.details.monitor")}</Grid> <Grid size={2}>
<Cell>{t("pages.incidents.dialog.details.monitor")}</Cell>
</Grid>
<Grid size={10}> <Grid size={10}>
<Typography>{monitor.name ?? "N/A"}</Typography> <Cell>{monitor.name ?? "N/A"}</Cell>
</Grid> </Grid>
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.url")}</Typography> <Cell>{t("pages.incidents.dialog.details.url")}</Cell>
</Grid> </Grid>
<Grid size={10}> <Grid size={10}>
<Typography>{monitor.url ?? "N/A"}</Typography> <Cell>{monitor.url ?? "N/A"}</Cell>
</Grid> </Grid>
</> </>
)} )}
@@ -78,51 +95,48 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
</BaseBox> </BaseBox>
<BaseBox padding={LAYOUT.MD}> <BaseBox padding={LAYOUT.MD}>
<Stack gap={theme.spacing(LAYOUT.MD)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<Typography textTransform={"uppercase"}> <SectionHeading>{t("pages.incidents.dialog.details.analysis")}</SectionHeading>
{t("pages.incidents.dialog.details.analysis")}
</Typography>
<Divider />
<Grid <Grid
container container
spacing={theme.spacing(LAYOUT.MD)} spacing={theme.spacing(LAYOUT.MD)}
> >
<Grid size={6}> <Grid size={6}>
<Typography>{t("pages.incidents.dialog.details.timeline")}</Typography> <Cell>{t("pages.incidents.dialog.details.timeline")}</Cell>
</Grid> </Grid>
<Grid size={6}> <Grid size={6}>
<Typography>{t("pages.incidents.dialog.details.detailsLabel")}</Typography> <Cell>{t("pages.incidents.dialog.details.detailsLabel")}</Cell>
</Grid> </Grid>
<Grid size={6}> <Grid size={6}>
<Divider></Divider> <Divider />
</Grid> </Grid>
<Grid size={6}> <Grid size={6}>
<Divider></Divider> <Divider />
</Grid> </Grid>
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.startedAt")}</Typography> <Cell>{t("pages.incidents.dialog.details.startedAt")}</Cell>
</Grid> </Grid>
<Grid size={4}> <Grid size={4}>
<Typography> <Cell>
{formatDateWithTz(incident.startTime, "D MMM YYYY, h:mm A", uiTimezone)} {formatDateWithTz(incident.startTime, "D MMM YYYY, h:mm A", uiTimezone)}
</Typography> </Cell>
</Grid> </Grid>
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.statusCode")}</Typography> <Cell>{t("pages.incidents.dialog.details.statusCode")}</Cell>
</Grid> </Grid>
<Grid size={4}> <Grid size={4}>
<Typography>{incident.statusCode ?? "N/A"}</Typography> <Cell>{incident.statusCode ?? "N/A"}</Cell>
</Grid> </Grid>
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.downtime")}</Typography> <Cell>{t("pages.incidents.dialog.details.downtime")}</Cell>
</Grid> </Grid>
<Grid size={4}> <Grid size={4}>
<Typography>{getIncidentsDuration(incident)}</Typography> <Cell>{getIncidentsDuration(incident)}</Cell>
</Grid> </Grid>
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.message")}</Typography> <Cell>{t("pages.incidents.dialog.details.message")}</Cell>
</Grid> </Grid>
<Grid size={4}> <Grid size={4}>
<Typography>{incident.message ?? "N/A"}</Typography> <Cell>{incident.message ?? "N/A"}</Cell>
</Grid> </Grid>
</Grid> </Grid>
</Stack> </Stack>
@@ -130,60 +144,53 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
{!incident.status && ( {!incident.status && (
<BaseBox padding={LAYOUT.MD}> <BaseBox padding={LAYOUT.MD}>
<Stack gap={theme.spacing(LAYOUT.XS)}> <Stack gap={theme.spacing(LAYOUT.XS)}>
<Typography textTransform={"uppercase"}> <SectionHeading>
{t("pages.incidents.dialog.details.resolutionDetails")} {t("pages.incidents.dialog.details.resolutionDetails")}
</Typography> </SectionHeading>
<Divider />
<Grid <Grid
container container
spacing={theme.spacing(LAYOUT.MD)} spacing={theme.spacing(LAYOUT.MD)}
alignItems="center" alignItems="center"
> >
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.resolvedAt")}</Typography> <Cell>{t("pages.incidents.dialog.details.resolvedAt")}</Cell>
</Grid> </Grid>
<Grid size={10}> <Grid size={10}>
<Typography> <Cell>
{incident.endTime {incident.endTime
? formatDateWithTz(incident.endTime, "D MMM YYYY, h:mm A", uiTimezone) ? formatDateWithTz(incident.endTime, "D MMM YYYY, h:mm A", uiTimezone)
: "N/A"} : "N/A"}
</Typography> </Cell>
</Grid> </Grid>
<Grid size={2}> <Grid size={2}>
<Typography> <Cell>{t("pages.incidents.dialog.details.resolutionType")}</Cell>
{t("pages.incidents.dialog.details.resolutionType")}
</Typography>
</Grid> </Grid>
<Grid size={10}> <Grid size={10}>
<Typography> <Cell>
{incident.resolutionType {incident.resolutionType
? t( ? t(
`pages.incidents.dialog.details.resolutionTypes.${incident.resolutionType}` `pages.incidents.dialog.details.resolutionTypes.${incident.resolutionType}`
) )
: "N/A"} : "N/A"}
</Typography> </Cell>
</Grid> </Grid>
{incident.resolvedBy && ( {incident.resolvedBy && (
<> <>
<Grid size={2}> <Grid size={2}>
<Typography> <Cell>{t("pages.incidents.dialog.details.resolvedBy")}</Cell>
{t("pages.incidents.dialog.details.resolvedBy")}
</Typography>
</Grid> </Grid>
<Grid size={10}> <Grid size={10}>
<Typography> <Cell>{incident.resolvedByEmail ?? incident.resolvedBy}</Cell>
{incident.resolvedByEmail ?? incident.resolvedBy}
</Typography>
</Grid> </Grid>
</> </>
)} )}
{incident.comment && ( {incident.comment && (
<> <>
<Grid size={2}> <Grid size={2}>
<Typography>{t("pages.incidents.dialog.details.comment")}</Typography> <Cell>{t("pages.incidents.dialog.details.comment")}</Cell>
</Grid> </Grid>
<Grid size={10}> <Grid size={10}>
<Typography>{incident.comment}</Typography> <Cell>{incident.comment}</Cell>
</Grid> </Grid>
</> </>
)} )}
@@ -1,8 +1,7 @@
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Divider from "@mui/material/Divider";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import { BaseBox, ValueLabel } from "@/Components/design-elements"; import { BaseBox, Icon, ValueLabel } from "@/Components/design-elements";
import { CircleCheck, TriangleAlert, Bell, Wrench, Globe } from "lucide-react"; import { CircleCheck, TriangleAlert, Bell, Wrench, Globe } from "lucide-react";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
@@ -25,6 +24,7 @@ const SummaryItem = ({ icon, label, value }: SummaryItemProps) => {
alignItems="center" alignItems="center"
justifyContent="space-between" justifyContent="space-between"
gap={theme.spacing(2)} gap={theme.spacing(2)}
minHeight={32}
> >
<Stack <Stack
direction="row" direction="row"
@@ -32,10 +32,10 @@ const SummaryItem = ({ icon, label, value }: SummaryItemProps) => {
gap={theme.spacing(2)} gap={theme.spacing(2)}
> >
{icon} {icon}
<Typography variant="body2">{label}</Typography> <Typography variant="body1">{label}</Typography>
</Stack> </Stack>
<Typography <Typography
variant="body2" variant="body1"
fontWeight={600} fontWeight={600}
> >
{value} {value}
@@ -67,15 +67,11 @@ export const SummaryCard = ({
> >
<Typography <Typography
component="h2" component="h2"
sx={{ variant="eyebrow"
textTransform: "uppercase", color={theme.palette.text.secondary}
fontWeight: 500,
fontSize: 13,
}}
> >
{title} {title}
</Typography> </Typography>
<Divider />
{children} {children}
</Stack> </Stack>
</BaseBox> </BaseBox>
@@ -97,10 +93,13 @@ export const SummaryCardActiveIncidents = ({
const activeCount = summary.totalActive; const activeCount = summary.totalActive;
const hasActive = activeCount > 0; const hasActive = activeCount > 0;
const color = hasActive ? theme.palette.error.main : theme.palette.success.main; const color = hasActive ? theme.palette.error.main : theme.palette.success.main;
const icon = hasActive ? ( const icon = (
<TriangleAlert color={color} /> <Box sx={{ color, display: "inline-flex" }}>
) : ( <Icon
<CircleCheck color={color} /> icon={hasActive ? TriangleAlert : CircleCheck}
size={32}
/>
</Box>
); );
const msg = t("pages.incidents.summaryCard.activeIncidents.active", { const msg = t("pages.incidents.summaryCard.activeIncidents.active", {
count: activeCount, count: activeCount,
@@ -133,10 +132,7 @@ const SummaryIncidentItem = ({ incident }: { incident: IncidentSummaryItem }) =>
container container
alignItems="center" alignItems="center"
spacing={2} spacing={2}
sx={{ sx={{ width: "100%", minHeight: 32 }}
width: "100%",
py: theme.spacing(0.5),
}}
> >
<Grid <Grid
size={{ xs: 12, lg: 5 }} size={{ xs: 12, lg: 5 }}
@@ -147,7 +143,7 @@ const SummaryIncidentItem = ({ incident }: { incident: IncidentSummaryItem }) =>
gap: theme.spacing(2), gap: theme.spacing(2),
}} }}
> >
<Globe /> <Icon icon={Globe} />
<Typography <Typography
variant="body1" variant="body1"
fontWeight={500} fontWeight={500}
@@ -159,9 +155,7 @@ const SummaryIncidentItem = ({ incident }: { incident: IncidentSummaryItem }) =>
<Grid <Grid
size={{ xs: 12, md: 6, lg: 3 }} size={{ xs: 12, md: 6, lg: 3 }}
sx={{ sx={{ display: "flex" }}
display: "flex",
}}
> >
<ValueLabel <ValueLabel
value={incident.status ? "negative" : "positive"} value={incident.status ? "negative" : "positive"}
@@ -173,7 +167,7 @@ const SummaryIncidentItem = ({ incident }: { incident: IncidentSummaryItem }) =>
size={{ xs: 12, md: 6, lg: 4 }} size={{ xs: 12, md: 6, lg: 4 }}
sx={{ sx={{
textAlign: { xs: "left", md: "right" }, textAlign: { xs: "left", md: "right" },
fontWeight: 500, fontWeight: 600,
}} }}
> >
<Typography variant="body1">{duration}</Typography> <Typography variant="body1">{duration}</Typography>
@@ -190,22 +184,17 @@ export const SummaryCardLatestIncidents = ({
summary, summary,
}: SummaryCardLatestIncidentsProps) => { }: SummaryCardLatestIncidentsProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme();
const latestIncidents = summary?.latestIncidents ?? []; const latestIncidents = summary?.latestIncidents ?? [];
return ( return (
<SummaryCard title={t("pages.incidents.summaryCard.latestIncidents.title")}> <SummaryCard title={t("pages.incidents.summaryCard.latestIncidents.title")}>
<Stack gap={theme.spacing(4)}> {latestIncidents.slice(0, 3).map((incident) => (
{latestIncidents.slice(0, 3).map((incident, index) => ( <SummaryIncidentItem
<Box key={incident.id}> key={incident.id}
<SummaryIncidentItem incident={incident} /> incident={incident}
{index < latestIncidents.length - 1 && ( />
<Divider sx={{ mt: theme.spacing(2) }} /> ))}
)}
</Box>
))}
</Stack>
</SummaryCard> </SummaryCard>
); );
}; };
@@ -224,17 +213,17 @@ export const SummaryCardStats = ({ summary }: SummaryCardStatsProps) => {
return ( return (
<SummaryCard title={t("pages.incidents.summaryCard.incidentStats.title")}> <SummaryCard title={t("pages.incidents.summaryCard.incidentStats.title")}>
<SummaryItem <SummaryItem
icon={<Bell size={18} />} icon={<Icon icon={Bell} />}
label={t("pages.incidents.summaryCard.incidentStats.totalIncidents")} label={t("pages.incidents.summaryCard.incidentStats.totalIncidents")}
value={summary?.total || 0} value={summary?.total || 0}
/> />
<SummaryItem <SummaryItem
icon={<TriangleAlert size={18} />} icon={<Icon icon={TriangleAlert} />}
label={t("pages.incidents.summaryCard.incidentStats.mostAffectedMonitor")} label={t("pages.incidents.summaryCard.incidentStats.mostAffectedMonitor")}
value={mostAffected} value={mostAffected}
/> />
<SummaryItem <SummaryItem
icon={<Wrench size={18} />} icon={<Icon icon={Wrench} />}
label={t("pages.incidents.summaryCard.incidentStats.avgResolutionTime")} label={t("pages.incidents.summaryCard.incidentStats.avgResolutionTime")}
value={ value={
summary.total > 0 summary.total > 0
@@ -75,7 +75,7 @@ export const ControlsIncidentFilter = ({
variant="contained" variant="contained"
onClick={onClearFilters} onClick={onClearFilters}
> >
{t("pages.incidents.filters.clearFilters")} {t("common.buttons.clearFilters")}
</Button> </Button>
)} )}
</Stack> </Stack>
+7 -4
View File
@@ -15,6 +15,7 @@ import { HeaderTimeRange } from "@/Components/common";
import { ControlsIncidentFilter } from "@/Pages/Incidents/Components/ControlsIncidentFilter"; import { ControlsIncidentFilter } from "@/Pages/Incidents/Components/ControlsIncidentFilter";
import { useGet } from "@/Hooks/UseApi"; import { useGet } from "@/Hooks/UseApi";
import { LAYOUT } from "@/Utils/Theme/constants";
import { useState, useEffect, useMemo } from "react"; import { useState, useEffect, useMemo } from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import type { Incident, IncidentsResponse, IncidentSummary } from "@/Types/Incident"; import type { Incident, IncidentsResponse, IncidentSummary } from "@/Types/Incident";
@@ -186,8 +187,9 @@ const IncidentsPage = () => {
{activeIncidentsCount > 0 && ( {activeIncidentsCount > 0 && (
<> <>
<Typography <Typography
variant="h6" variant="eyebrow"
sx={{ mb: theme.spacing(4), textTransform: "uppercase" }} color={theme.palette.text.secondary}
mb={theme.spacing(LAYOUT.XS)}
> >
{t("pages.incidents.table.activeIncidents")} {t("pages.incidents.table.activeIncidents")}
</Typography> </Typography>
@@ -208,8 +210,9 @@ const IncidentsPage = () => {
)} )}
<Typography <Typography
variant="h6" variant="eyebrow"
sx={{ mb: theme.spacing(4), textTransform: "uppercase" }} color={theme.palette.text.secondary}
mb={theme.spacing(LAYOUT.XS)}
> >
{t("pages.incidents.table.resolvedIncidents")} {t("pages.incidents.table.resolvedIncidents")}
</Typography> </Typography>