Bunch of renaming

This commit is contained in:
Abhinav Chadaga
2024-02-18 17:36:59 -06:00
parent 925829ad41
commit 1ac1d9095a
6 changed files with 42 additions and 83 deletions

View File

@@ -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<typeof CoursePopup> = {
title: 'Components/Injected/CoursePopup2',
component: CoursePopup,
const meta: Meta<typeof CourseCatalogInjectedPopup> = {
title: 'Components/Injected/CourseCatalogInjectedPopup',
component: CourseCatalogInjectedPopup,
argTypes: {
onClose: { action: 'onClose' },
},
};
export default meta;
type Story = StoryObj<typeof CoursePopup>;
type Story = StoryObj<typeof CourseCatalogInjectedPopup>;
export const Default: Story = {
args: {

View File

@@ -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<CourseCatalogInjectedPopupProps> = ({ course, activeSchedule, onClose }) => (
<Popup overlay className='max-w-[780px] px-6' onClose={onClose}>
<div className='flex flex-col'>
<HeadingAndActions course={course} onClose={onClose} activeSchedule={activeSchedule} />
<Description lines={course.description} />
<GradeDistribution course={course} />
</div>
</Popup>
);
export default CourseCatalogInjectedPopup;

View File

@@ -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<CoursePopupDescriptionsProps> = ({ lines }: CoursePopupDescriptionsProps) => {
const Description: React.FC<DescriptionProps> = ({ lines }: DescriptionProps) => {
const keywords = ['prerequisite', 'restricted'];
return (
<ul className='my-[5px] space-y-1.5 children:marker:text-ut-burntorange'>
@@ -27,4 +27,4 @@ const CoursePopupDescriptions: React.FC<CoursePopupDescriptionsProps> = ({ lines
);
};
export default CoursePopupDescriptions;
export default Description;

View File

@@ -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<CoursePopupGradeDistributionProps> = ({ course }) => {
const GradeDistribution: React.FC<GradeDistributionProps> = ({ course }) => {
const [state, dispatch] = React.useReducer(reducer, initialState);
const ref = React.useRef<HighchartsReact.RefObject>(null);
@@ -201,4 +201,4 @@ const CoursePopupGradeDistribution: React.FC<CoursePopupGradeDistributionProps>
);
};
export default CoursePopupGradeDistribution;
export default GradeDistribution;

View File

@@ -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<HeadingAndActionProps> = ({ 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;

View File

@@ -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) => (
<Popup overlay className='max-w-[780px] px-6' onClose={onClose}>
<div className='flex flex-col'>
<CoursePopupHeadingAndActions course={course} onClose={onClose} activeSchedule={activeSchedule} />
<CoursePopupDescriptions lines={course.description} />
<CoursePopupGradeDistribution course={course} />
</div>
</Popup>
);
export default CoursePopup;