import Stack from "@mui/material/Stack";
import Grid from "@mui/material/Grid";
import Divider from "@mui/material/Divider";
import Typography from "@mui/material/Typography";
import { BaseBox, ValueLabel, StatusCodeLabel } from "@/Components/design-elements";
import { LAYOUT } from "@/Utils/Theme/constants";
import { useTranslation } from "react-i18next";
import type { Incident } from "@/Types/Incident";
import type { Monitor } from "@/Types/Monitor";
import { useTheme } from "@mui/material";
import { useSelector } from "react-redux";
import type { RootState } from "@/Types/state";
import { formatDateWithTz } from "@/Utils/TimeUtils";
import { getIncidentsDuration } from "@/Pages/Incidents/utils";
interface CardDetailsProps {
incident: Incident | null;
monitor: Monitor | null;
sx?: object;
}
const SectionHeading = ({ children }: { children: React.ReactNode }) => {
const theme = useTheme();
return (
{children}
);
};
const Cell = ({ children }: { children: React.ReactNode }) => (
{children}
);
export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
const { t } = useTranslation();
const theme = useTheme();
const uiTimezone = useSelector((state: RootState) => state.ui.timezone);
if (!incident) {
return null;
}
return (
{t("pages.incidents.dialog.details.title")}
{t("pages.incidents.dialog.details.overview")}
| {t("pages.incidents.dialog.details.status")} |
{monitor && (
<>
{t("pages.incidents.dialog.details.monitor")} |
{monitor.name ?? "N/A"} |
{t("pages.incidents.dialog.details.url")} |
{monitor.url ?? "N/A"} |
>
)}
{t("pages.incidents.dialog.details.analysis")}
{t("pages.incidents.dialog.details.timeline")} |
{t("pages.incidents.dialog.details.detailsLabel")} |
{t("pages.incidents.dialog.details.startedAt")} |
{formatDateWithTz(incident.startTime, "D MMM YYYY, h:mm A", uiTimezone)}
|
{t("pages.incidents.dialog.details.statusCode")} |
|
{t("pages.incidents.dialog.details.downtime")} |
{getIncidentsDuration(incident)} |
{t("pages.incidents.dialog.details.message")} |
{incident.message ?? "N/A"} |
{!incident.status && (
{t("pages.incidents.dialog.details.resolutionDetails")}
{t("pages.incidents.dialog.details.resolvedAt")} |
{incident.endTime
? formatDateWithTz(incident.endTime, "D MMM YYYY, h:mm A", uiTimezone)
: "N/A"}
|
{t("pages.incidents.dialog.details.resolutionType")} |
{incident.resolutionType
? t(
`pages.incidents.dialog.details.resolutionTypes.${incident.resolutionType}`
)
: "N/A"}
|
{incident.resolvedBy && (
<>
{t("pages.incidents.dialog.details.resolvedBy")} |
{incident.resolvedByEmail ?? incident.resolvedBy} |
>
)}
{incident.comment && (
<>
{t("pages.incidents.dialog.details.comment")} |
{incident.comment} |
>
)}
)}
);
};