Keep the Buildings tab highlighted on building detail pages #111
Labels
No labels
backend
beginner friendly
bug
chore
documentation
enhancement
frontend
needs-triage
no-stale
priority/high
priority/low
priority/medium
size/L
size/M
size/S
size/XL
size/XS
stage/backlog
stage/done
stage/in progress
stage/in-progress
stage/ready
stale
wontfix
needs/docs
needs/research
needs/upstream
type/bug
type/external
type/feature
type/refactor
urgency
high
urgency
immediate
urgency
low
urgency
medium
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ScottyLabs/housing#111
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overall Objective
The Buildings navigation tab is highlighted while a user is on
/building-options. However, after the user selects a dorm and moves to a building-details URL such as/building/mudge, the highlight disappears.The user is still browsing the Buildings section, so the Buildings tab should remain highlighted. Please fix this behavior.
This issue only changes which navigation tab is highlighted.
Suggested Approach
Open
apps/frontend/src/components/Navbar.tsx.Near the beginning of the
Navbarcomponent, find:The component uses
pathnameto decide which navigation tab should be highlighted.Find the two
NavButtoncomponents named"Buildings". One is used by the desktop navigation bar, and the other is used by the mobile navigation bar.They currently contain:
This only recognizes the All Buildings page. It does not recognize building-detail URLs such as
/building/mudge.Under
const pathname = location.pathname;, create a reusable boolean:Keep the slash at the end of
"/building/". Using onlypathname.startsWith("/building")would also match/building-comparison, causing two navigation tabs to appear active.Update both Buildings
NavButtoncomponents to use the new boolean:Reuse the same boolean for desktop and mobile so their behavior stays consistent.
Help & Resources
No activity here for 21 days. If this is still live, drop a comment or push something and I'll clear the label. Otherwise it'll be unassigned on the next sweep.