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 event_type field to Edit Events tab for hackathons #265

Merged
merged 4 commits into from
Dec 26, 2024
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: 47 additions & 3 deletions pages/[id]/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default function Events({ id, hackathons }) {
<TableData>{props.title}</TableData>
<TableData>{props.date}</TableData>
<TableData>{props.points}</TableData>
<TableData>{props.type}</TableData>
<TableData>{props.lastModified}</TableData>
<TableData actions>
<ActionsButtonContainer>
Expand Down Expand Up @@ -178,6 +179,7 @@ export default function Events({ id, hackathons }) {
<TableHeader>Event</TableHeader>
<TableHeader>Date</TableHeader>
<TableHeader narrow>Points</TableHeader>
<TableHeader>Event Type</TableHeader>
<TableHeader>Last Modified</TableHeader>
<TableHeader>Actions</TableHeader>
</TableRow>
Expand All @@ -190,6 +192,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}
Expand Down Expand Up @@ -224,14 +227,34 @@ export default function Events({ id, hackathons }) {
}}
/>
</ModalContent>
<ModalContent columns={2}>
<ModalContent columns={3}>
<div>
<Label>Date</Label>
<DateTimePicker
selected={newEvent.date}
onChange={date => handleInput('date', date, newEvent, setNewEvent)}
/>
</div>
<ModalField
dropdown
dropdownOptions={[
{
label: 'main',
},
{
label: 'workshops',
},
{
label: 'minievents',
},
]}
label="Type"
value={newEvent.type}
modalAction={NEW}
onChange={type => {
handleInput('type', type.label, newEvent, setNewEvent)
}}
/>
<ModalField
label="Points"
modalAction={NEW}
Expand All @@ -253,9 +276,10 @@ export default function Events({ id, hackathons }) {
<ModalContent columns={1}>
<ModalField label="Description" value={eventViewing.text} modalAction={VIEW} />
</ModalContent>
<ModalContent columns={2}>
<ModalContent columns={3}>
<ModalField label="Date" value={eventViewing.date} modalAction={VIEW} />
<ModalField label="Points" value={eventViewing.points} modalAction={VIEW} />
<ModalField label="Event Type" value={eventViewing.type} modalAction={VIEW} />
</ModalContent>
</Modal>
{/* Modal for editing event */}
Expand Down Expand Up @@ -286,7 +310,7 @@ export default function Events({ id, hackathons }) {
}}
/>
</ModalContent>
<ModalContent columns={2}>
<ModalContent columns={3}>
<div>
<Label>Date</Label>
<DateTimePicker
Expand All @@ -302,6 +326,26 @@ export default function Events({ id, hackathons }) {
handleInput('points', event.target.value, eventEditing, setEventEditing)
}}
/>
<ModalField
dropdown
dropdownOptions={[
{
label: 'main',
},
{
label: 'workshops',
},
{
label: 'minievents',
},
]}
label="Type"
value={eventEditing.type}
modalAction={EDIT}
onChange={type => {
handleInput('type', type.label, eventEditing, setEventEditing)
}}
/>
</ModalContent>
</Modal>
{/* Confirmation modal before deleting event */}
Expand Down
1 change: 1 addition & 0 deletions utility/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || 'minievents',
lastModified: data.lastModified ? formatDate(data.lastModified.seconds) : formatDate(getTimestamp().seconds),
lastModifiedBy: data.lastModifiedBy || 'Unknown user',
}
Expand Down
2 changes: 2 additions & 0 deletions utility/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down