Merge remote-tracking branch 'origin/hackathon' into feat-conflict-row

This commit is contained in:
DhruvArora-03
2024-02-17 18:21:39 -06:00
5 changed files with 115 additions and 87 deletions

View File

@@ -14,5 +14,17 @@
1. Clone this repo 1. Clone this repo
2. Run `pnpm install` to install and patch all the required dependencies 2. Run `pnpm install` to install and patch all the required dependencies
3. Run `pnpm run dev` to start the development server
4. Run `pnpm build` to build the extension for production - If you want to run the development build:
- Run `pnpm run dev`
- If you want to build the extension for production:
- Run `pnpm build`
You may have to rename the `__uno.css.js` to `uno.css.js` in dist
Go to chrome://extensions, ensure you have "Developer Mode" enabled, and click 'Load unpacked'
Navigate to the 'dist' folder and click 'select' to import the extension

View File

@@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
import CalendarHeader from '@views/components/common/CalendarHeader/CalenderHeader'; import CalendarHeader from '@views/components/common/CalendarHeader/CalenderHeader';
const meta = { const meta = {
title: 'Components/CalendarHeader', title: 'Components/Common/CalendarHeader',
component: CalendarHeader, component: CalendarHeader,
parameters: { parameters: {
layout: 'centered', layout: 'centered',

View File

@@ -12,40 +12,41 @@ import ScheduleTotalHoursAndCourses from '../ScheduleTotalHoursAndCourses/Schedu
import CourseStatus from '../CourseStatus/CourseStatus'; import CourseStatus from '../CourseStatus/CourseStatus';
const CalendarHeader = () => ( const CalendarHeader = () => (
<div <div className='min-h-79px min-w-672px flex px-0 py-15'>
style={{ <div className='flex flex-row gap-20'>
display: 'flex', <div className='flex gap-10'>
minWidth: '672px', <div className='flex gap-1'>
minHeight: '79px',
padding: '15px 0px',
justifyContent: 'space-between',
alignItems: 'center',
alignContent: 'center',
rowGap: '10px',
alignSelf: 'stretch',
flexWrap: 'wrap',
}}
>
<Button variant='single' icon={MenuIcon} color='ut-gray' /> <Button variant='single' icon={MenuIcon} color='ut-gray' />
<div className='flex items-center'>
<div style={{ display: 'flex', alignItems: 'center' }}>
<LogoIcon style={{ marginRight: '5px' }} /> <LogoIcon style={{ marginRight: '5px' }} />
<Text>Your Logo Text</Text> <div className='flex flex-col gap-1 whitespace-nowrap'>
<Text className='leading-trim text-cap font-roboto text-base text-ut-burntorange font-medium'>
UT Registration
</Text>
<Text className='leading-trim text-cap font-roboto text-base text-ut-orange font-medium'>
Plus
</Text>
</div> </div>
</div>
</div>
<div className='flex flex-col'>
<ScheduleTotalHoursAndCourses scheduleName='SCHEDULE' totalHours={22} totalCourses={8} /> <ScheduleTotalHoursAndCourses scheduleName='SCHEDULE' totalHours={22} totalCourses={8} />
DATA UPDATED ON: 12:00 AM 02/01/2024
</div>
</div>
<div className='flex flex-row items-center space-x-8'>
<div className='flex flex-row space-x-4'>
<CourseStatus size='small' status={Status.WAITLISTED} /> <CourseStatus size='small' status={Status.WAITLISTED} />
<CourseStatus size='small' status={Status.CLOSED} /> <CourseStatus size='small' status={Status.CLOSED} />
<CourseStatus size='small' status={Status.CANCELLED} /> <CourseStatus size='small' status={Status.CANCELLED} />
<div style={{ display: 'flex' }}>
<Button variant='outline' icon={UndoIcon} color='ut-black' />
<Button variant='outline' icon={RedoIcon} color='ut-black' />
</div> </div>
<div className='flex flex-row'>
<Button variant='outline' icon={SettingsIcon} color='ut-black' /> <Button variant='single' icon={UndoIcon} color='ut-black' />
<Button variant='single' icon={RedoIcon} color='ut-black' />
<Button variant='single' icon={SettingsIcon} color='ut-black' />
</div>
</div>
</div>
<Divider type='solid' /> <Divider type='solid' />
</div> </div>
); );

View File

@@ -21,7 +21,7 @@ export default function ScheduleTotalHoursAndCourses({
totalCourses, totalCourses,
}: ScheduleTotalHoursAndCoursesProps): JSX.Element { }: ScheduleTotalHoursAndCoursesProps): JSX.Element {
return ( return (
<div className='min-w-64 flex flex-wrap content-center items-baseline gap-2 uppercase'> <div className='min-w-64 flex whitespace-nowrap content-center items-baseline gap-2 uppercase'>
<Text className='text-[#BF5700]' variant='h1' as='span'> <Text className='text-[#BF5700]' variant='h1' as='span'>
{`${scheduleName}: `} {`${scheduleName}: `}
</Text> </Text>

View File

@@ -19,7 +19,7 @@ interface CalendarGridPoint {
* Return type of useFlattenedCourseSchedule * Return type of useFlattenedCourseSchedule
*/ */
export interface CalendarGridCourse { export interface CalendarGridCourse {
calendarGridPoint?: CalendarGridPoint; calendarGridPoint: CalendarGridPoint;
componentProps: CalendarCourseCellProps; componentProps: CalendarCourseCellProps;
} }
@@ -33,7 +33,8 @@ export function useFlattenedCourseSchedule(): CalendarGridCourse[] {
const [activeSchedule] = useSchedules(); const [activeSchedule] = useSchedules();
const { courses } = activeSchedule; const { courses } = activeSchedule;
return courses.flatMap(course => { return courses
.flatMap(course => {
const { const {
status, status,
department, department,
@@ -46,6 +47,11 @@ export function useFlattenedCourseSchedule(): CalendarGridCourse[] {
// asynch, online course // asynch, online course
return [ return [
{ {
calendarGridPoint: {
dayIndex: 0,
startIndex: 0,
endIndex: 0,
},
componentProps: { componentProps: {
courseDeptAndInstr, courseDeptAndInstr,
status, status,
@@ -83,5 +89,14 @@ export function useFlattenedCourseSchedule(): CalendarGridCourse[] {
}, },
})); }));
}); });
})
.sort((a: CalendarGridCourse, b: CalendarGridCourse) => {
if (a.calendarGridPoint.dayIndex !== b.calendarGridPoint.dayIndex) {
return a.calendarGridPoint.dayIndex - b.calendarGridPoint.dayIndex;
}
if (a.calendarGridPoint.startIndex !== b.calendarGridPoint.startIndex) {
return a.calendarGridPoint.startIndex - b.calendarGridPoint.startIndex;
}
return a.calendarGridPoint.endIndex - b.calendarGridPoint.endIndex;
}); });
} }