Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: abhinavchadaga/course-catalog-popup #128

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
874f8d5
some work
abhinavchadaga Feb 14, 2024
31bcef3
Merge branch 'main' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 14, 2024
43d2675
some work on course popup
abhinavchadaga Feb 17, 2024
a62b718
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 17, 2024
9cb13c8
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 17, 2024
2eea01f
use chip component in header
abhinavchadaga Feb 17, 2024
19b124b
complete CourseHeaderAndActions Component
abhinavchadaga Feb 17, 2024
122fc6d
Change test course to 314
abhinavchadaga Feb 17, 2024
f9f3755
Add rmp callback
abhinavchadaga Feb 17, 2024
f2dfcec
some unocss updates
abhinavchadaga Feb 17, 2024
11b7a51
add course button onclick handlers
abhinavchadaga Feb 17, 2024
4c2b31e
add todo for calendar button
abhinavchadaga Feb 17, 2024
1a89432
Rename CoursePopup
abhinavchadaga Feb 17, 2024
7afdbac
description stuff done
abhinavchadaga Feb 17, 2024
c27bf3c
Modify story to use proper course info
abhinavchadaga Feb 18, 2024
ddfe952
Add Grade Distribution Stuff
abhinavchadaga Feb 18, 2024
747ee44
Minor tweaks
abhinavchadaga Feb 18, 2024
f2e5d51
Add TODO
abhinavchadaga Feb 18, 2024
925829a
Fix syllabi url
abhinavchadaga Feb 18, 2024
1ac1d90
Bunch of renaming
abhinavchadaga Feb 18, 2024
c16b301
Kinda complete the handlers
abhinavchadaga Feb 19, 2024
11a50df
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 19, 2024
36bcdd2
change grade distribution colors to match updated figma
abhinavchadaga Feb 20, 2024
c46e4a5
change from reducer pattern to state variables, remove chartData from…
abhinavchadaga Feb 20, 2024
ac10257
add additional story
abhinavchadaga Feb 20, 2024
13c7d3b
disabled add when course is not open
abhinavchadaga Feb 20, 2024
02d4c89
use array fill
abhinavchadaga Feb 20, 2024
d14a6dd
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 22, 2024
308e837
Some changes with the instructor names
abhinavchadaga Feb 22, 2024
1963543
trying to get the CES stuff to work
abhinavchadaga Feb 22, 2024
369be43
CES button is working
abhinavchadaga Feb 23, 2024
6ba6404
remove a todo
abhinavchadaga Feb 23, 2024
a49be44
add actual color for dminus
abhinavchadaga Feb 23, 2024
65277f1
fix description, start no distribution state
abhinavchadaga Feb 23, 2024
272909b
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 23, 2024
c42b428
post merge fixes
abhinavchadaga Feb 23, 2024
1ca9c70
small fixes
abhinavchadaga Feb 23, 2024
c906164
fix: import as type
abhinavchadaga Feb 23, 2024
7a8e276
fix: some better typescript stuff i think
abhinavchadaga Feb 23, 2024
3fd4ab0
fix: manifest.ts
abhinavchadaga Feb 23, 2024
cd8b8f4
fix: pr feedback
abhinavchadaga Feb 25, 2024
72cf15e
fix: remove old CoursePopup component
abhinavchadaga Feb 26, 2024
0424885
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Feb 26, 2024
c1ab888
Merge branch 'hackathon' into abhinavchadaga/course-catalog-popup
abhinavchadaga Mar 4, 2024
8676b48
fix: course catalog injected popup story should useScott's 314 class …
abhinavchadaga Mar 4, 2024
d1111ba
fix: build error in background.ts:
abhinavchadaga Mar 4, 2024
71435ed
chore: run eslint autofix on CourseCatalogInjectedPopup.stories.ts
abhinavchadaga Mar 4, 2024
25c98a8
chore: run prettier on CourseCatalogInjectedPopup.stories.ts
abhinavchadaga Mar 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 53 additions & 105 deletions src/stories/injected/CourseCatalogInjectedPopup.stories.ts
Original file line number Diff line number Diff line change
@@ -1,111 +1,59 @@
/* eslint-disable storybook/story-exports */
// import { UserSchedule } from '@shared/types/UserSchedule';
// import type { Meta, StoryObj } from '@storybook/react';
// import CourseCatalogInjectedPopup from '@views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup';
import type { Course } from '@shared/types/Course';
import { Status } from '@shared/types/Course';
import { UserSchedule } from '@shared/types/UserSchedule';
import type { Meta, StoryObj } from '@storybook/react';
import CourseCatalogInjectedPopup from '@views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup';

// import { exampleCourse } from './mocked';
import { bevoCourse, bevoScheule, MikeScottCS314Course, MikeScottCS314Schedule } from './mocked';

