* feat(ui): add time and location to popup * feat(ui): memoize meeting times * feat(ui): remove resizing * feat(ui): add no select to copy course id button * feat(ui): complete update to popup and course blocks * chore: update settings page * chore: fix types * fix(ui): update spacing, padding, and remove last updated section * chore: fix type issues * fix(ui): update borders to offwhite/50 * fix(ui): apply proper offwhite styling * fix(ui): add unique key to async courses in bottom bar
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import { createSyncStore, debugStore } from 'chrome-extension-toolkit';
|
|
|
|
/**
|
|
* A store that is used for storing user options
|
|
*/
|
|
export interface IOptionsStore {
|
|
/** whether we should enable course status chips (indicator for waitlisted, cancelled, and closed courses) */
|
|
enableCourseStatusChips: boolean;
|
|
|
|
/** whether we should automatically highlight conflicts on the course schedule page (adds a red strikethrough to courses that have conflicting times) */
|
|
enableHighlightConflicts: boolean;
|
|
|
|
/** whether we should automatically scroll to load more courses on the course schedule page (without having to click next) */
|
|
enableScrollToLoad: boolean;
|
|
|
|
/** whether we should automatically refresh the data for the waitlist, course status, and other info with the latest data from UT's site */
|
|
enableDataRefreshing: boolean;
|
|
|
|
/** whether we should open the calendar in a new tab; default is to focus an existing calendar tab */
|
|
alwaysOpenCalendarInNewTab: boolean;
|
|
}
|
|
|
|
export const OptionsStore = createSyncStore<IOptionsStore>({
|
|
enableCourseStatusChips: false,
|
|
enableHighlightConflicts: true,
|
|
enableScrollToLoad: true,
|
|
enableDataRefreshing: false,
|
|
alwaysOpenCalendarInNewTab: false,
|
|
});
|
|
|
|
/**
|
|
* Initializes the settings by retrieving the values from the OptionsStore.
|
|
*
|
|
* @returns A promise that resolves to an object satisfying the IOptionsStore interface.
|
|
*/
|
|
export const initSettings = async () =>
|
|
({
|
|
enableCourseStatusChips: await OptionsStore.get('enableCourseStatusChips'),
|
|
enableHighlightConflicts: await OptionsStore.get('enableHighlightConflicts'),
|
|
enableScrollToLoad: await OptionsStore.get('enableScrollToLoad'),
|
|
enableDataRefreshing: await OptionsStore.get('enableDataRefreshing'),
|
|
alwaysOpenCalendarInNewTab: await OptionsStore.get('alwaysOpenCalendarInNewTab'),
|
|
}) satisfies IOptionsStore;
|
|
|
|
// Clothing retailer right
|
|
|
|
debugStore({ OptionsStore });
|