import React from 'react'; import { Course, Status } from 'src/shared/types/Course'; import { CourseMeeting } from 'src/shared/types/CourseMeeting'; import ClosedIcon from '~icons/material-symbols/lock'; import WaitlistIcon from '~icons/material-symbols/timelapse'; import CancelledIcon from '~icons/material-symbols/warning'; import Text from '../Text/Text'; export interface CalendarCourseCellProps { /** The Course that the meeting is for. */ course: Course; /* index into course meeting array to display */ meetingIdx?: number; /** The background color for the course. */ color: string; } const CalendarCourseCell: React.FC = ({ course, meetingIdx }: CalendarCourseCellProps) => { let meeting: CourseMeeting | null = meetingIdx !== undefined ? course.schedule.meetings[meetingIdx] : null; let rightIcon: React.ReactNode | null = null; if (course.status === Status.WAITLISTED) { rightIcon = ; } else if (course.status === Status.CLOSED) { rightIcon = ; } else if (course.status === Status.CANCELLED) { rightIcon = ; } return (
{course.department} {course.number} - {course.instructors[0].lastName} {`${meeting.getTimeString({ separator: '–', capitalize: true })}${ meeting.location ? ` – ${meeting.location.building}` : '' }`}
{rightIcon && (
{rightIcon}
)}
); }; export default CalendarCourseCell;