fix monitorStatusHeader name, safe property access

This commit is contained in:
Alex Holliday committed 2025-01-29 11:37:49 -08:00
1 parent c55ca3f593
commit a90ed64a6f
1 file changed
+5 -5
@@ -8,7 +8,7 @@ import ConfigButton from "./ConfigButton";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const MonitorHeader = ({ shouldRender = true, isAdmin, monitor }) => { const MonitorStatusHeader = ({ shouldRender = true, isAdmin, monitor }) => {
const theme = useTheme(); const theme = useTheme();
const { statusColor, statusMsg, determineState } = useUtils(); const { statusColor, statusMsg, determineState } = useUtils();
if (!shouldRender) { if (!shouldRender) {
@@ -21,7 +21,7 @@ const MonitorHeader = ({ shouldRender = true, isAdmin, monitor }) => {
justifyContent="space-between" justifyContent="space-between"
> >
<Stack> <Stack>
<Typography variant="h1">{monitor.name}</Typography> <Typography variant="h1">{monitor?.name}</Typography>
<Stack <Stack
direction="row" direction="row"
alignItems={"center"} alignItems={"center"}
@@ -39,16 +39,16 @@ const MonitorHeader = ({ shouldRender = true, isAdmin, monitor }) => {
</Stack> </Stack>
<ConfigButton <ConfigButton
shouldRender={isAdmin} shouldRender={isAdmin}
monitorId={monitor._id} monitorId={monitor?._id}
/> />
</Stack> </Stack>
); );
}; };
MonitorHeader.propTypes = { MonitorStatusHeader.propTypes = {
shouldRender: PropTypes.bool, shouldRender: PropTypes.bool,
isAdmin: PropTypes.bool, isAdmin: PropTypes.bool,
monitor: PropTypes.object, monitor: PropTypes.object,
}; };
export default MonitorHeader; export default MonitorStatusHeader;