From 2dd142324dc59874c0eea0c8e4f43f1c0163b20b Mon Sep 17 00:00:00 2001 From: awlfccamp Date: Thu, 10 Oct 2024 13:15:47 -0500 Subject: [PATCH 1/2] adapt ValidatedTextField to accept custom validation functions --- client/src/components/ProjectForm.jsx | 16 +++- .../parts/form/ValidatedTextField.jsx | 91 ++++++++++--------- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/client/src/components/ProjectForm.jsx b/client/src/components/ProjectForm.jsx index d0c4efc05..4a35628f8 100644 --- a/client/src/components/ProjectForm.jsx +++ b/client/src/components/ProjectForm.jsx @@ -22,6 +22,7 @@ import { ReactComponent as PlusIcon } from '../svg/PlusIcon.svg'; import ValidatedTextField from './parts/form/ValidatedTextField'; import TitledBox from './parts/boxes/TitledBox'; import ChangesModal from './ChangesModal'; +import { simpleInputs, additionalInputsForEdit } from './data'; /** STYLES * -most TextField and InputLabel styles are controlled by the theme @@ -249,7 +250,7 @@ export default function ProjectForm({ isEdit ? submitEditProject(data) : submitNewProject(data); })} > - {arr.map((input) => ( + {simpleInputs.map((input) => ( ))} + {isEdit && + additionalInputsForEdit.map((input) => ( + + ))} - - - - {input.label} - + + + + + {input.label} + + + {input.name === 'location' && locationRadios} - {input.name === 'location' && locationRadios} - - - + + ); -}; +} -export default ValidatedTextField; \ No newline at end of file +export default ValidatedTextField; From bf4501cdb5d7913472e34305c3ab2e93e39d5bfa Mon Sep 17 00:00:00 2001 From: awlfccamp Date: Sun, 16 Feb 2025 09:21:37 -0600 Subject: [PATCH 2/2] add paper to form for styling --- client/src/components/ProjectForm.jsx | 77 +++++++++++++++------------ 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/client/src/components/ProjectForm.jsx b/client/src/components/ProjectForm.jsx index 4a35628f8..45a2bf166 100644 --- a/client/src/components/ProjectForm.jsx +++ b/client/src/components/ProjectForm.jsx @@ -12,6 +12,7 @@ import { FormControl, FormControlLabel, RadioGroup, + Paper, } from '@mui/material'; import { styled } from '@mui/material/styles'; @@ -236,34 +237,26 @@ export default function ProjectForm({ Project Management - {auth.user.accessLevel === 'admin' ? ( - - ) : ( - - )} -
{ - isEdit ? submitEditProject(data) : submitNewProject(data); - })} + - {simpleInputs.map((input) => ( - - ))} - {isEdit && - additionalInputsForEdit.map((input) => ( + ) : ( + + )} + + { + isEdit ? submitEditProject(data) : submitNewProject(data); + })} + > + {simpleInputs.map((input) => ( ))} - - + {isEdit && + additionalInputsForEdit.map((input) => ( + + ))} + + +
{auth.user.accessLevel === 'admin' ? (