Make navigation bar application aware#47
Merged
Conversation
CharlesFarris
commented
May 23, 2026
Contributor
- Expand navigation bar functionality
- Add navigation bar item
- Add tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the shared navigation bar aware of authentication state and the current route so it can render different link sets and hide the link for the current page.
Changes:
- Refactor
Pageto require auth state +currentPathand render a newNavigationBarcomponent with typed props. - Introduce
NavigationBarItemto hide the current-route link and support generic<li>content (e.g., logout form). - Add/expand tests across shared components and feature pages to validate the new navigation behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/page.tsx | Makes Page accept auth/current-path props and renders NavigationBar. |
| src/shared/page.test.tsx | Updates Page tests for new props and asserts route-hiding behavior. |
| src/shared/navigationBarItem.tsx | Adds a reusable nav item component (link/generic). |
| src/shared/navigationBarItem.test.tsx | Adds unit tests for NavigationBarItem. |
| src/shared/navigationBar.tsx | Refactors nav into auth-aware component; adds “Add” link for authenticated users. |
| src/shared/navigationBar.test.tsx | Adds tests for authenticated/unauthenticated nav variants and current-route hiding. |
| src/features/login/loginPage.tsx | Updates login page to pass unauthenticated state + current path into Page. |
| src/features/login/loginPage.test.tsx | Routes test via pageRoutes and asserts nav hides current login link. |
| src/features/home/homePage.tsx | Updates home page to pass authenticated state + current path into Page. |
| src/features/home/homePage.test.tsx | Updates expectations for authenticated nav (e.g., hides Home link, shows logout). |
| src/features/add-todo/addToDoPage.tsx | Updates add-todo page to pass authenticated state + current path into Page. |
| src/features/add-todo/addToDoPage.test.tsx | Routes test via pageRoutes and asserts authenticated nav elements. |
| src/features/about/aboutPage.tsx | Updates about page to pass unauthenticated state + current path into Page. |
| src/features/about/aboutPage.test.tsx | Routes test via pageRoutes and asserts unauthenticated nav hides About link. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.