Conversation
|
I suggest taking a look at #1 which is related |
|
I don't think I'll get to doing a tabbed UI at least in this PR, however I could tweak this to save each course with an associated timetable name/id and hopefully avoid having to do another migration later on. Store all courses together.
or; Group courses into timetables.
I'm not very familiar with this project and the frameworks it uses so I'd hesitate before committing to doing the work required for option 2, however that would probably end up being best long-term from what I can see. |
0665722 to
c6777be
Compare
|
Rebased this PR on main and implemented functionality to migrate existing timetables to support term switching. Should be ready for review. |
|
To note: this doesn't use zustand's migration feature (https://zustand.docs.pmnd.rs/integrations/persisting-store-data#migrate), as I only learned of said feature after I finished the implementation. It should be relatively simple to refactor the migration code to use zustand however, so if that would be preferred then I can do as such. |
|
It looks like the unit tests are failing because new versions of node don't have localstorage enabled by default for some reason. You can fix it by specifying a localStorage file for node to use like this: |
Description
Store classes across multiple terms to allow switching terms without clearing classes.
Changes Made
Add
useSelectedTermstate hook to store selected term.Store
yearandtermproperties on each course in localStorage.Add
useTermCourseshook to get current courses for the selected term.Related Issues
Removes the need for #2, contributes to #1
Additional Notes
Unsure how migration of existing timetables saved before this PR is handled, need to test before merging.