feat: show async courses in the bottom bar (#204)

* feat: show async courses in the bottom bar

* fix: hide "Async/Other" header when there are no async courses, off-by-n error

(where n is the number async courses)

* refactor: move types closer to map instead of weird "as boolean"

* refactor: move satisfies to return type
This commit is contained in:
Samuel Gunter
2024-03-29 00:01:23 -05:00
committed by GitHub
parent d3f64ec79e
commit 227de53e84
6 changed files with 84 additions and 62 deletions

View File

@@ -84,18 +84,29 @@ type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
courses: [
courseCells: [
{
colors: getCourseColors('pink', 200),
courseDeptAndInstr: `${exampleGovCourse.department} ${exampleGovCourse.number} ${exampleGovCourse.instructors[0]!.lastName}`,
status: exampleGovCourse.status,
async: true,
calendarGridPoint: { dayIndex: -1, endIndex: -1, startIndex: -1 },
componentProps: {
colors: getCourseColors('pink', 200),
courseDeptAndInstr: `${exampleGovCourse.department} ${exampleGovCourse.number} ${exampleGovCourse.instructors[0]!.lastName}`,
status: exampleGovCourse.status,
},
course: exampleGovCourse,
},
{
colors: getCourseColors('slate', 500),
courseDeptAndInstr: `${examplePsyCourse.department} ${examplePsyCourse.number} ${examplePsyCourse.instructors[0]!.lastName}`,
status: examplePsyCourse.status,
async: true,
calendarGridPoint: { dayIndex: -1, endIndex: -1, startIndex: -1 },
componentProps: {
colors: getCourseColors('slate', 500),
courseDeptAndInstr: `${examplePsyCourse.department} ${examplePsyCourse.number} ${examplePsyCourse.instructors[0]!.lastName}`,
status: examplePsyCourse.status,
},
course: examplePsyCourse,
},
],
setCourse: () => {},
},
render: props => (
<div className='outline-red outline w-292.5!'>
@@ -105,7 +116,7 @@ export const Default: Story = {
};
export const Empty: Story = {
args: {
courses: [],
courseCells: [],
},
render: props => (
<div className='outline-red outline w-292.5!'>

View File

@@ -35,6 +35,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
{
calendarGridPoint: {
@@ -49,6 +50,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
{
calendarGridPoint: {
@@ -63,6 +65,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
{
calendarGridPoint: {
@@ -77,6 +80,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
{
calendarGridPoint: {
@@ -91,6 +95,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
{
calendarGridPoint: {
@@ -105,6 +110,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
{
calendarGridPoint: {
@@ -119,6 +125,7 @@ const testData: CalendarGridCourse[] = [
colors: getCourseColors('emerald', 500),
},
course: ExampleCourse,
async: false,
},
];