From e6f524f5d3ea143ea027df0c69aff7d670bf5fdf Mon Sep 17 00:00:00 2001 From: Daniel Cojocea Date: Wed, 31 Jul 2024 18:58:41 -0400 Subject: [PATCH] Added modal to remove monitor function --- Client/src/Pages/Monitors/Configure/index.css | 5 +- Client/src/Pages/Monitors/Configure/index.jsx | 54 +++++++++++++++++-- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/Client/src/Pages/Monitors/Configure/index.css b/Client/src/Pages/Monitors/Configure/index.css index ab52b028a..a594348ab 100644 --- a/Client/src/Pages/Monitors/Configure/index.css +++ b/Client/src/Pages/Monitors/Configure/index.css @@ -12,6 +12,9 @@ .configure-monitor .MuiSelect-select { color: var(--env-var-color-5); } +.configure-monitor .MuiModal-root h2.MuiTypography-root { + color: var(--env-var-color-1); +} .configure-monitor p.MuiTypography-root, .configure-monitor .MuiSelect-select { font-size: var(--env-var-font-size-medium); @@ -51,7 +54,7 @@ position: absolute; top: 100%; } -.configure-monitor .MuiInputBase-root:has(> .Mui-disabled){ +.configure-monitor .MuiInputBase-root:has(> .Mui-disabled) { background-color: var(--env-var-color-13); } diff --git a/Client/src/Pages/Monitors/Configure/index.jsx b/Client/src/Pages/Monitors/Configure/index.jsx index 31faf2c63..fab29e8fe 100644 --- a/Client/src/Pages/Monitors/Configure/index.jsx +++ b/Client/src/Pages/Monitors/Configure/index.jsx @@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux"; import { useEffect, useState } from "react"; import Button from "../../../Components/Button"; import Field from "../../../Components/Inputs/Field"; -import { Box, Stack, Typography } from "@mui/material"; +import { Box, Modal, Stack, Typography } from "@mui/material"; import WestRoundedIcon from "@mui/icons-material/WestRounded"; import GreenCheck from "../../../assets/icons/checkbox-green.svg?react"; import RedCheck from "../../../assets/icons/checkbox-red.svg?react"; @@ -147,9 +147,9 @@ const Configure = () => { } }; - const hanldeRemove = async (event) => { + const [isOpen, setIsOpen] = useState(false); + const handleRemove = async (event) => { event.preventDefault(); - // TODO add confirm const action = await dispatch(deleteUptimeMonitor({ authToken, monitor })); if (action.meta.requestStatus === "fulfilled") { navigate("/monitors"); @@ -249,7 +249,7 @@ const Configure = () => { boxShadow: "none", px: theme.gap.ml, }} - onClick={hanldeRemove} + onClick={() => setIsOpen(true)} /> @@ -380,6 +380,52 @@ const Configure = () => { /> + setIsOpen(false)} + disablePortal + > + + + Really delete this monitor? + + + Once deleted, this monitor cannot be retrieved back. + + +