incidnet details

This commit is contained in:
Alex Holliday committed 2026-02-01 00:34:48 +00:00
1 parent f34520cdbf
commit 874d1b277a
6 files changed
+81 -12

No files matched your search

@@ -0,0 +1,54 @@
import Stack from "@mui/material/Stack";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";
import Divider from "@mui/material/Divider";
import Typography from "@mui/material/Typography";
import { BaseBox, ValueLabel } from "@/Components/v2/design-elements";
import { useTranslation } from "react-i18next";
import type { Monitor } from "@/Types/Monitor";
import type { Incident } from "@/Types/Incident";
import { useTheme } from "@mui/material";
interface CardDetailsProps {
incident: Incident | null;
monitor: Monitor | null;
sx?: React.CSSProperties;
}
export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
const { t } = useTranslation();
const theme = useTheme();
if (!incident) {
return null;
}
return (
<Stack gap={theme.spacing(4)}>
<Typography textTransform={"uppercase"}>
{t("pages.incidents.dialog.details.title")}
</Typography>
<BaseBox padding={8}>
<Typography textTransform={"uppercase"}>
{t("pages.incidents.dialog.details.overview")}
</Typography>
<Divider />
<Grid container>
<Grid>
<Box>
<ValueLabel
value={incident.status ? "positive" : "negative"}
text={
incident.status
? t("common.labels.active")
: t("common.labels.resolved")
}
/>
</Box>
</Grid>
</Grid>
</BaseBox>
</Stack>
);
};
@@ -1,10 +1,14 @@
import { Dialog } from "@/Components/v2/inputs";
import { CardDetails } from "@/Pages/Incidents/Components/CardDetails";
import { useTranslation } from "react-i18next";
import type { Incident } from "@/Types/Incident";
import type { Monitor } from "@/Types/Monitor";
interface DialogIncidentDetailsProps {
open: boolean;
incident: Incident | null;
monitor: Monitor | null;
onClose: () => void;
onResolve: () => void;
}
@@ -12,19 +16,15 @@ interface DialogIncidentDetailsProps {
export const DialogIncidentDetails = ({
open,
incident,
monitor,
onClose,
onResolve,
}: DialogIncidentDetailsProps) => {
const { t } = useTranslation();
if (!incident) {
return null;
}
return (
<Dialog
open={open}
title={t("pages.incidents.dialog.details.title")}
onCancel={onClose}
onConfirm={onResolve}
cancelText={t("common.buttons.cancel")}
@@ -32,7 +32,10 @@ export const DialogIncidentDetails = ({
maxWidth="md"
fullWidth
>
<pre>{JSON.stringify(incident, null, 2)}</pre>
<CardDetails
incident={incident}
monitor={monitor}
/>
</Dialog>
);
};