From deec5a096e3be56a577893ee3aea29a8b51f871f Mon Sep 17 00:00:00 2001 From: Owaise Imdad Date: Wed, 21 May 2025 22:55:34 +0530 Subject: [PATCH] Made the code more readable by separation of tasks. --- client/src/Pages/Uptime/Configure/index.jsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/src/Pages/Uptime/Configure/index.jsx b/client/src/Pages/Uptime/Configure/index.jsx index 3586e61b4..4f1a571c4 100644 --- a/client/src/Pages/Uptime/Configure/index.jsx +++ b/client/src/Pages/Uptime/Configure/index.jsx @@ -101,7 +101,6 @@ const Configure = () => { const action = await dispatch(getUptimeMonitorById({ monitorId })); if (getUptimeMonitorById.fulfilled.match(action)) { const monitor = action.payload.data; - console.log("Monitor fetched: ", monitor); setMonitor(monitor); } else if (getUptimeMonitorById.rejected.match(action)) { throw new Error(action.error.message); @@ -221,11 +220,23 @@ const Configure = () => { }; const statusMsg = { + pause: "Monitoring is paused.", true: "Your site is up.", false: "Your site is down.", undefined: "Pending...", }; + const getStatusColor = (monitor) => { + if (monitor?.isActive === false || monitor?.status == false) return "false"; + return monitor?.isActive || String(monitor?.status); + }; + + const getStatusMsg = (monitor) => { + if (monitor?.isActive === false) return "pause"; + if (monitor?.status === false) return "false"; + return monitor?.isActive || String(monitor?.status); + }; + const { t } = useTranslation(); return ( @@ -269,7 +280,7 @@ const Configure = () => { gap={theme.spacing(2)} > { }} > - +