Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new fields to edit project form #1527

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions client/src/components/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ export const simpleInputs = [
name: 'name',
type: 'text',
placeholder: 'Enter project name',
disabled: false
},
{
label: 'Project Description',
name: 'description',
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',
Expand All @@ -23,35 +25,79 @@ 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
},
];
];

export const additionalInputsForEdit = [
{
label: 'Partners',
name: 'partners',
type: 'text',
placeholder: 'partners',
disabled: false
},
{
label: 'Managed by Users',
name: 'managedByUsers',
type: 'text',
placeholder: 'Managed by Users',
disabled: false
},
{
label: 'Project Status',
name: 'projectStatus',
type: 'text',
placeholder: 'Project Status',
disabled: false
},
{
label: 'Google Drive ID',
name: 'googleDriveId',
type: 'text',
placeholder: 'htttps://drive.google.com/',
disabled: false
},
{
label: 'Created Date',
name: 'createdDate',
type: 'text',
placeholder: 'Created Date',
disabled: true
}
]
9 changes: 7 additions & 2 deletions client/src/components/manageProjects/editProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -92,7 +97,7 @@ const EditProject = ({
/>
</div>
<ProjectForm
arr={simpleInputs}
arr={[...simpleInputs, ...additionalInputsForEdit]}
bkmorgan3 marked this conversation as resolved.
Show resolved Hide resolved
formData={formData}
projectToEdit={projectToEdit}
isEdit={true}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/parts/form/ValidatedTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
/>
</Box>
);
Expand Down
Loading