diff --git a/src/stories/injected/CoursePopup2.stories.ts b/src/stories/injected/CourseCatalogInjectedPopup.stories.ts similarity index 52% rename from src/stories/injected/CoursePopup2.stories.ts rename to src/stories/injected/CourseCatalogInjectedPopup.stories.ts index b57f2af5..91faa2d7 100644 --- a/src/stories/injected/CoursePopup2.stories.ts +++ b/src/stories/injected/CourseCatalogInjectedPopup.stories.ts @@ -3,9 +3,8 @@ import { Course, Status } from 'src/shared/types/Course'; import { CourseMeeting, DAY_MAP } from 'src/shared/types/CourseMeeting'; import { CourseSchedule } from 'src/shared/types/CourseSchedule'; import Instructor from 'src/shared/types/Instructor'; -import { UserSchedule } from 'src/shared/types/UserSchedule'; -import CoursePopup from 'src/views/components/injected/CoursePopup/CoursePopup'; +import CourseCatalogInjectedPopup from 'src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup'; const exampleCourse: Course = new Course({ uniqueId: 50805, @@ -52,57 +51,16 @@ const exampleCourse: Course = new Course({ }, }); -// const exampleCourse: Course = new Course({ -// courseName: 'ELEMS OF COMPTRS/PROGRAMMNG-WB', -// creditHours: 3, -// department: 'C S', -// description: [ -// 'Problem solving and fundamental algorithms for various applications in science, business, and on the World Wide Web, and introductory programming in a modern object-oriented programming language.', -// 'Only one of the following may be counted: Computer Science 303E, 312, 312H. Credit for Computer Science 303E may not be earned after a student has received credit for Computer Science 314, or 314H. May not be counted toward a degree in computer science.', -// 'May be counted toward the Quantitative Reasoning flag requirement.', -// 'Designed to accommodate 100 or more students.', -// 'Taught as a Web-based course.', -// ], -// flags: ['Quantitative Reasoning'], -// fullName: 'C S 303E ELEMS OF COMPTRS/PROGRAMMNG-WB', -// instructionMode: 'Online', -// instructors: [], -// isReserved: false, -// number: '303E', -// schedule: { -// meetings: [ -// new CourseMeeting({ -// days: ['Tuesday', 'Thursday'], -// endTime: 660, -// startTime: 570, -// }), -// ], -// }, -// semester: { -// code: '12345', -// season: 'Spring', -// year: 2024, -// }, -// status: Status.CANCELLED, -// uniqueId: 12345, -// url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/', -// }); - -const exampleSchedule: UserSchedule = new UserSchedule({ - courses: [exampleCourse], - name: 'Example Schedule', -}); - -const meta: Meta = { - title: 'Components/Injected/CoursePopup2', - component: CoursePopup, +const meta: Meta = { + title: 'Components/Injected/CourseCatalogInjectedPopup', + component: CourseCatalogInjectedPopup, argTypes: { onClose: { action: 'onClose' }, }, }; export default meta; -type Story = StoryObj; +type Story = StoryObj; export const Default: Story = { args: { diff --git a/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx new file mode 100644 index 00000000..0dfe7e26 --- /dev/null +++ b/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx @@ -0,0 +1,24 @@ +import Popup from '@views/components/common/Popup/Popup'; +import React from 'react'; +import { Course } from 'src/shared/types/Course'; +import { UserSchedule } from 'src/shared/types/UserSchedule'; +import Description from './Description'; +import GradeDistribution from './GradeDistribution'; +import HeadingAndActions from './HeadingAndActions'; + +interface CourseCatalogInjectedPopupProps { + course: Course; + activeSchedule?: UserSchedule; + onClose: () => void; +} + +const CourseCatalogInjectedPopup: React.FC = ({ course, activeSchedule, onClose }) => ( + +
+ + + +
+
+); +export default CourseCatalogInjectedPopup; diff --git a/src/views/components/injected/CoursePopup/CoursePopupDescriptions.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx similarity index 81% rename from src/views/components/injected/CoursePopup/CoursePopupDescriptions.tsx rename to src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx index 8690b15a..0d8bb118 100644 --- a/src/views/components/injected/CoursePopup/CoursePopupDescriptions.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx @@ -2,11 +2,11 @@ import clsx from 'clsx'; import React from 'react'; import Text from '../../common/Text/Text'; -interface CoursePopupDescriptionsProps { +interface DescriptionProps { lines: string[]; } -const CoursePopupDescriptions: React.FC = ({ lines }: CoursePopupDescriptionsProps) => { +const Description: React.FC = ({ lines }: DescriptionProps) => { const keywords = ['prerequisite', 'restricted']; return (
    @@ -27,4 +27,4 @@ const CoursePopupDescriptions: React.FC = ({ lines ); }; -export default CoursePopupDescriptions; +export default Description; diff --git a/src/views/components/injected/CoursePopup/CoursePopupGradeDistribution.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx similarity index 97% rename from src/views/components/injected/CoursePopup/CoursePopupGradeDistribution.tsx rename to src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx index 982584ae..aadb75e7 100644 --- a/src/views/components/injected/CoursePopup/CoursePopupGradeDistribution.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx @@ -12,7 +12,7 @@ import { } from 'src/views/lib/database/queryDistribution'; import colors from 'src/views/styles/colors.module.scss'; -interface CoursePopupGradeDistributionProps { +interface GradeDistributionProps { course: Course; } @@ -74,7 +74,7 @@ function reducer(state: State, action: Action): State { } } -const CoursePopupGradeDistribution: React.FC = ({ course }) => { +const GradeDistribution: React.FC = ({ course }) => { const [state, dispatch] = React.useReducer(reducer, initialState); const ref = React.useRef(null); @@ -201,4 +201,4 @@ const CoursePopupGradeDistribution: React.FC ); }; -export default CoursePopupGradeDistribution; +export default GradeDistribution; diff --git a/src/views/components/injected/CoursePopup/CoursePopupHeadingAndActions.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx similarity index 92% rename from src/views/components/injected/CoursePopup/CoursePopupHeadingAndActions.tsx rename to src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx index 1501f22a..84763259 100644 --- a/src/views/components/injected/CoursePopup/CoursePopupHeadingAndActions.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx @@ -15,7 +15,7 @@ import Description from '~icons/material-symbols/description'; import Mood from '~icons/material-symbols/mood'; import Reviews from '~icons/material-symbols/reviews'; -interface CourseHeadingAndActionsProps { +interface HeadingAndActionProps { /* The course to display */ course: Course; /* The active schedule */ @@ -27,10 +27,10 @@ interface CourseHeadingAndActionsProps { /** * Renders the heading component for the CoursePopup component. * - * @param {CourseHeadingAndActionsProps} props - The component props. + * @param {HeadingAndActionProps} props - The component props. * @returns {JSX.Element} The rendered component. */ -const CourseHeadingAndActions = ({ course, onClose, activeSchedule }: CourseHeadingAndActionsProps) => { +const HeadingAndActions: React.FC = ({ course, onClose, activeSchedule }) => { const { courseName, department, number: courseNumber, uniqueId, instructors, flags, schedule } = course; const instructorString = instructors .map(instructor => { @@ -58,9 +58,10 @@ const CourseHeadingAndActions = ({ course, onClose, activeSchedule }: CourseHead // TODO (achadaga): not implemented }; + // open past syllabi for the course + // not specific to professor const handleOpenPastSyllabi = async () => { - const firstInstructor = instructors[0]; - const url = `https://utdirect.utexas.edu/apps/student/coursedocs/nlogon/?year=&semester=&department=${department}&course_number=${courseNumber}&course_title=${courseName}&unique=&instructor_first=${firstInstructor.firstName}&instructor_last=${firstInstructor.lastName}&course_type=In+Residence&search=Search`; + const url = `https://utdirect.utexas.edu/apps/student/coursedocs/nlogon/?year=&semester=&department=${department}&course_number=${courseNumber}&course_title=${courseName}&unique=&instructor_first=&instructor_last=&course_type=In+Residence&search=Search`; await openNewTab(url); }; @@ -135,4 +136,4 @@ const CourseHeadingAndActions = ({ course, onClose, activeSchedule }: CourseHead ); }; -export default CourseHeadingAndActions; +export default HeadingAndActions; diff --git a/src/views/components/injected/CoursePopup/CoursePopup.tsx b/src/views/components/injected/CoursePopup/CoursePopup.tsx deleted file mode 100644 index 9ce6796a..00000000 --- a/src/views/components/injected/CoursePopup/CoursePopup.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import Popup from '@views/components/common/Popup/Popup'; -import React from 'react'; -import { Course } from 'src/shared/types/Course'; -import { UserSchedule } from 'src/shared/types/UserSchedule'; -import CoursePopupDescriptions from './CoursePopupDescriptions'; -import CoursePopupGradeDistribution from './CoursePopupGradeDistribution'; -import CoursePopupHeadingAndActions from './CoursePopupHeadingAndActions'; - -interface CoursePopup2Props { - course: Course; - activeSchedule?: UserSchedule; - onClose: () => void; -} - -const CoursePopup = ({ course, activeSchedule, onClose }: CoursePopup2Props) => ( - -
    - - - -
    -
    -); -export default CoursePopup;