fix(navbar): show Dashboard instead of Classes label for admin users
Checklist:
- [x] I have read freeCodeCamp's contribution guidelines.
- [x] My pull request has a descriptive title
Closes #597
This PR dynamically renames the navbar link "Classes" to "Dashboard" for ADMIN users to match the actual destination page.
Changes:
- Added the custom
sessioncallback to NextAuth config to expose user roles to the client. - Added a helper function in
Navbarto recursively find and update the label for links to/classesbased on user role. - Added unit tests to
navbar.test.jsxto cover both admin and teacher role scenarios.
Thank you for testing the changes and for the feedback! I'd be happy to make the additional updates. I'll modify the implementation to hide the button when the user is not signed in and when the user's role is neither ADMIN nor TEACHER, then update the PR shortly.
Hi @utsab, Gentle ping for a final review on this. @NewtonLC has approved it. Thank you!
Hi @utsab @NewtonLC , just following up to see if you've had a chance to review this PR. In the meantime, I'll go ahead and resolve the merge conflicts in components/navbar.js. Thanks!
Hi Abirami, I apologize for the wait. At the moment, we still aren't able to give a clear date for when we can review and merge your PRs. I still appreciate your work on both of them and will definitely reach out once we are able to review them.
Hi @NewtonLC, Thanks for the update! No worries at all. Just reach out whenever the team is ready to review.
Hi @AbiramiR-27, sorry for the wait! We were able to merge in your navbar fix PR just now. Thank you for working on this!
Thank you so much for the update! I’m glad to see the PR merged. Thank you for reviewing and merging it!