From 4740e66c30c6e78fc57877f4fb31febe47bedd27 Mon Sep 17 00:00:00 2001 From: nora-zajzon Date: Mon, 9 Sep 2024 19:23:10 -0700 Subject: [PATCH] added MUI modal to edit times --- .../manageProjects/editMeetingTimes.jsx | 90 +++++++++++++------ 1 file changed, 61 insertions(+), 29 deletions(-) diff --git a/client/src/components/manageProjects/editMeetingTimes.jsx b/client/src/components/manageProjects/editMeetingTimes.jsx index 655fabb8b..9f4af1473 100644 --- a/client/src/components/manageProjects/editMeetingTimes.jsx +++ b/client/src/components/manageProjects/editMeetingTimes.jsx @@ -1,4 +1,5 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; +import { Modal, Box, Typography, Button } from '@mui/material'; import '../../sass/ManageProjects.scss'; import { useSnackbar } from '../../context/snackbarContext'; import EditableMeeting from './editableMeeting'; @@ -17,6 +18,20 @@ const EditMeetingTimes = ({ }) => { const [formErrors, setFormErrors] = useState({}); const { showSnackbar } = useSnackbar(); + const [open, setOpen] = useState(false); + + useEffect(() => { + if (selectedEvent) { + setOpen(true); + } + }, [selectedEvent]); + + const handleClose = () => { + setOpen(false); + setFormErrors(null); + setSelectedEvent(null); + }; + const handleEventUpdate = ( eventID, values, @@ -80,47 +95,64 @@ const EditMeetingTimes = ({ updateRecurringEvent(theUpdatedEvent, eventID); showSnackbar("Recurring event updated", 'info') - setSelectedEvent(null); + handleClose(); } setFormErrors(errors); }; const handleEventDelete = (eventID) => async () => { deleteRecurringEvent(eventID); - setSelectedEvent(null); showSnackbar("Recurring event deleted", 'info'); + handleClose(); }; return (
- - {selectedEvent && ( - - )} + + + Edit Meeting Times + + {selectedEvent && ( + + )} + + +
); }; + export default EditMeetingTimes; \ No newline at end of file