import PropTypes from "prop-types"; import { Box, Stack, Typography } from "@mui/material"; import { useTheme } from "@emotion/react"; import { StatusLabel } from "@/Components/v1/Label/index.jsx"; import { getHumanReadableDuration } from "@/Utils/timeUtils.js"; import Icon from "@/Components/v1/Icon"; import { useTranslation } from "react-i18next"; import useGetIncidentsDuration from "../../hooks/useGetIncidentsDuration"; const IncidentItem = ({ incident }) => { const { t } = useTranslation(); const theme = useTheme(); const isActive = incident.status === true; const duration = useGetIncidentsDuration(incident, isActive); const iconWrapperStyle = { display: "flex", justifyContent: "center", mx: theme.spacing(2), color: theme.palette.primary.contrastTextTertiary, "& svg": { width: 18, height: 18, }, "& svg path": { stroke: "currentColor", strokeWidth: 1.5, }, }; return ( {incident.monitorName || t("incidentsPage.unknownMonitor")} {duration} ); }; IncidentItem.propTypes = { incident: PropTypes.shape({ _id: PropTypes.string, id: PropTypes.string, monitorId: PropTypes.string, monitorName: PropTypes.string, status: PropTypes.bool, startTime: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]), endTime: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]), resolutionType: PropTypes.oneOf(["automatic", "manual"]), }), onClick: PropTypes.func, }; export default IncidentItem;