-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Highlight Only Active Tab in Navigation Bar #9695
Fix: Highlight Only Active Tab in Navigation Bar #9695
Conversation
WalkthroughThe pull request modifies the active link detection mechanism in the navigation sidebar. A new Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/ui/sidebar/nav-main.tsx (1)
41-46
: Handle the null assertion operator.Forcing non-null with
activePath!
can mask potential issues if the hook returnsundefined
. Consider handling this scenario gracefully:-link.url.endsWith(activePath!) || -link.name.toLowerCase() === activePath!.split("/")[1] +link.url.endsWith(activePath ?? "") || +(activePath && link.name.toLowerCase() === activePath.split("/")[1])
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/ui/sidebar/nav-main.tsx
(3 hunks)src/hooks/useActiveLink.ts
(1 hunks)
🔇 Additional comments (3)
src/hooks/useActiveLink.ts (1)
16-16
: Good expansion of active link priority.The addition of
"/encounters"
,"/availability"
, and"/organization"
to theactiveLinkPriority
object appears consistent with the PR objective of accurately highlighting active links. Consider adding relevant test coverage to ensure these new paths are properly recognized as active.Also applies to: 21-21, 24-24
src/components/ui/sidebar/nav-main.tsx (2)
14-15
: New hook import.Great job importing the
useActiveLink
hook. Make sure to remove any remaining references toexactActiveClass
oractiveClass
from older code if they still persist in the repository.
25-25
: Usage clarity.The
useActiveLink
hook usage is simple and effective. Ensure there's adequate testing for edge cases whereuseActiveLink
might return undefined or an unexpected path.
…mra/care_fe into issues/9637/multiple-tabs-active
Proposed Changes
useActiveLink
hook to detect active path and removingexactActiveClass
andactiveClass
fromActiveLink
Component.@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
New Features
Refactor