Squashed commit of the following:
commitf6896e37e2Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Mon Feb 19 20:46:57 2024 -0600 Calendar Page mostly styled commita28422e6b0Merge:297601e41e6d77Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Mon Feb 19 18:46:59 2024 -0600 Merge branch 'hackathon' into Som commit297601e715Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sun Feb 18 16:28:29 2024 -0600 Grid works cleanly with up to two course conflicts. Prob needs refactoring commit313a9648c9Merge:b0a95a60acd0b7Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sun Feb 18 15:45:57 2024 -0600 Merge branch 'hackathon' into Som commitb0a95a6153Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sun Feb 18 14:10:13 2024 -0600 Made CourseCells and CalendarGridCells more responsive. CourseCells now rendering onto grid. Still, need to make course cells more responsive, and add edge cases commita1a0f00514Merge:7479004ac71b83Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sat Feb 17 17:07:06 2024 -0600 Merge branch 'hackathon' into Som commit7479004a65Author: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sat Feb 17 16:59:34 2024 -0600 Need to add sorting
This commit is contained in:
23
src/stories/components/calendar/Calendar.stories.tsx
Normal file
23
src/stories/components/calendar/Calendar.stories.tsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { Meta, StoryObj } from '@storybook/react';
|
||||||
|
import { Calendar } from 'src/views/components/calendar/Calendar/Calendar';
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
title: 'Components/Calendar/Calendar',
|
||||||
|
component: Calendar,
|
||||||
|
parameters: {
|
||||||
|
layout: 'centered',
|
||||||
|
},
|
||||||
|
tags: ['autodocs'],
|
||||||
|
argTypes: {
|
||||||
|
|
||||||
|
},
|
||||||
|
} satisfies Meta<typeof Calendar>;
|
||||||
|
export default meta;
|
||||||
|
|
||||||
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
|
export const Default: Story = {
|
||||||
|
args: {
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
|
|||||||
import { Course, Status } from '@shared/types/Course';
|
import { Course, Status } from '@shared/types/Course';
|
||||||
import Instructor from '@shared/types/Instructor';
|
import Instructor from '@shared/types/Instructor';
|
||||||
import { CalendarBottomBar } from 'src/views/components/calendar/CalendarBottomBar/CalendarBottomBar';
|
import { CalendarBottomBar } from 'src/views/components/calendar/CalendarBottomBar/CalendarBottomBar';
|
||||||
import { getCourseColors } from '../../shared/util/colors';
|
import { getCourseColors } from '../../../shared/util/colors';
|
||||||
|
|
||||||
const exampleGovCourse: Course = new Course({
|
const exampleGovCourse: Course = new Course({
|
||||||
courseName: 'Nope',
|
courseName: 'Nope',
|
||||||
@@ -66,7 +66,7 @@ const examplePsyCourse: Course = new Course({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarBottomBar',
|
title: 'Components/Calendar/CalendarBottomBar',
|
||||||
component: CalendarBottomBar,
|
component: CalendarBottomBar,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
@@ -6,7 +6,7 @@ import Instructor from '@shared/types/Instructor';
|
|||||||
import CalendarCourse from 'src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting';
|
import CalendarCourse from 'src/views/components/calendar/CalendarCourseBlock/CalendarCourseMeeting';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarCourseMeeting',
|
title: 'Components/Calendar/CalendarCourseMeeting',
|
||||||
component: CalendarCourse,
|
component: CalendarCourse,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
@@ -3,10 +3,10 @@ import { getCourseColors } from '@shared/util/colors';
|
|||||||
import { Meta, StoryObj } from '@storybook/react';
|
import { Meta, StoryObj } from '@storybook/react';
|
||||||
import CalendarCourseCell from 'src/views/components/calendar/CalendarCourseCell/CalendarCourseCell';
|
import CalendarCourseCell from 'src/views/components/calendar/CalendarCourseCell/CalendarCourseCell';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { exampleCourse } from './PopupCourseBlock.stories';
|
import { exampleCourse } from '../PopupCourseBlock.stories';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarCourseCell',
|
title: 'Components/Calendar/CalendarCourseCell',
|
||||||
component: CalendarCourseCell,
|
component: CalendarCourseCell,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
@@ -5,7 +5,7 @@ import { CalendarGridCourse } from '@views/hooks/useFlattenedCourseSchedule';
|
|||||||
import { Status } from '@shared/types/Course';
|
import { Status } from '@shared/types/Course';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarGrid',
|
title: 'Components/Calendar/CalendarGrid',
|
||||||
component: CalendarGrid,
|
component: CalendarGrid,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
@@ -4,7 +4,7 @@ import CalendarCell from 'src/views/components/calendar/CalendarGridCell/Calenda
|
|||||||
import type { Meta, StoryObj } from '@storybook/react';
|
import type { Meta, StoryObj } from '@storybook/react';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarGridCell',
|
title: 'Components/Calendar/CalendarGridCell',
|
||||||
component: CalendarCell,
|
component: CalendarCell,
|
||||||
parameters: {
|
parameters: {
|
||||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||||
@@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
|
|||||||
import CalendarHeader from 'src/views/components/calendar/CalendarHeader/CalenderHeader';
|
import CalendarHeader from 'src/views/components/calendar/CalendarHeader/CalenderHeader';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarHeader',
|
title: 'Components/Calendar/CalendarHeader',
|
||||||
component: CalendarHeader,
|
component: CalendarHeader,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
@@ -8,7 +8,7 @@ import Instructor from 'src/shared/types/Instructor';
|
|||||||
import { CalendarSchedules } from 'src/views/components/calendar/CalendarSchedules/CalendarSchedules';
|
import { CalendarSchedules } from 'src/views/components/calendar/CalendarSchedules/CalendarSchedules';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarSchedules',
|
title: 'Components/Calendar/CalendarSchedules',
|
||||||
component: CalendarSchedules,
|
component: CalendarSchedules,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
40
src/views/components/calendar/Calendar/Calendar.tsx
Normal file
40
src/views/components/calendar/Calendar/Calendar.tsx
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import CalendarHeader from 'src/views/components/calendar/CalendarHeader/CalenderHeader';
|
||||||
|
import { CalendarBottomBar } from '../CalendarBottomBar/CalendarBottomBar';
|
||||||
|
import { CalendarSchedules } from '../CalendarSchedules/CalendarSchedules';
|
||||||
|
import ImportantLinks from '../ImportantLinks';
|
||||||
|
import CalendarGrid from '../CalendarGrid/CalendarGrid';
|
||||||
|
|
||||||
|
export const flags = ['WR', 'QR', 'GC', 'CD', 'E', 'II'];
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A reusable chip component that follows the design system of the extension.
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function Calendar(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<CalendarHeader />
|
||||||
|
<div className='h-screen w-full flex flex-col md:flex-row'>
|
||||||
|
<div className='min-h-[30%] flex flex-col items-start gap-2.5 p-5 pl-7'>
|
||||||
|
<div className='min-h-[30%]'>
|
||||||
|
<CalendarSchedules />
|
||||||
|
</div>
|
||||||
|
<ImportantLinks />
|
||||||
|
</div>
|
||||||
|
<div className='flex flex-grow flex-col gap-4 overflow-hidden'>
|
||||||
|
<div className='flex-grow overflow-auto'>
|
||||||
|
<CalendarGrid />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<CalendarBottomBar />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,20 +7,20 @@ import ImageIcon from '~icons/material-symbols/image';
|
|||||||
import CalendarMonthIcon from '~icons/material-symbols/calendar-month';
|
import CalendarMonthIcon from '~icons/material-symbols/calendar-month';
|
||||||
|
|
||||||
type CalendarBottomBarProps = {
|
type CalendarBottomBarProps = {
|
||||||
courses: CalendarCourseCellProps[];
|
courses?: CalendarCourseCellProps[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const CalendarBottomBar = ({ courses }: CalendarBottomBarProps): JSX.Element => {
|
export const CalendarBottomBar = ({ courses }: CalendarBottomBarProps): JSX.Element => {
|
||||||
if (courses.length === -1) console.log('foo'); // dumb line to make eslint happy
|
if (courses?.length === -1) console.log('foo'); // dumb line to make eslint happy
|
||||||
return (
|
return (
|
||||||
<div className='w-full flex py-1.25'>
|
<div className='w-full flex py-1.25'>
|
||||||
<div className='flex flex-grow items-center gap-3.75 pl-7.5 pr-2.5'>
|
<div className='flex flex-grow items-center gap-3.75 pl-7.5 pr-2.5'>
|
||||||
<Text variant='h4'>Async. and Other:</Text>
|
<Text variant='h4'>Async. and Other:</Text>
|
||||||
<div className='h-14 inline-flex gap-2.5'>
|
<div className='h-14 inline-flex gap-2.5'>
|
||||||
{courses.map(course => (
|
{courses?.map(course => (
|
||||||
<CalendarCourseBlock
|
<CalendarCourseBlock
|
||||||
courseDeptAndInstr={course.courseDeptAndInstr}
|
courseDeptAndInstr={course.courseDeptAndInstr}
|
||||||
status={course.status}
|
status={course.status}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
.calendarGrid {
|
.calendarGrid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(6, 1fr);
|
grid-template-columns: auto repeat(5, 6fr);
|
||||||
grid-template-rows: repeat(26, 1fr);
|
grid-template-rows: repeat(26, 1fr);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
position: relative; // Ensuring that child elements can be positioned in relation to this.
|
position: relative;
|
||||||
min-width: 800px;
|
width: 100%;
|
||||||
min-height: 500px;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day {
|
.day {
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #333;
|
color: #333;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
@@ -137,4 +137,4 @@
|
|||||||
border-radius: 50%; /* Rounds the corners into a circle */
|
border-radius: 50%; /* Rounds the corners into a circle */
|
||||||
top: 12.5%; /* Centers the dot vertically */
|
top: 12.5%; /* Centers the dot vertically */
|
||||||
left: 12.5%; /* Centers the dot horizontally */
|
left: 12.5%; /* Centers the dot horizontally */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ for (let i = 0; i < 13; i++) {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
courseCells: CalendarGridCourse[];
|
courseCells?: CalendarGridCourse[];
|
||||||
saturdayClass: boolean;
|
saturdayClass?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,21 +110,17 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Pr
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.calendar}>
|
<div className={styles.calendarGrid}>
|
||||||
<div className={styles.dayLabelContainer} />
|
{/* Displaying day labels */}
|
||||||
{/* Displaying the rest of the calendar */}
|
<div className={styles.timeBlock} />
|
||||||
<div className={styles.timeAndGrid}>
|
{daysOfWeek.map(day => (
|
||||||
<div className={styles.calendarGrid}>
|
<div key={day} className={styles.day}>
|
||||||
{/* Displaying day labels */}
|
{day}
|
||||||
<div className={styles.timeBlock} />
|
</div>
|
||||||
{daysOfWeek.map(day => (
|
))}
|
||||||
<div key={day} className={styles.day}>
|
{grid.map((row, rowIndex) => row)}
|
||||||
{day}
|
{courseCells ? accountForCourseConflicts(courseCells) : null}
|
||||||
</div>
|
{/* courseCells.map((block: CalendarGridCourse) => (
|
||||||
))}
|
|
||||||
{grid.map((row, rowIndex) => row)}
|
|
||||||
{accountForCourseConflicts(courseCells)}
|
|
||||||
{/* courseCells.map((block: CalendarGridCourse) => (
|
|
||||||
<div
|
<div
|
||||||
key={`${block}`}
|
key={`${block}`}
|
||||||
style={{
|
style={{
|
||||||
@@ -140,8 +136,6 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Pr
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)) */}
|
)) */}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -195,8 +189,8 @@ function accountForCourseConflicts(courseCells: CalendarGridCourse[]): JSX.Eleme
|
|||||||
style={{
|
style={{
|
||||||
gridColumn: `${block.calendarGridPoint.dayIndex + 1}`,
|
gridColumn: `${block.calendarGridPoint.dayIndex + 1}`,
|
||||||
gridRow: `${block.calendarGridPoint.startIndex + 1} / ${block.calendarGridPoint.endIndex + 1}`,
|
gridRow: `${block.calendarGridPoint.startIndex + 1} / ${block.calendarGridPoint.endIndex + 1}`,
|
||||||
width: `calc(100% / ${block.totalColumns})`,
|
width: `calc(100% / ${block.totalColumns})`,
|
||||||
marginLeft: `calc(100% * ${(block.gridColumnStart - 1) / block.totalColumns})`,
|
marginLeft: `calc(100% * ${(block.gridColumnStart - 1) / block.totalColumns})`,
|
||||||
padding: '0px 10px 4px 0px',
|
padding: '0px 10px 4px 0px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user