import React from 'react'; import { Course } from 'src/shared/types/Course'; import Add from '~icons/material-symbols/add'; import CalendarMonth from '~icons/material-symbols/calendar-month'; import Close from '~icons/material-symbols/close'; import Copy from '~icons/material-symbols/content-copy'; import Description from '~icons/material-symbols/description'; import Mood from '~icons/material-symbols/mood'; import Reviews from '~icons/material-symbols/reviews'; import { Button } from '../../common/Button/Button'; import { Chip, flagMap } from '../../common/Chip/Chip'; import Divider from '../../common/Divider/Divider'; import Text from '../../common/Text/Text'; interface CourseHeadingAndActionsProps { /* The course to display */ course: Course; /* The function to call when the popup should be closed */ onClose: () => void; } /** * Renders the heading component for the CoursePopup component. * * @param {CourseHeadingAndActionsProps} props - The component props. * @returns {JSX.Element} The rendered component. */ const CourseHeadingAndActions = ({ course, onClose }: CourseHeadingAndActionsProps) => { const { courseName, department, number, uniqueId, instructors, flags, schedule } = course; const instructorString = instructors .map(instructor => { const firstInitial = instructor.firstName.length > 0 ? `${instructor.firstName.charAt(0)}. ` : ''; return `${firstInitial}${instructor.lastName}`; }) .join(', '); const handleCopy = () => { navigator.clipboard.writeText(uniqueId.toString()); }; return (
{courseName} ({department} {number}) {/* need to do handlers */}
with {instructorString}
{flags.map(flag => ( ))}
{schedule.meetings.map(meeting => ( {meeting.getDaysString({ format: 'long', separator: 'long' })}{' '} {meeting.getTimeString({ separator: ' to ', capitalize: false })} {meeting.location && ( <> {` in `} {meeting.location.building} )} ))}
); }; export default CourseHeadingAndActions;