feat: UTRP v2 migration (#292)
* feat: wip add course by url * chore: update imports * feat: add useCourseFromUrl hook * chore: extract logic into async function * feat: add checkLoginStatus.ts * feat: add useCourseMigration hook * feat: working course migration * fix: active schedule bug * feat: refactor logic and add to onUpdate * feat: update ui style * feat: add changelog functionality to settings * chore: update packages * feat: migration + sentry stuffs * feat: improve migration flow * docs: add sentry jsdocs * chore: fix lint and format * chore: cleanup + fix race condition --------- Co-authored-by: Samuel Gunter <sgunter@utexas.edu> Co-authored-by: Razboy20 <razboy20@gmail.com>
This commit is contained in:
@@ -93,7 +93,7 @@ export async function replaceSchedule(oldSchedule: UserSchedule, newSchedule: Us
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the active schedule to the one with the specified name.
|
||||
* Switches the active schedule to the one with the specified id.
|
||||
* @param id - The id of the schedule to switch to.
|
||||
* @returns A promise that resolves when the active schedule has been switched.
|
||||
*/
|
||||
@@ -103,3 +103,15 @@ export async function switchSchedule(id: string): Promise<void> {
|
||||
const activeIndex = schedules.findIndex(s => s.id === id);
|
||||
await UserScheduleStore.set('activeIndex', activeIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the active schedule to the one with the specified name.
|
||||
* @param name - The name of the schedule to switch to.
|
||||
* @returns A promise that resolves when the active schedule has been switched.
|
||||
*/
|
||||
export async function switchScheduleByName(name: string): Promise<void> {
|
||||
console.log('Switching schedule...');
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
const activeIndex = schedules.findIndex(s => s.name === name);
|
||||
await UserScheduleStore.set('activeIndex', activeIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user