From 9b18bd61e709f309d5796bb8f1d7268d5b4a2fe1 Mon Sep 17 00:00:00 2001 From: Xavier Lien Date: Sun, 1 Dec 2024 17:01:55 -0500 Subject: [PATCH] Remove existing lecture in calendar on hover --- apps/frontend/src/components/ScheduleCalendar.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/frontend/src/components/ScheduleCalendar.tsx b/apps/frontend/src/components/ScheduleCalendar.tsx index eb744d8..8b16305 100644 --- a/apps/frontend/src/components/ScheduleCalendar.tsx +++ b/apps/frontend/src/components/ScheduleCalendar.tsx @@ -155,6 +155,8 @@ const getEvents = (CourseDetails: Course[], selectedSemester: string, selectedSe const hoverSection = selectedCourse?.schedules?.find(sched => sessionToString(sched) === selectedSemester) ?.sections.find(section => section.name === hoverSession["Section"]); + events = events.filter(event => event.title.slice(0, courseID.length) !== courseID); + const hoverColor = getCalendarColorLight(`${selectedSessions[courseID]?.Color}`) || ""; if (hoverLecture) events.push(...getTimes(courseID, hoverLecture.name || "Lecture", hoverLecture.times, hoverColor));