Have used the already created callback.

This commit is contained in:
Owaise Imdad committed 2025-05-21 23:23:09 +05:30
1 parent deec5a096e
commit 36ae38391b
1 file changed
+13 -18
+13 -18
View File
@@ -37,6 +37,7 @@ import NotificationIntegrationModal from "../../../Components/NotificationIntegr
import { usePauseMonitor } from "../../../Hooks/useMonitorControls"; import { usePauseMonitor } from "../../../Hooks/useMonitorControls";
import PauseOutlinedIcon from "@mui/icons-material/PauseOutlined"; import PauseOutlinedIcon from "@mui/icons-material/PauseOutlined";
import PlayArrowOutlinedIcon from "@mui/icons-material/PlayArrowOutlined"; import PlayArrowOutlinedIcon from "@mui/icons-material/PlayArrowOutlined";
import { useMonitorUtils } from "../../../Hooks/useMonitorUtils";
/** /**
* Parses a URL string and returns a URL object. * Parses a URL string and returns a URL object.
@@ -214,28 +215,22 @@ const Configure = () => {
}; };
const statusColor = { const statusColor = {
true: theme.palette.success.main, up: theme.palette.success.main,
false: theme.palette.error.main, down: theme.palette.error.main,
undefined: theme.palette.warning.main, paused: theme.palette.error.main,
pending: theme.palette.warning.main,
}; };
const statusMsg = { const statusMsg = {
pause: "Monitoring is paused.", paused: "Monitoring is paused.",
true: "Your site is up.", up: "Your site is up.",
false: "Your site is down.", down: "Your site is down.",
undefined: "Pending...", pending: "Pending...",
}; };
const getStatusColor = (monitor) => { const { determineState } = useMonitorUtils();
if (monitor?.isActive === false || monitor?.status == false) return "false";
return monitor?.isActive || String(monitor?.status);
};
const getStatusMsg = (monitor) => { console.log(determineState(monitor));
if (monitor?.isActive === false) return "pause";
if (monitor?.status === false) return "false";
return monitor?.isActive || String(monitor?.status);
};
const { t } = useTranslation(); const { t } = useTranslation();
@@ -280,7 +275,7 @@ const Configure = () => {
gap={theme.spacing(2)} gap={theme.spacing(2)}
> >
<Tooltip <Tooltip
title={statusMsg[getStatusMsg(monitor)]} title={statusMsg[determineState(monitor)]}
disableInteractive disableInteractive
slotProps={{ slotProps={{
popper: { popper: {
@@ -296,7 +291,7 @@ const Configure = () => {
}} }}
> >
<Box> <Box>
<PulseDot color={statusColor[getStatusColor(monitor)]} /> <PulseDot color={statusColor[determineState(monitor)]} />
</Box> </Box>
</Tooltip> </Tooltip>
<Typography <Typography