Compare commits
5 Commits
copilot/su
...
copilot/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3912732968 | ||
| f8c2788d86 | |||
|
|
f240e39419 | ||
|
|
1df0116514 | ||
|
|
dc9984ab61 |
@@ -111,7 +111,7 @@
|
|||||||
"@vitest/coverage-v8": "^2.1.9",
|
"@vitest/coverage-v8": "^2.1.9",
|
||||||
"@vitest/ui": "^2.1.9",
|
"@vitest/ui": "^2.1.9",
|
||||||
"chalk": "^5.4.1",
|
"chalk": "^5.4.1",
|
||||||
"chromatic": "^11.26.0",
|
"chromatic": "^15.1.0",
|
||||||
"cssnano": "^7.0.6",
|
"cssnano": "^7.0.6",
|
||||||
"cssnano-preset-advanced": "^7.0.6",
|
"cssnano-preset-advanced": "^7.0.6",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
"prettier": "3.6.2",
|
"prettier": "3.6.2",
|
||||||
"react-dev-utils": "^12.0.1",
|
"react-dev-utils": "^12.0.1",
|
||||||
"semantic-release": "^24.2.3",
|
"semantic-release": "^24.2.3",
|
||||||
"storybook": "^8.6.15",
|
"storybook": "^8.6.0",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
"unocss": "^0.63.6",
|
"unocss": "^0.63.6",
|
||||||
"unocss-preset-primitives": "0.0.2-beta.1",
|
"unocss-preset-primitives": "0.0.2-beta.1",
|
||||||
|
|||||||
731
pnpm-lock.yaml
generated
731
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -77,7 +77,7 @@ type CourseWithId = { course: Course } & BaseItem;
|
|||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/Common/SortableList',
|
title: 'Components/Common/SortableList',
|
||||||
component: SortableList<CourseWithId>,
|
component: SortableList,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
},
|
},
|
||||||
@@ -85,7 +85,7 @@ const meta = {
|
|||||||
} satisfies Meta<typeof SortableList<CourseWithId>>;
|
} satisfies Meta<typeof SortableList<CourseWithId>>;
|
||||||
export default meta;
|
export default meta;
|
||||||
|
|
||||||
type Story = StoryObj<typeof meta>;
|
type Story = StoryObj<Meta<typeof SortableList<CourseWithId>>>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
@@ -94,9 +94,7 @@ export const Default: Story = {
|
|||||||
course,
|
course,
|
||||||
})),
|
})),
|
||||||
onChange: () => {},
|
onChange: () => {},
|
||||||
renderItem: (item: CourseWithId) => (
|
renderItem: ({ id, course }) => <PopupCourseBlock key={id} course={course} colors={course.colors} />,
|
||||||
<PopupCourseBlock key={item.id} course={item.course} colors={item.course.colors} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
render: args => (
|
render: args => (
|
||||||
<div className='h-3xl w-3xl transform-none'>
|
<div className='h-3xl w-3xl transform-none'>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react';
|
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react';
|
||||||
import { CalendarDots, Export, FileCode, FilePng, Sidebar } from '@phosphor-icons/react';
|
import { CalendarDots, Export, FileCode, FilePng, FileText, Sidebar } from '@phosphor-icons/react';
|
||||||
import styles from '@views/components/calendar/CalendarHeader/CalendarHeader.module.scss';
|
import styles from '@views/components/calendar/CalendarHeader/CalendarHeader.module.scss';
|
||||||
import { Button } from '@views/components/common/Button';
|
import { Button } from '@views/components/common/Button';
|
||||||
import DialogProvider from '@views/components/common/DialogProvider/DialogProvider';
|
import DialogProvider from '@views/components/common/DialogProvider/DialogProvider';
|
||||||
@@ -11,7 +11,7 @@ import useSchedules from '@views/hooks/useSchedules';
|
|||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { handleExportJson, saveAsCal, saveCalAsPng } from '../utils';
|
import { handleExportJson, saveAsCal, saveAsText, saveCalAsPng } from '../utils';
|
||||||
|
|
||||||
interface CalendarHeaderProps {
|
interface CalendarHeaderProps {
|
||||||
sidebarOpen?: boolean;
|
sidebarOpen?: boolean;
|
||||||
@@ -111,6 +111,18 @@ export default function CalendarHeader({ sidebarOpen, onSidebarToggle }: Calenda
|
|||||||
Save as .json
|
Save as .json
|
||||||
</Button>
|
</Button>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem>
|
||||||
|
<Button
|
||||||
|
className='w-full flex justify-start'
|
||||||
|
onClick={saveAsText}
|
||||||
|
color='ut-black'
|
||||||
|
size='small'
|
||||||
|
variant='minimal'
|
||||||
|
icon={FileText}
|
||||||
|
>
|
||||||
|
Save as .txt
|
||||||
|
</Button>
|
||||||
|
</MenuItem>
|
||||||
{/* <MenuItem>
|
{/* <MenuItem>
|
||||||
<Button color='ut-black' size='small' variant='minimal' icon={FileTxt}>
|
<Button color='ut-black' size='small' variant='minimal' icon={FileTxt}>
|
||||||
Export Unique IDs
|
Export Unique IDs
|
||||||
|
|||||||
@@ -245,6 +245,27 @@ export const scheduleToIcsString = (schedule: Serialized<UserSchedule>) => {
|
|||||||
return icsString;
|
return icsString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the provided schedule in a human readable/copyable text format
|
||||||
|
* @param schedule - The schedule object
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const scheduleToText = (schedule: Serialized<UserSchedule>) => {
|
||||||
|
const lines: string[] = [];
|
||||||
|
|
||||||
|
lines.push(`Schedule: ${schedule.name}`);
|
||||||
|
lines.push('');
|
||||||
|
|
||||||
|
for (const c of schedule.courses) {
|
||||||
|
lines.push(c.fullName);
|
||||||
|
lines.push(`${c.creditHours} Credit Hours`);
|
||||||
|
lines.push(`${c.uniqueId}`);
|
||||||
|
lines.push('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.join('\n');
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the current schedule as a calendar file in the iCalendar format (ICS).
|
* Saves the current schedule as a calendar file in the iCalendar format (ICS).
|
||||||
* Fetches the current active schedule and converts it into an ICS string.
|
* Fetches the current active schedule and converts it into an ICS string.
|
||||||
@@ -262,6 +283,25 @@ export const saveAsCal = async () => {
|
|||||||
downloadBlob(icsString, 'CALENDAR', 'schedule.ics');
|
downloadBlob(icsString, 'CALENDAR', 'schedule.ics');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save current schedule as a plain text file consisting of
|
||||||
|
* Course Name - Course ID
|
||||||
|
* Course Time
|
||||||
|
* Unique Number
|
||||||
|
* Line Break
|
||||||
|
* Repeat
|
||||||
|
*/
|
||||||
|
export const saveAsText = async () => {
|
||||||
|
const schedule = await getSchedule();
|
||||||
|
|
||||||
|
if (!schedule) {
|
||||||
|
throw new Error('No schedule found');
|
||||||
|
}
|
||||||
|
|
||||||
|
const scheduleText = scheduleToText(schedule);
|
||||||
|
downloadBlob(scheduleText, 'TEXT', 'schedule.txt');
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves current schedule to JSON that can be imported on other devices.
|
* Saves current schedule to JSON that can be imported on other devices.
|
||||||
* @param id - Provided schedule ID to download
|
* @param id - Provided schedule ID to download
|
||||||
|
|||||||
Reference in New Issue
Block a user