// const exampleSchedule: UserSchedule = new UserSchedule({
// courses: [exampleCourse],
// name: 'Example Schedule',
// hours: 0,
// });
// TODO (achadaga): import this after
// https://github.com/Longhorn-Developers/UT-Registration-Plus/pull/106 is merged
// const bevoCourse: Course = new Course({
// uniqueId: 47280,
// number: '311C',
// fullName: "BVO 311C BEVO'S SEMINAR LONGHORN CARE",
// courseName: "BEVO'S SEMINAR LONGHORN CARE",
// department: 'BVO',
// creditHours: 3,
// status: Status.OPEN,
// instructors: [new Instructor({ fullName: 'BEVO', firstName: '', lastName: 'BEVO', middleInitial: '' })],
// isReserved: false,
// description: [
// 'Restricted to Students in the School of Longhorn Enthusiasts',
// 'Immerse yourself in the daily routine of a longhorn—sunrise pasture walks and the best shady spots for a midday siesta. Understand the behavioral science behind our mascot’s stoic demeanor during games.',
// 'BVO 311C and 312H may not both be counted.',
// 'Prerequisite: Grazing 311 or 311H.',
// 'May be counted toward the Independent Inquiry flag requirement. May be counted toward the Writing flag requirement',
// 'Offered on the letter-grade basis only.',
// ],
// schedule: new CourseSchedule({
// meetings: [
// new CourseMeeting({
// days: ['Tuesday', 'Thursday'],
// startTime: 480,
// endTime: 570,
// location: { building: 'UTC', room: '123' },
// }),
// new CourseMeeting({
// days: ['Thursday'],
// startTime: 570,
// endTime: 630,
// location: { building: 'JES', room: '123' },
// }),
// ],
// }),
// url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/',
// flags: ['Independent Inquiry', 'Writing'],
// instructionMode: 'In Person',
// semester: {
// code: '12345',
// year: 2024,
// season: 'Spring',
// },
// });
const meta = {
title: 'Components/Injected/CourseCatalogInjectedPopup',
component: CourseCatalogInjectedPopup,
args: {
onClose: () => {},
},
argTypes: {
course: {
control: {
type: 'object',
},
},
activeSchedule: {
control: {
type: 'object',
},
},
onClose: {
control: {
type: 'function',
},
},
},
} satisfies Meta<typeof CourseCatalogInjectedPopup>;

// const meta = {
// title: 'Components/Injected/CourseCatalogInjectedPopup',
// component: CourseCatalogInjectedPopup,
// args: {
// course: exampleCourse,
// activeSchedule: exampleSchedule,
// onClose: () => {},
// },
// argTypes: {
// course: {
// control: {
// type: 'object',
// },
// },
// activeSchedule: {
// control: {
// type: 'object',
// },
// },
// onClose: {
// control: {
// type: 'function',
// },
// },
// },
// } satisfies Meta<typeof CourseCatalogInjectedPopup>;
export default meta;
type Story = StoryObj<typeof meta>;

// export default meta;
// type Story = StoryObj<typeof meta>;
export const OpenCourse: Story = {
args: {
course: MikeScottCS314Course,
activeSchedule: MikeScottCS314Schedule,
},
};

// export const OpenCourse: Story = {
// args: {
// course: exampleCourse,
// activeSchedule: exampleSchedule,
// onClose: () => {},
// },
// };
export const ClosedCourse: Story = {
args: {
course: {
...MikeScottCS314Course,
status: Status.CLOSED,
} as Course,
activeSchedule: new UserSchedule({ courses: [], name: '', hours: 0 }),
},
};

// export const ClosedCourse: Story = {
// args: {
// course: {
// ...exampleCourse,
// status: Status.CLOSED,
// } satisfies Course,
// },
// };

// export const CourseWithNoData: Story = {
// args: {
// course: bevoCourse,
// },
// };
export default {};
export const CourseWithNoData: Story = {
args: {
course: bevoCourse,
activeSchedule: bevoScheule,
},
};
60 changes: 0 additions & 60 deletions src/stories/injected/CoursePopup.stories.ts

This file was deleted.

107 changes: 104 additions & 3 deletions src/stories/injected/mocked.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Course, Status } from '@shared/types/Course';
import { CourseMeeting } from '@shared/types/CourseMeeting';
import { CourseMeeting, DAY_MAP } from '@shared/types/CourseMeeting';
import Instructor from '@shared/types/Instructor';
import { UserSchedule } from '@shared/types/UserSchedule';

Expand Down Expand Up @@ -47,13 +47,114 @@ export const exampleCourse: Course = new Course({
season: 'Spring',
year: 2024,
},
status: Status.CANCELLED,
status: Status.OPEN,
uniqueId: 12345,
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/',
});

export const exampleSchedule: UserSchedule = new UserSchedule({
courses: [exampleCourse],
name: 'Example Schedule',
hours: 0,
hours: 3,
});

