From 920bf536eafaa5335e95ecfbc1a14b64b5fc1e64 Mon Sep 17 00:00:00 2001 From: Brad Date: Wed, 11 Oct 2023 13:13:50 -0700 Subject: [PATCH 1/7] 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/7] 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 /> ); From 9e124ecf0dc435ae81b940fca3934bc8849dd820 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Mon, 30 Oct 2023 16:37:52 -0700 Subject: [PATCH 3/7] feat: Move logic to helper function & resolve bug - Base event time off of event.startTime rather than event.date --- backend/workers/createRecurringEvents.js | 74 +++++++++++++----------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/backend/workers/createRecurringEvents.js b/backend/workers/createRecurringEvents.js index a1228c36..4867ac90 100644 --- a/backend/workers/createRecurringEvents.js +++ b/backend/workers/createRecurringEvents.js @@ -60,45 +60,14 @@ module.exports = (cron, fetch) => { // forEach function with async/await. for (filteredEvent of filteredEvents) { const eventExists = await checkIfEventExists(filteredEvent.name); - // console.log('Event exists? ', eventExists); - const eventDate = new Date(filteredEvent.date); if (eventExists) { + //Do nothing console.log("Not going to run ceateEvent"); } else { // Create new event - const hours = eventDate.getHours(); - const minutes = eventDate.getMinutes(); - const seconds = eventDate.getSeconds(); - const milliseconds = eventDate.getMilliseconds(); - - const yearToday = TODAY_DATE.getFullYear(); - const monthToday = TODAY_DATE.getMonth(); - const dateToday = TODAY_DATE.getDate(); - - const newEventDate = new Date(yearToday, monthToday, dateToday, hours, minutes, seconds, milliseconds); - - const newEndTime = new Date(yearToday, monthToday, dateToday, hours + filteredEvent.hours, minutes, seconds, milliseconds) - - const eventToCreate = { - name: filteredEvent.name && filteredEvent.name, - hacknight: filteredEvent.hacknight && filteredEvent.hacknight, - eventType: filteredEvent.eventType && filteredEvent.eventType, - description: filteredEvent.eventDescription && filteredEvent.eventDescription, - project: filteredEvent.project && filteredEvent.project, - date: filteredEvent.date && newEventDate, - startTime: filteredEvent.startTime && newEventDate, - endTime: filteredEvent.endTime && newEndTime, - hours: filteredEvent.hours && filteredEvent.hours - } - if (filteredEvent.hasOwnProperty("location")) { - eventToCreate.location = { - city: filteredEvent.location.city ? filteredEvent.location.city : 'REMOTE', - state: filteredEvent.location.state ? filteredEvent.location.state : 'REMOTE', - country: filteredEvent.location.country ? filteredEvent.location.country : 'REMOTE' - }; - } - + const eventToCreate = generateEventData(filteredEvent); + const created = await createEvent(eventToCreate); console.log(created); }; @@ -106,6 +75,43 @@ module.exports = (cron, fetch) => { }; }; + function generateEventData(eventData, TODAY_DATE = new Date()) { + const eventDate = new Date(eventData.startTime); + // Create new event + const hours = eventDate.getHours(); + const minutes = eventDate.getMinutes(); + const seconds = eventDate.getSeconds(); + const milliseconds = eventDate.getMilliseconds(); + + const yearToday = TODAY_DATE.getFullYear(); + const monthToday = TODAY_DATE.getMonth(); + const dateToday = TODAY_DATE.getDate(); + + const newEventDate = new Date(yearToday, monthToday, dateToday, hours, minutes, seconds, milliseconds); + + const newEndTime = new Date(yearToday, monthToday, dateToday, hours + filteredEvent.hours, minutes, seconds, milliseconds) + + const eventToCreate = { + name: eventData.name && eventData.name, + hacknight: eventData.hacknight && eventData.hacknight, + eventType: eventData.eventType && eventData.eventType, + description: eventData.eventDescription && eventData.eventDescription, + project: eventData.project && eventData.project, + date: eventData.date && newEventDate, + startTime: eventData.startTime && newEventDate, + endTime: eventData.endTime && newEndTime, + hours: eventData.hours && eventData.hours + } + if (eventData.hasOwnProperty("location")) { + eventToCreate.location = { + city: eventData.location.city ? eventData.location.city : 'REMOTE', + state: eventData.location.state ? eventData.location.state : 'REMOTE', + country: eventData.location.country ? eventData.location.country : 'REMOTE' + }; + } + return eventToCreate + }; + async function checkIfEventExists(eventName) { const events = EVENTS; // const today = new Date(); From 6d373a32a6e67bedcae2427e32cc7287bf66d7a4 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Sun, 5 Nov 2023 13:57:38 -0800 Subject: [PATCH 4/7] feat: Add emojis to create/not create console.logs --- backend/workers/createRecurringEvents.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/workers/createRecurringEvents.js b/backend/workers/createRecurringEvents.js index 4867ac90..3eef5fbf 100644 --- a/backend/workers/createRecurringEvents.js +++ b/backend/workers/createRecurringEvents.js @@ -63,13 +63,13 @@ module.exports = (cron, fetch) => { if (eventExists) { //Do nothing - console.log("Not going to run ceateEvent"); + console.log("➖ Not going to run ceateEvent"); } else { // Create new event const eventToCreate = generateEventData(filteredEvent); const created = await createEvent(eventToCreate); - console.log(created); + console.log("➕", created); }; }; }; From 8a56f1c6cd7472435c1ddf0e6d9cf7e92c09cd1c Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Fri, 10 Nov 2023 12:58:57 -0800 Subject: [PATCH 5/7] fix: Handle event.date being undefined in closeCheckins --- backend/workers/closeCheckins.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/workers/closeCheckins.js b/backend/workers/closeCheckins.js index d2c64d20..9d04cd7d 100644 --- a/backend/workers/closeCheckins.js +++ b/backend/workers/closeCheckins.js @@ -28,6 +28,12 @@ module.exports = (cron, fetch) => { if (events && events.length > 0) { const sortedEvents = events.filter(event => { + if (!event.date) { + // handle if event date is null/undefined + // false meaning don't include in sortedEvents + return false + } + const currentTimeISO = new Date().toISOString(); const threeHoursFromStartTime = new Date(event.date).getTime() + 10800000; const threeHoursISO = new Date(threeHoursFromStartTime).toISOString(); From 27df8a44da1b7512ff95bf032eba1a509cc510e4 Mon Sep 17 00:00:00 2001 From: freaky4wrld Date: Sun, 12 Nov 2023 11:34:39 +0530 Subject: [PATCH 6/7] feat(UI): added UI rendering feature if no meetings available --- client/src/pages/Home.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/client/src/pages/Home.js b/client/src/pages/Home.js index e64a6f4b..3e90abd8 100644 --- a/client/src/pages/Home.js +++ b/client/src/pages/Home.js @@ -49,7 +49,7 @@ const Home = () => {

Volunteer Relationship Management System

- {events && events.length >= 1 && ( + {events && events.length > 0 ? (
{
- )} + ):(
{/* If no events with checkInReady: true */} - {events.length === 0 && } - + {/* If no meetings available*/} +

No meetings available

+ +
+ )} {/* If any events with checkInReady: true */} {events.length > 0 && ( - +
+ +
)} - ); }; From 96b4195c1b591fa98f35e2fd5b8d8d32039bddfe Mon Sep 17 00:00:00 2001 From: freaky4wrld Date: Mon, 13 Nov 2023 11:38:55 +0530 Subject: [PATCH 7/7] feat (UI): rendered in the UI if no meeting is scheduled --- client/src/pages/Home.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/pages/Home.js b/client/src/pages/Home.js index 3e90abd8..48e1df04 100644 --- a/client/src/pages/Home.js +++ b/client/src/pages/Home.js @@ -90,7 +90,7 @@ const Home = () => {
{/* If no events with checkInReady: true */} {/* If no meetings available*/} -

No meetings available

+

No meetings available

)}