@@ -56,7 +56,7 @@ export const Default: Story = {
|
|||||||
schedule: new CourseSchedule({
|
schedule: new CourseSchedule({
|
||||||
meetings: [
|
meetings: [
|
||||||
new CourseMeeting({
|
new CourseMeeting({
|
||||||
days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F],
|
days: [DAY_MAP.MON, DAY_MAP.WED, DAY_MAP.FRI],
|
||||||
startTime: 480,
|
startTime: 480,
|
||||||
endTime: 570,
|
endTime: 570,
|
||||||
location: {
|
location: {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import WaitlistIcon from '~icons/material-symbols/timelapse';
|
|||||||
import CancelledIcon from '~icons/material-symbols/warning';
|
import CancelledIcon from '~icons/material-symbols/warning';
|
||||||
import Text from '../Text/Text';
|
import Text from '../Text/Text';
|
||||||
|
|
||||||
export interface CalendarCourseCellProps {
|
export interface CalendarCourseBlockProps {
|
||||||
/** The Course that the meeting is for. */
|
/** The Course that the meeting is for. */
|
||||||
course: Course;
|
course: Course;
|
||||||
/* index into course meeting array to display */
|
/* index into course meeting array to display */
|
||||||
@@ -15,7 +15,7 @@ export interface CalendarCourseCellProps {
|
|||||||
color: string;
|
color: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CalendarCourseCell: React.FC<CalendarCourseCellProps> = ({ course, meetingIdx }: CalendarCourseCellProps) => {
|
const CalendarCourseBlock: React.FC<CalendarCourseBlockProps> = ({ course, meetingIdx }: CalendarCourseBlockProps) => {
|
||||||
let meeting: CourseMeeting | null = meetingIdx !== undefined ? course.schedule.meetings[meetingIdx] : null;
|
let meeting: CourseMeeting | null = meetingIdx !== undefined ? course.schedule.meetings[meetingIdx] : null;
|
||||||
let rightIcon: React.ReactNode | null = null;
|
let rightIcon: React.ReactNode | null = null;
|
||||||
if (status === Status.WAITLISTED) {
|
if (status === Status.WAITLISTED) {
|
||||||
@@ -60,4 +60,4 @@ const CalendarCourseCell: React.FC<CalendarCourseCellProps> = ({ course, meeting
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CalendarCourseCell;
|
export default CalendarCourseBlock;
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ import React from 'react';
|
|||||||
import { DAY_MAP } from 'src/shared/types/CourseMeeting';
|
import { DAY_MAP } from 'src/shared/types/CourseMeeting';
|
||||||
import styles from './CalendarGrid.module.scss';
|
import styles from './CalendarGrid.module.scss';
|
||||||
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
|
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
|
||||||
import CalendarCourseCell from '../CalendarCourseCell/CalendarCourseCell';
|
import { CourseMeeting } from 'src/shared/types/CourseMeeting';
|
||||||
import { Chip } from '../Chip/Chip';
|
|
||||||
|
|
||||||
|
|
||||||
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key));
|
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key));
|
||||||
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
|
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
|
||||||
@@ -24,14 +22,14 @@ for (let i = 0; i < 13; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
courseCells: typeof CalendarCourseCell[];
|
CourseMeetingBlocks: CourseMeeting[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
||||||
* @param props
|
* @param props
|
||||||
*/
|
*/
|
||||||
export function Calendar({ courseCells }: React.PropsWithChildren<Props>): JSX.Element {
|
export function Calendar({ courseMeetingBlocks }: React.PropsWithChildren<Props>): JSX.Element {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.calendar}>
|
<div className={styles.calendar}>
|
||||||
@@ -56,16 +54,12 @@ export function Calendar({ courseCells }: React.PropsWithChildren<Props>): JSX.E
|
|||||||
{day}
|
{day}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{grid.map((row) => row)}
|
{grid.map((row, rowIndex) => row)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{courseCells.map((Block: typeof CalendarCourseCell) => (
|
{courseMeetingBlocks.map((block: CourseMeeting, index: number) => (
|
||||||
<div key={`${Block}`}
|
<div key={index}>
|
||||||
style ={{
|
{block}
|
||||||
gridColumn: `1`,
|
|
||||||
gridRow: `1`
|
|
||||||
}}>
|
|
||||||
<Chip label='test'/>
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user