diff --git a/client/src/Components/v2/inputs/Dialog.tsx b/client/src/Components/v2/inputs/Dialog.tsx index 6e0c5f9a6..12831d4c4 100644 --- a/client/src/Components/v2/inputs/Dialog.tsx +++ b/client/src/Components/v2/inputs/Dialog.tsx @@ -45,7 +45,7 @@ export const DialogInput = ({ maxWidth={maxWidth} fullWidth={fullWidth} > - {title} + {title && {title}} {content && {content}} {children} diff --git a/client/src/Pages/Incidents/Components/CardDetails.tsx b/client/src/Pages/Incidents/Components/CardDetails.tsx new file mode 100644 index 000000000..16f2f98a3 --- /dev/null +++ b/client/src/Pages/Incidents/Components/CardDetails.tsx @@ -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 ( + + + {t("pages.incidents.dialog.details.title")} + + + + {t("pages.incidents.dialog.details.overview")} + + + + + + + + + + + + + ); +}; diff --git a/client/src/Pages/Incidents/Components/SummaryCard.tsx b/client/src/Pages/Incidents/Components/CardSummary.tsx similarity index 100% rename from client/src/Pages/Incidents/Components/SummaryCard.tsx rename to client/src/Pages/Incidents/Components/CardSummary.tsx diff --git a/client/src/Pages/Incidents/Components/DialogIncidentDetails.tsx b/client/src/Pages/Incidents/Components/DialogIncidentDetails.tsx index 6d68b8eb3..fdab8d969 100644 --- a/client/src/Pages/Incidents/Components/DialogIncidentDetails.tsx +++ b/client/src/Pages/Incidents/Components/DialogIncidentDetails.tsx @@ -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 ( -
{JSON.stringify(incident, null, 2)}
+
); }; diff --git a/client/src/Pages/Incidents/index.tsx b/client/src/Pages/Incidents/index.tsx index 6dc49a85a..5addfc12d 100644 --- a/client/src/Pages/Incidents/index.tsx +++ b/client/src/Pages/Incidents/index.tsx @@ -4,7 +4,7 @@ import { SummaryCardActiveIncidents, SummaryCardLatestIncidents, SummaryCardStats, -} from "@/Pages/Incidents/Components/SummaryCard"; +} from "@/Pages/Incidents/Components/CardSummary"; import { IncidentsTable } from "@/Pages/Incidents/Components/IncidentTable"; import { DialogResolution } from "@/Pages/Incidents/Components/DialogResolution"; import { DialogIncidentDetails } from "@/Pages/Incidents/Components/DialogIncidentDetails"; @@ -35,6 +35,9 @@ const IncidentsPage = () => { // Details dialog state const [isDetailsDialogOpen, setIsDetailsDialogOpen] = useState(false); const [selectedIncident, setSelectedIncident] = useState(null); + const [selectedIncidentMonitor, setSelectedIncidentMonitor] = useState( + null + ); // Build incidents URL with query params const incidentsUrl = useMemo(() => { @@ -100,13 +103,16 @@ const IncidentsPage = () => { const handleOpenDetails = (incidentId: string) => { const incident = incidents.find((i) => i.id === incidentId) ?? null; - setSelectedIncident(incident); + const monitor = monitorsData?.find((m) => m.id === incident?.monitorId) ?? null; setIsDetailsDialogOpen(true); + setSelectedIncident(incident); + setSelectedIncidentMonitor(monitor); }; const handleDetailsClose = () => { setIsDetailsDialogOpen(false); setSelectedIncident(null); + setSelectedIncidentMonitor(null); }; const handleDetailsResolve = () => { @@ -169,6 +175,7 @@ const IncidentsPage = () => { diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 03aa429d0..1f9d3d39e 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -6,7 +6,9 @@ "details": "Details" }, "labels": { - "responseTime": "Response time" + "responseTime": "Response time", + "active": "Active", + "resolved": "Resolved" }, "buttons": { "toggleTheme": "Toggles light & dark", @@ -21,6 +23,7 @@ "save": "Save", "test": "Test" }, + "alerts": { "pageSpeedApiKey": { "content": "Warning: You haven't added a Google PageSpeed API key yet. Visit Settings to add one. Without it, the PageSpeed monitor won't function." @@ -373,6 +376,7 @@ "avgResolutionTime": "Average resolution time" } }, + "table": { "headers": { "startTime": "Start Time", @@ -392,8 +396,9 @@ }, "dialog": { "details": { - "title": "Incident Details", - "resolve": "Resolve Incident" + "title": "Incident details", + "resolve": "Resolve Incident", + "overview": "Overview" } } }