From 920bf536eafaa5335e95ecfbc1a14b64b5fc1e64 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 11 Oct 2023 13:13:50 -0700 Subject: [PATCH 1/2] add new fields to edit project form --- client/src/components/data.js | 35 ++++++++++++++++++- .../components/manageProjects/editProject.js | 4 +-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/client/src/components/data.js b/client/src/components/data.js index c5e7a27b..ad609c17 100644 --- a/client/src/components/data.js +++ b/client/src/components/data.js @@ -54,4 +54,37 @@ export const simpleInputs = [ type: 'text', placeholder: 'htttps://hackforla.org/projects/', }, -]; \ No newline at end of file +]; + +export const additionalInputsForEdit = [ + { + label: 'Partners', + name: 'partners', + type: 'text', + placeholder: 'partners', + }, + { + label: 'Managed by Users', + name: 'mangedByUsers', + type: 'text', + placeholder: 'Managed by Users' + }, + { + label: 'Project Status', + name: 'projectStatus', + type: 'text', + placeholder: 'Project Status' + }, + { + label: 'Google Drive ID', + name: 'googleDriveId', + type: 'text', + placeholder: 'htttps://drive.google.com/', + }, + { + label: 'Created at', + name: 'createdAt', + type: 'text', + placeholder: 'Created At' + } +] \ No newline at end of file diff --git a/client/src/components/manageProjects/editProject.js b/client/src/components/manageProjects/editProject.js index 399bc3ab..b626087c 100644 --- a/client/src/components/manageProjects/editProject.js +++ b/client/src/components/manageProjects/editProject.js @@ -3,7 +3,7 @@ import EditMeetingTimes from './editMeetingTimes'; import CreateNewEvent from './createNewEvent'; import readableEvent from './utilities/readableEvent'; import ProjectForm from '../ProjectForm'; -import { simpleInputs } from '../data'; +import { simpleInputs, additionalInputsForEdit } from '../data'; import TitledBox from '../parts/boxes/TitledBox'; import { ReactComponent as EditIcon } from '../../svg/Icon_Edit.svg'; @@ -92,7 +92,7 @@ const EditProject = ({ /> Date: Wed, 18 Oct 2023 14:02:17 -0700 Subject: [PATCH 2/2] fix typos, prettiyfy date, disable createdDate editing --- client/src/components/data.js | 27 ++++++++++++++----- .../components/manageProjects/editProject.js | 5 ++++ .../parts/form/ValidatedTextField.js | 2 +- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/client/src/components/data.js b/client/src/components/data.js index ad609c17..ca37540b 100644 --- a/client/src/components/data.js +++ b/client/src/components/data.js @@ -5,6 +5,7 @@ export const simpleInputs = [ name: 'name', type: 'text', placeholder: 'Enter project name', + disabled: false }, { label: 'Project Description', @@ -12,7 +13,8 @@ export const simpleInputs = [ type: 'textarea', placeholder: 'Enter project description', value: /^[a-zA-Z0-9].{0,250}$/, - errorMessage: 'Description must start with alphanumeric characters, 250 char limit' + errorMessage: 'Description must start with alphanumeric characters, 250 char limit', + disabled: false }, { label: 'Location', @@ -23,36 +25,42 @@ export const simpleInputs = [ errorMessage: 'Please enter a valid Zoom URL', addressValue: '', addressError: 'Invalid address', + disabled: false }, { label: 'GitHub Identifier', name: 'githubIdentifier', type: 'text', placeholder: 'Enter GitHub identifier', + disabled: false }, { label: 'GitHub URL', name: 'githubUrl', type: 'text', placeholder: 'htttps://github.com/', + disabled: false }, { label: 'Slack Channel Link', name: 'slackUrl', type: 'text', placeholder: 'htttps://slack.com/', + disabled: false }, { label: 'Google Drive URL', name: 'googleDriveUrl', type: 'text', placeholder: 'htttps://drive.google.com/', + disabled: false }, { label: 'HFLA Website URL', name: 'hflaWebsiteUrl', type: 'text', placeholder: 'htttps://hackforla.org/projects/', + disabled: false }, ]; @@ -62,29 +70,34 @@ export const additionalInputsForEdit = [ name: 'partners', type: 'text', placeholder: 'partners', + disabled: false }, { label: 'Managed by Users', - name: 'mangedByUsers', + name: 'managedByUsers', type: 'text', - placeholder: 'Managed by Users' + placeholder: 'Managed by Users', + disabled: false }, { label: 'Project Status', name: 'projectStatus', type: 'text', - placeholder: 'Project Status' + placeholder: 'Project Status', + disabled: false }, { label: 'Google Drive ID', name: 'googleDriveId', type: 'text', placeholder: 'htttps://drive.google.com/', + disabled: false }, { - label: 'Created at', - name: 'createdAt', + label: 'Created Date', + name: 'createdDate', type: 'text', - placeholder: 'Created At' + placeholder: 'Created Date', + disabled: true } ] \ No newline at end of file diff --git a/client/src/components/manageProjects/editProject.js b/client/src/components/manageProjects/editProject.js index b626087c..886d0a22 100644 --- a/client/src/components/manageProjects/editProject.js +++ b/client/src/components/manageProjects/editProject.js @@ -31,6 +31,11 @@ const EditProject = ({ slackUrl: projectToEdit.slackUrl, googleDriveUrl: projectToEdit.googleDriveUrl, hflaWebsiteUrl: projectToEdit.hflaWebsiteUrl, + partners: projectToEdit.partners, + managedByUsers: projectToEdit.managedByUsers, + projectStatus: projectToEdit.projectStatus, + googleDriveId: projectToEdit.googleDriveId, + createdDate: new Date(projectToEdit.createdDate) }); // eslint-disable-next-line no-unused-vars diff --git a/client/src/components/parts/form/ValidatedTextField.js b/client/src/components/parts/form/ValidatedTextField.js index b6fc6c5b..1e8bc96d 100644 --- a/client/src/components/parts/form/ValidatedTextField.js +++ b/client/src/components/parts/form/ValidatedTextField.js @@ -61,7 +61,7 @@ function ValidatedTextField({ type={input.type} placeholder={input.placeholder} helperText={`${errors[input.name]?.message || ' '}`} - disabled={isEdit ? !editMode : undefined} // handles edit mode for EditProjcet form + disabled={isEdit ? !editMode || input.disabled : undefined} // handles edit mode for EditProjcet form /> );