refactoring courseschedule storage

This commit is contained in:
Sriram Hariharan
2023-09-17 19:29:00 -05:00
parent 9658697d96
commit aea9b16f98
17 changed files with 83 additions and 59 deletions

View File

@@ -10,9 +10,9 @@ interface IOptionsStore {
shouldScrollToLoad: boolean;
}
export const optionsStore = createSyncStore<IOptionsStore>({
export const OptionsStore = createSyncStore<IOptionsStore>({
shouldHighlightConflicts: true,
shouldScrollToLoad: true,
});
debugStore({ optionsStore });
debugStore({ OptionsStore });

View File

@@ -1,23 +1,23 @@
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
import { UserSchedule } from 'src/shared/types/UserSchedule';
import { v4 as uuidv4 } from 'uuid';
interface IUserScheduleStore {
schedules: UserSchedule[];
activeIndex: number;
}
/**
* A store that is used for storing user schedules (and the active schedule)
*/
export const userScheduleStore = createLocalStore<IUserScheduleStore>({
export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
schedules: [
new UserSchedule({
courses: [],
id: uuidv4(),
name: 'Schedule 1',
creditHours: 0,
}),
],
activeIndex: 0,
});
debugStore({ userScheduleStore });
debugStore({ userScheduleStore: UserScheduleStore });