Skip to content

fix(navbar): show Dashboard instead of Classes label for admin users#601

Open
AbiramiR-27 wants to merge 2 commits into
freeCodeCamp:mainfrom
AbiramiR-27:fix/admin-navbar-label
Open

fix(navbar): show Dashboard instead of Classes label for admin users#601
AbiramiR-27 wants to merge 2 commits into
freeCodeCamp:mainfrom
AbiramiR-27:fix/admin-navbar-label

Conversation

@AbiramiR-27

Copy link
Copy Markdown

Checklist:

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 session callback to NextAuth config to expose user roles to the client.
  • Added a helper function in Navbar to recursively find and update the label for links to /classes based on user role.
  • Added unit tests to navbar.test.jsx to cover both admin and teacher role scenarios.

@AbiramiR-27 AbiramiR-27 requested a review from a team as a code owner June 6, 2026 14:16

@NewtonLC NewtonLC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AbiramiR-27, thank you for working on this issue! I tested your code, and it works as expected. Before merging this though, I'd like to modify it to also hide this button if the user is not signed in, or if the user has a role other than ADMIN or TEACHER.

Would you be alright with adding those changes? If not, no worries! I can patch it later this week.

@AbiramiR-27

Copy link
Copy Markdown
Author

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.

@NewtonLC NewtonLC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! This PR is now awaiting a review from @utsab before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Admin navbar label shows “Classes” instead of “Dashboard”

2 participants