From 43b7666a552e4662b508940b1930b37595a8b6c0 Mon Sep 17 00:00:00 2001 From: Daniel Pan <57362494+daniel-panhead@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:45:46 -0700 Subject: [PATCH 1/4] Add event_type field to Edit Events tab for hackathons --- pages/[id]/events.js | 51 +++++++++++++++++++++++++++++++++++++++++--- utility/firebase.js | 1 + 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/pages/[id]/events.js b/pages/[id]/events.js index fa7a1188..3c709ade 100644 --- a/pages/[id]/events.js +++ b/pages/[id]/events.js @@ -27,6 +27,7 @@ import { getTimestamp, updateEvent, } from '../../utility/firebase' +import Dropdown from '../../components/dropdown' export default function Events({ id, hackathons }) { const [events, setEvents] = useState([]) @@ -121,6 +122,7 @@ export default function Events({ id, hackathons }) { {props.title} {props.date} {props.points} + {props.type} {props.lastModified} @@ -178,6 +180,7 @@ export default function Events({ id, hackathons }) { Event Date Points + Event Type Last Modified Actions @@ -190,6 +193,7 @@ export default function Events({ id, hackathons }) { title={events[curr].title} text={events[curr].text} points={events[curr].points} + type={events[curr].type} date={events[curr].date} lastModified={events[curr].lastModified} lastModifiedBy={events[curr].lastModifiedBy} @@ -224,7 +228,7 @@ export default function Events({ id, hackathons }) { }} /> - +
handleInput('date', date, newEvent, setNewEvent)} />
+ { + handleInput('type', type.label, newEvent, setNewEvent) + }} + />
- + + {/* Modal for editing event */} @@ -286,7 +311,7 @@ export default function Events({ id, hackathons }) { }} /> - +
+ { + handleInput('type', type.label, eventEditing, setEventEditing) + }} + /> {/* Confirmation modal before deleting event */} diff --git a/utility/firebase.js b/utility/firebase.js index 062259ef..cad78080 100644 --- a/utility/firebase.js +++ b/utility/firebase.js @@ -123,6 +123,7 @@ export const getEvent = (eventID, data) => { text: data.text || 'Empty text description for event', date: data.date ? formatDate(data.date.seconds) : formatDate(getTimestamp().seconds), points: data.points >= 0 ? data.points : '0', + type: data.type || 'activities', lastModified: data.lastModified ? formatDate(data.lastModified.seconds) : formatDate(getTimestamp().seconds), lastModifiedBy: data.lastModifiedBy || 'Unknown user', } From 3fd0077b15141a4a20fd030e4b5873c3672bfaed Mon Sep 17 00:00:00 2001 From: Daniel Pan <57362494+daniel-panhead@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:47:11 -0700 Subject: [PATCH 2/4] Set default event type to minevents --- utility/firebase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utility/firebase.js b/utility/firebase.js index cad78080..6f9e6b7b 100644 --- a/utility/firebase.js +++ b/utility/firebase.js @@ -123,7 +123,7 @@ export const getEvent = (eventID, data) => { text: data.text || 'Empty text description for event', date: data.date ? formatDate(data.date.seconds) : formatDate(getTimestamp().seconds), points: data.points >= 0 ? data.points : '0', - type: data.type || 'activities', + type: data.type || 'minievents', lastModified: data.lastModified ? formatDate(data.lastModified.seconds) : formatDate(getTimestamp().seconds), lastModifiedBy: data.lastModifiedBy || 'Unknown user', } From f8d92ec8f3ab982fd1bf0bb3fec58f97c3c5f54f Mon Sep 17 00:00:00 2001 From: Daniel Pan <57362494+daniel-panhead@users.noreply.github.com> Date: Wed, 23 Oct 2024 00:46:32 -0700 Subject: [PATCH 3/4] Remove unused import from events.js --- pages/[id]/events.js | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/[id]/events.js b/pages/[id]/events.js index 3c709ade..9a5b99eb 100644 --- a/pages/[id]/events.js +++ b/pages/[id]/events.js @@ -27,7 +27,6 @@ import { getTimestamp, updateEvent, } from '../../utility/firebase' -import Dropdown from '../../components/dropdown' export default function Events({ id, hackathons }) { const [events, setEvents] = useState([]) From 99e21517718345cd74eebd368cc2668044498fa9 Mon Sep 17 00:00:00 2001 From: Daniel Pan <57362494+daniel-panhead@users.noreply.github.com> Date: Wed, 6 Nov 2024 00:27:13 -0800 Subject: [PATCH 4/4] Add attended events column to applicants firebase queries --- utility/utilities.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utility/utilities.js b/utility/utilities.js index 73184b0a..c52874c3 100644 --- a/utility/utilities.js +++ b/utility/utilities.js @@ -109,6 +109,8 @@ export const filterHackerInfoFields = (obj, collection) => { newObj.longAnswers1 = obj.skills?.longAnswers1 || false newObj.longAnswers2 = obj.skills?.longAnswers2 || false newObj.longAnswers3 = obj.skills?.longAnswers3 || false + + newObj.attendedEvents = obj.dayOf?.events?.map(e => e.eventName).join(', ') ?? '' } else if (collection === 'Projects') { newObj = { ...obj } delete newObj.grades