import type { Course } from '@shared/types/Course'; import { saveAsCal, saveCalAsPng } from '@views/components/calendar/utils'; import { Button } from '@views/components/common/Button'; import Divider from '@views/components/common/Divider'; import Text from '@views/components/common/Text/Text'; import type { CalendarGridCourse } from '@views/hooks/useFlattenedCourseSchedule'; import clsx from 'clsx'; import React from 'react'; import CalendarMonthIcon from '~icons/material-symbols/calendar-month'; import ImageIcon from '~icons/material-symbols/image'; import CalendarCourseBlock from './CalendarCourseCell'; type CalendarBottomBarProps = { courseCells?: CalendarGridCourse[]; setCourse: React.Dispatch>; }; /** * Renders the bottom bar of the calendar component. * * @param {Object[]} courses - The list of courses to display in the calendar. * @returns {JSX.Element} The rendered bottom bar component. */ export default function CalendarBottomBar({ courseCells, setCourse }: CalendarBottomBarProps): JSX.Element { const asyncCourseCells = courseCells?.filter(block => block.async); const displayCourses = asyncCourseCells && asyncCourseCells.length > 0; return (
{displayCourses && ( <> Async/Other:
{asyncCourseCells.map(block => { const { courseDeptAndInstr, status, colors, className } = block.componentProps; return ( setCourse(block.course)} /> ); })}
)}
{displayCourses && }
); }