This commit is contained in:
2024-02-20 22:06:52 -06:00
3 changed files with 53 additions and 49 deletions

View File

@@ -119,7 +119,7 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Pr
</div>
))}
{grid.map((row, rowIndex) => row)}
{courseCells ? accountForCourseConflicts(courseCells) : null}
{courseCells ? <AccountForCourseConflicts courseCells={courseCells}/> : null}
{/* courseCells.map((block: CalendarGridCourse) => (
<div
key={`${block}`}
@@ -142,7 +142,11 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Pr
export default CalendarGrid;
function accountForCourseConflicts(courseCells: CalendarGridCourse[]): JSX.Element[] {
interface AccountForCourseConflictsProps {
courseCells: CalendarGridCourse[];
}
function AccountForCourseConflicts({ courseCells }: AccountForCourseConflictsProps): JSX.Element[] {
// Groups by dayIndex to identify overlaps
const days = courseCells.reduce((acc, cell: CalendarGridCourse) => {
const { dayIndex } = cell.calendarGridPoint;