export const bevoCourse: Course = new Course({
uniqueId: 47280,
number: '311C',
fullName: "BVO 311C BEVO'S SEMINAR LONGHORN CARE",
courseName: "BEVO'S SEMINAR LONGHORN CARE",
department: 'BVO',
creditHours: 3,
status: Status.OPEN,
instructors: [new Instructor({ fullName: 'BEVO', firstName: '', lastName: 'BEVO', middleInitial: '' })],
isReserved: false,
description: [
'Restricted to Students in the School of Longhorn Enthusiasts',
'Immerse yourself in the daily routine of a longhorn—sunrise pasture walks and the best shady spots for a midday siesta. Understand the behavioral science behind our mascot’s stoic demeanor during games.',
'BVO 311C and 312H may not both be counted.',
'Prerequisite: Grazing 311 or 311H.',
'May be counted toward the Independent Inquiry flag requirement. May be counted toward the Writing flag requirement',
'Offered on the letter-grade basis only.',
],
schedule: {
meetings: [
new CourseMeeting({
days: ['Tuesday', 'Thursday'],
startTime: 480,
endTime: 570,
location: { building: 'UTC', room: '123' },
}),
new CourseMeeting({
days: ['Thursday'],
startTime: 570,
endTime: 630,
location: { building: 'JES', room: '123' },
}),
],
},
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/',
flags: ['Independent Inquiry', 'Writing'],
instructionMode: 'In Person',
semester: {
code: '12345',
year: 2024,
season: 'Spring',
},
});

export const bevoScheule: UserSchedule = new UserSchedule({
courses: [bevoCourse],
name: 'Bevo Schedule',
hours: 3,
});

export const MikeScottCS314Course: Course = new Course({
uniqueId: 50805,
number: '314',
fullName: 'C S 314 DATA STRUCTURES',
courseName: 'DATA STRUCTURES',
department: 'C S',
creditHours: 3,
status: Status.OPEN,
instructors: [
new Instructor({ fullName: 'SCOTT, MICHAEL', firstName: 'MICHAEL', lastName: 'SCOTT', middleInitial: 'D' }),
],
isReserved: true,
description: [
'Second part of a two-part sequence in programming. Introduction to specifications, simple unit testing, and debugging; building and using canonical data structures; algorithm analysis and reasoning techniques such as assertions and invariants.',
'Computer Science 314 and 314H may not both be counted.',
'BVO 311C and 312H may not both be counted.',
'Prerequisite: Computer Science 312 or 312H with a grade of at least C-.',
'May be counted toward the Quantitative Reasoning flag requirement.',
],
schedule: {
meetings: [
new CourseMeeting({
days: [DAY_MAP.T, DAY_MAP.TH],
startTime: 480,
endTime: 570,
location: { building: 'UTC', room: '123' },
}),
new CourseMeeting({
days: [DAY_MAP.TH],
startTime: 570,
endTime: 630,
location: { building: 'JES', room: '123' },
}),
],
},
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/50825/',
flags: ['Writing', 'Independent Inquiry'],
instructionMode: 'In Person',
semester: {
code: '12345',
year: 2024,
season: 'Spring',
},
});

export const MikeScottCS314Schedule: UserSchedule = new UserSchedule({
courses: [MikeScottCS314Course],
name: 'Mike Scott CS314 Schedule',
hours: 3,
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import HeadingAndActions from './HeadingAndActions';

interface CourseCatalogInjectedPopupProps {
course: Course;
activeSchedule?: UserSchedule;
activeSchedule: UserSchedule;
onClose: () => void;
}

Expand All @@ -27,16 +27,12 @@ export default function CourseCatalogInjectedPopup({
course,
activeSchedule,
onClose,
}: CourseCatalogInjectedPopupProps) {
}: CourseCatalogInjectedPopupProps): JSX.Element {
return (
<Popup overlay className='max-w-[780px] px-6' onClose={onClose}>
<div className='flex flex-col'>
<HeadingAndActions course={course} onClose={onClose} activeSchedule={activeSchedule} />
<Description
course={
course
} /* lines={course.description} Looks like this was replaced. Description now set internally */
/>
<Description course={course} />
<GradeDistribution course={course} />
</div>
</Popup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { Button } from '@views/components/common/Button/Button';
import { Chip, flagMap } from '@views/components/common/Chip/Chip';
import Divider from '@views/components/common/Divider/Divider';
import Text from '@views/components/common/Text/Text';
import { openTabFromContentScript } from '@views/lib/openNewTabFromContentScript';
import React, { useState } from 'react';
import React from 'react';

import Add from '~icons/material-symbols/add';
import CalendarMonth from '~icons/material-symbols/calendar-month';
Expand All @@ -25,7 +24,7 @@ interface HeadingAndActionProps {
/* The course to display */
course: Course;
/* The active schedule */
activeSchedule?: UserSchedule;
activeSchedule: UserSchedule;
/* The function to call when the popup should be closed */
onClose: () => void;
}
Expand Down
Loading
Loading