diff --git a/Client/src/Components/Button/Button.jsx b/Client/src/Components/Button/Button.jsx index 727a3d941..0756cda1b 100644 --- a/Client/src/Components/Button/Button.jsx +++ b/Client/src/Components/Button/Button.jsx @@ -47,7 +47,6 @@ const levelConfig = { const Button = ({ level, label, disabled, img, sx }) => { const { variant, color } = levelConfig[level]; - console.log(img); return ( { - console.log(monitors); + const [monitorStates, setMonitorStates] = useState( + monitors.map((monitor) => monitor.isActive) + ); + + useEffect(() => { + console.log("Monitor states updated", monitorStates); + // Update DB here + }, [monitorStates]); + + const handleMonitor = (monitorIndex) => { + setMonitorStates((prevStates) => { + const newStates = [...prevStates]; + newStates[monitorIndex] = !newStates[monitorIndex]; + + return newStates; + // Need to update DB with new monitor state + }); + }; const theme = useTheme(); return ( <> @@ -66,7 +84,7 @@ const Section = ({ monitors }) => { > Servers List