Skip to content

Commit

Permalink
feat: Add admin manual CheckInReady toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
trillium committed Jul 18, 2023
1 parent 224433a commit 565ef6e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
8 changes: 8 additions & 0 deletions client/src/components/manageProjects/editMeetingTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ const EditMeetingTimes = ({
};
}

if ("checkInReady" in values) {
theUpdatedEvent = {
...theUpdatedEvent,
checkInReady: values.checkInReady,
};
}

updateRecurringEvent(theUpdatedEvent, eventID);
setEventAlert("Event updated!")
await setTimeout(() => {
Expand Down Expand Up @@ -149,6 +156,7 @@ const EditMeetingTimes = ({
eventEndTime={selectedEvent.endTime}
eventDuration={selectedEvent.duration}
videoConferenceLink={selectedEvent.videoConferenceLink}
checkInReady={selectedEvent.checkInReady}
formErrors={formErrors}
handleEventUpdate={handleEventUpdate}
handleEventDelete={handleEventDelete}
Expand Down
30 changes: 19 additions & 11 deletions client/src/components/manageProjects/editProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const EditProject = ({
recurringEvents
// eslint-disable-next-line no-underscore-dangle
.filter((e) => e?.project?._id === projectToEdit._id)
.map((item) => readableEvent(item))
.map((item) => ({...item, ...readableEvent(item)}))
.sort((a, b) => a.dayOfTheWeekNumber - b.dayOfTheWeekNumber)
);
}
Expand Down Expand Up @@ -181,16 +181,7 @@ const EditProject = ({
<ul>
{rEvents.map((event) => (
// eslint-disable-next-line no-underscore-dangle
<li key={`${event.event_id}`}>
<button type="button" onClick={() => setSelectedEvent(event)}>
<div>{event.name}</div>
<div className="event-list-details">
{`${event.dayOfTheWeek}, ${event.startTime} - ${event.endTime}; ${event.eventType}`}
<div className="edit-icon"><EditIcon /></div>
</div>
<div className="event-list-description">{`${event.description}`}</div>
</button>
</li>
<RecurringEvent event={event} setSelectedEvent={setSelectedEvent} />
))}
</ul>
</div>
Expand All @@ -207,4 +198,21 @@ const EditProject = ({
);
};

function RecurringEvent({event, setSelectedEvent}) {

return (
<li key={`${event.event_id}`}>
<button type="button" onClick={() => {console.log(event);setSelectedEvent(event)}}>
<div>{event.name}</div>
<div className="event-list-details">
{`${event.dayOfTheWeek}, ${event.startTime} - ${event.endTime}; ${event.eventType}`}
<div className="edit-icon"><EditIcon /></div>
</div>
<div className="event-list-description">{`Can uses check into this event now?: ${event.checkInReady ? "Yes" : "No"}`}</div>
<div className="event-list-description">{`${event.description}`}</div>
</button>
</li>
)
}

export default EditProject;
8 changes: 8 additions & 0 deletions client/src/components/manageProjects/editableMeeting.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const EditableMeeting = ({
handleEventDelete,
formErrors,
videoConferenceLink = '',
checkInReady,
}) => {
// *** Initialization Station ***
const initialUpdateFormValues = {
Expand Down Expand Up @@ -76,6 +77,13 @@ const EditableMeeting = ({
>
DELETE
</button>
<button
type="button"
className="create-form-button"
onClick={handleEventUpdate(eventId, {checkInReady: !checkInReady})}
>
ToggleCheckIn({!checkInReady ? "Yes" : "No"})
</button>
</div>
</EventForm>
);
Expand Down

0 comments on commit 565ef6e

Please sign in to comment.