diff --git a/client/src/components/ProjectForm.js b/client/src/components/ProjectForm.js index 34df40c8b..9ff63055c 100644 --- a/client/src/components/ProjectForm.js +++ b/client/src/components/ProjectForm.js @@ -64,7 +64,7 @@ export default function ProjectForm({ formData, projectToEdit, isEdit, - setFormData + setFormData, }) { const history = useHistory(); @@ -74,11 +74,11 @@ export default function ProjectForm({ const [editMode, setEditMode] = useState(false); const { auth } = useAuth(); const [isModalOpen, setIsModalOpen] = useState(false); - const handleOpen = () => setIsModalOpen(true) - const handleClose = () => setIsModalOpen(false) + const handleOpen = () => setIsModalOpen(true); + const handleClose = () => setIsModalOpen(false); const checkFields = () => { - history.push("/projects") - } + history.push('/projects'); + }; /** * React Hook Forms @@ -95,7 +95,7 @@ export default function ProjectForm({ handleSubmit, reset, formState: { errors }, - control + control, } = useForm({ mode: 'all', // Holds the current project data in state. @@ -104,7 +104,7 @@ export default function ProjectForm({ }, }); - const { dirtyFields } = useFormState({control}) + const { dirtyFields } = useFormState({ control }); // ----------------- Submit requests ----------------- @@ -134,8 +134,6 @@ export default function ProjectForm({ setEditMode(false); }; - - // ----------------- Handles and Toggles ----------------- // Handles the location radio button change. @@ -229,46 +227,51 @@ export default function ProjectForm({ Project Management - + ) : ( + + )} +
{ + isEdit ? submitEditProject(data) : submitNewProject(data); + })} > - - { - isEdit ? submitEditProject(data) : submitNewProject(data); - })} - > - - {arr.map((input) => ( - - ))} - ( + + ))} + - + + {auth.user.accessLevel === 'admin' ? ( @@ -279,14 +282,20 @@ export default function ProjectForm({ Close -
+ ) : ( + '' + )} ) : ( diff --git a/client/src/components/parts/boxes/TitledBox.js b/client/src/components/parts/boxes/TitledBox.js index 3d248991d..2bfbd11a5 100644 --- a/client/src/components/parts/boxes/TitledBox.js +++ b/client/src/components/parts/boxes/TitledBox.js @@ -2,27 +2,25 @@ import React from 'react'; import { Box, Typography, Divider } from '@mui/material'; export default function TitledBox({ title, children, badge, childrenBoxSx }) { - return ( - - - - - {title} - - - {badge} - - - {children} + return ( + + + + + {title} + - ); - - -} \ No newline at end of file + {badge ? badge : ' '} + + + {children} + + ); +}