Skip to content

Commit

Permalink
Change title on calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
rlho committed Jan 17, 2024
1 parent d65ad9f commit 06e8e59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ export const Calendars = ({
googleCalendarApiKey={apiKey}
events={{ googleCalendarId: room.calendarId }}
eventDidMount={function (info) {
// Change the title status only
const match = info.event.title.match(/\[(.*?)\]/);
if (match) {
info.el.querySelector('.fc-event-title').textContent =
match[1];
}
// Change the background color of the event depending on its title
if (info.event.title.includes('REQUESTED')) {
info.el.style.backgroundColor = '#d60000';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const SheetEditor = () => {
)?.calendarId;
const calendarEventId = await serverFunctions.addEventToCalendar(
roomCalendarId,
`[REQUESTED] ${room.roomId} ${data.firstName} ${data.lastName} (${data.netId})`,
`[REQUESTED] ${room.roomId} ${data.department} - ${data.firstName} ${data.lastName} (${data.netId})`,
'Your reservation is not yet confirmed. The coordinator will review and finalize your reservation within a few days.',
bookInfo.startStr,
bookInfo.endStr,
Expand Down Expand Up @@ -216,9 +216,7 @@ const SheetEditor = () => {
});
}
});
alert(
"Your request has been sent.\n Please check the calendar to verify that your submitted event has been registered.\n If you don't see the event, please contact us."
);
alert('Your request has been sent.');
setLoading(false);
setSection('selectRoom');
});
Expand Down

0 comments on commit 06e8e59

Please sign in to comment.