From d28c406c883717a225f132785bb16dc99ad7d402 Mon Sep 17 00:00:00 2001 From: Caio Cabral Date: Mon, 21 Oct 2024 19:40:13 -0400 Subject: [PATCH] feat: simplifying states --- Client/src/Pages/Monitors/Home/index.jsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/index.jsx b/Client/src/Pages/Monitors/Home/index.jsx index 8bd1d7275..345a0a88e 100644 --- a/Client/src/Pages/Monitors/Home/index.jsx +++ b/Client/src/Pages/Monitors/Home/index.jsx @@ -29,11 +29,10 @@ const Monitors = ({ isAdmin }) => { const loading = monitorState?.isLoading; const totalMonitors = monitorState?.monitorsSummary?.monitorCounts?.total; - const isTotalMonitorsUndefined = totalMonitors === undefined; - const hasMonitors = !isTotalMonitorsUndefined && totalMonitors !== 0; - const noMonitors = isTotalMonitorsUndefined || totalMonitors === 0; + + const hasMonitors = totalMonitors > 0; + const noMonitors = !hasMonitors; const canAddMonitor = isAdmin && hasMonitors; - const needsAdmin = !isAdmin && noMonitors; return ( { {noMonitors && } - {needsAdmin &&

Wait for an admin to add some monitors!

} {loading ? ( ) : (