Adds a toggle on navbar at the top of the page. The value is manged using redux in devU-client/src/redux/role.redux.ts, the final value is also stored in localstorage for persistence between page switches and reloads
For now the toggle can hide create buttons on the courses and assignments page.
If any page needs to access the role they can easily access this using
const role = useAppSelector((store) => store.roleMode)
which will give them access to the role value and a utility function isInstructor
e.g.
role.userRole // access the value itself
or
role.isInstructor() // utility function which returns true if toggled to instructor
Types of changes
What types of changes does your code introduce?
Put an x in the boxes that apply
[ ] Bugfix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation Update (if none of the other choices apply)
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. This is simply a reminder of what we are going to look for before merging your code.
[x] My changeset covers only what is described above (no extraneous changes)
[x] Lint and unit tests pass locally with my changes
[x] I have added tests that prove my fix is effective or that my feature works
[x] I have added necessary documentation (if appropriate)
Proposed changes
Adds a toggle on navbar at the top of the page. The value is manged using redux in
devU-client/src/redux/role.redux.ts
, the final value is also stored in localstorage for persistence between page switches and reloadsFor now the toggle can hide create buttons on the courses and assignments page.
If any page needs to access the role they can easily access this using
which will give them access to the role value and a utility function isInstructor
e.g.
Types of changes
What types of changes does your code introduce? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. This is simply a reminder of what we are going to look for before merging your code.