From 36e549815569f6b88f91b631d0d0bbbd45b66bf6 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 6 Feb 2025 09:43:11 -0800 Subject: [PATCH] this PR adds a confirmation modal to the delete status page button --- Client/src/Components/Dialog/index.jsx | 10 ++++---- .../Components/ControlsHeader/index.jsx | 16 ++++++------ Client/src/Pages/StatusPage/Status/index.jsx | 25 ++++++++++++++++--- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/Client/src/Components/Dialog/index.jsx b/Client/src/Components/Dialog/index.jsx index 97d822e84..3cf7001ce 100644 --- a/Client/src/Components/Dialog/index.jsx +++ b/Client/src/Components/Dialog/index.jsx @@ -1,18 +1,19 @@ import PropTypes from "prop-types"; -import LoadingButton from "@mui/lab/LoadingButton"; import { Button, Stack } from "@mui/material"; import { GenericDialog } from "./genericDialog"; +import { useTheme } from "@emotion/react"; const Dialog = ({ title, description, open, - theme, onCancel, confirmationButtonLabel, onConfirm, isLoading, }) => { + const theme = useTheme(); + return ( Cancel - {confirmationButtonLabel} - + ); @@ -51,7 +52,6 @@ Dialog.propTypes = { title: PropTypes.string.isRequired, description: PropTypes.string, open: PropTypes.bool.isRequired, - theme: PropTypes.object.isRequired, onCancel: PropTypes.func.isRequired, confirmationButtonLabel: PropTypes.string.isRequired, onConfirm: PropTypes.func.isRequired, diff --git a/Client/src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx b/Client/src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx index ef8419069..11733fc61 100644 --- a/Client/src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx +++ b/Client/src/Pages/StatusPage/Status/Components/ControlsHeader/index.jsx @@ -9,7 +9,7 @@ import { useNavigate } from "react-router-dom"; import { useLocation } from "react-router-dom"; import PropTypes from "prop-types"; -const Controls = ({ deleteStatusPage, isDeleting }) => { +const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting }) => { const theme = useTheme(); const location = useLocation(); const currentPath = location.pathname; @@ -17,7 +17,6 @@ const Controls = ({ deleteStatusPage, isDeleting }) => { if (currentPath === "/status/public") { return null; } - return ( {