refactor: change a file name (#447)
* refactor: file upload component * refactor: changed name of a function and added a new line
This commit is contained in:
@@ -21,6 +21,7 @@ export default async function addCourse(scheduleId: string, course: Course, hasC
|
||||
if (!hasColor) {
|
||||
course.colors = getUnusedColor(activeSchedule, course);
|
||||
}
|
||||
|
||||
activeSchedule.courses.push(course);
|
||||
activeSchedule.updatedAt = Date.now();
|
||||
await UserScheduleStore.set('schedules', schedules);
|
||||
|
||||
@@ -26,7 +26,6 @@ export default async function importSchedule(scheduleData: unknown): Promise<voi
|
||||
const course = new Course(c);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await addCourse(newScheduleId, course, true);
|
||||
console.log(course.colors);
|
||||
}
|
||||
console.log('Course schedule successfully parsed!');
|
||||
} else {
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
import { colorsFlattened } from '@shared/util/themeColors';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import InputButton from '@views/components/common/InputButton';
|
||||
import FileUpload from '@views/components/common/FileUpload';
|
||||
import React from 'react';
|
||||
|
||||
import AddIcon from '~icons/material-symbols/add';
|
||||
import CalendarMonthIcon from '~icons/material-symbols/calendar-month';
|
||||
import DescriptionIcon from '~icons/material-symbols/description';
|
||||
import ImagePlaceholderIcon from '~icons/material-symbols/image';
|
||||
import HappyFaceIcon from '~icons/material-symbols/mood';
|
||||
import ReviewsIcon from '~icons/material-symbols/reviews';
|
||||
|
||||
/**
|
||||
* Stole this straight from Button.stories.tsx to test the input
|
||||
*/
|
||||
const meta = {
|
||||
title: 'Components/Common/InputButton',
|
||||
component: InputButton,
|
||||
title: 'Components/Common/FileUpload',
|
||||
component: FileUpload,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
@@ -39,7 +34,7 @@ const meta = {
|
||||
},
|
||||
onChange: { action: 'file selected' }, // action to show when file is selected
|
||||
},
|
||||
} satisfies Meta<typeof InputButton>;
|
||||
} satisfies Meta<typeof FileUpload>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
@@ -64,17 +59,17 @@ export const Grid: Story = {
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
|
||||
<div style={{ display: 'flex', gap: '15px' }}>
|
||||
<InputButton {...props} variant='filled' color='ut-black' />
|
||||
<InputButton {...props} variant='outline' color='ut-black' />
|
||||
<InputButton {...props} variant='single' color='ut-black' />
|
||||
<FileUpload {...props} variant='filled' color='ut-black' />
|
||||
<FileUpload {...props} variant='outline' color='ut-black' />
|
||||
<FileUpload {...props} variant='single' color='ut-black' />
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div style={{ display: 'flex', gap: '15px' }}>
|
||||
<InputButton {...props} variant='filled' color='ut-black' disabled />
|
||||
<InputButton {...props} variant='outline' color='ut-black' disabled />
|
||||
<InputButton {...props} variant='single' color='ut-black' disabled />
|
||||
<FileUpload {...props} variant='filled' color='ut-black' disabled />
|
||||
<FileUpload {...props} variant='outline' color='ut-black' disabled />
|
||||
<FileUpload {...props} variant='single' color='ut-black' disabled />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
@@ -92,15 +87,15 @@ export const PrettyColors: Story = {
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
|
||||
{colorsNames.map(color => (
|
||||
<div style={{ display: 'flex', gap: '15px' }} key={color}>
|
||||
<InputButton {...props} variant='filled' color={color}>
|
||||
<FileUpload {...props} variant='filled' color={color}>
|
||||
Button
|
||||
</InputButton>
|
||||
<InputButton {...props} variant='outline' color={color}>
|
||||
</FileUpload>
|
||||
<FileUpload {...props} variant='outline' color={color}>
|
||||
Button
|
||||
</InputButton>
|
||||
<InputButton {...props} variant='single' color={color}>
|
||||
</FileUpload>
|
||||
<FileUpload {...props} variant='single' color={color}>
|
||||
Button
|
||||
</InputButton>
|
||||
</FileUpload>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -22,7 +22,7 @@ interface Props {
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
export default function InputButton({
|
||||
export default function FileUpload({
|
||||
className,
|
||||
style,
|
||||
variant,
|
||||
@@ -29,7 +29,7 @@ import IconoirGitFork from '~icons/iconoir/git-fork';
|
||||
// import { ExampleCourse } from 'src/stories/components/ConflictsWithWarning.stories';
|
||||
import DeleteForeverIcon from '~icons/material-symbols/delete-forever';
|
||||
|
||||
import InputButton from '../common/InputButton';
|
||||
import FileUpload from '../common/FileUpload';
|
||||
import { useMigrationDialog } from '../common/MigrationDialog';
|
||||
// import RefreshIcon from '~icons/material-symbols/refresh';
|
||||
import DevMode from './DevMode';
|
||||
@@ -383,9 +383,9 @@ export default function Settings(): JSX.Element {
|
||||
</Text>
|
||||
<p className='text-sm text-gray-600'>Import from a schedule file</p>
|
||||
</div>
|
||||
<InputButton variant='filled' color='ut-burntorange' onChange={handleImportClick}>
|
||||
<FileUpload variant='filled' color='ut-burntorange' onChange={handleImportClick}>
|
||||
Import Schedule
|
||||
</InputButton>
|
||||
</FileUpload>
|
||||
</div>
|
||||
|
||||
<Divider size='auto' orientation='horizontal' />
|
||||
|
||||
Reference in New Issue
Block a user