From 429ae0827fec69b44a0e93d67be4e58d33a2cafd Mon Sep 17 00:00:00 2001
From: yiekheng
Date: Sun, 10 May 2026 21:08:40 +0800
Subject: [PATCH] fix(web): only ONE nav item highlighted at a time + drop
redundant Close
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Two related bugs from the same review pass:
1. /settings/users lit up BOTH the Admin and Settings entries in the
sidebar/drawer. The active-state check was naïve
`pathname.startsWith(href)`, which matches every parent prefix.
Replaced with a longest-match helper pickActiveNavKey() in
nav-config.ts: the most-specific item wins, parents stay quiet,
'/' only matches an exact pathname, and a strict-descendant check
(`href + '/'`) prevents `/settingsfoo` from lighting up Settings.
2. on the user-row delete (and three
other dialogs that I missed earlier) was rendering an extra outline
"Close" button next to the operator's own Cancel + Radix's corner X.
Stripped the prop from every remaining caller (login, dashboard
clear-history, reminder actions-bar, settings/users delete) so each
dialog footer shows just Cancel + the primary action.
Tests:
- nav-config.test.ts: 7 new cases covering the longest-match contract
— /settings/users highlights ONLY Admin, /settings highlights ONLY
Settings, '/' is exact-match only, sibling-prefix /settingsfoo
matches nothing, and a defense-in-depth probe asserts at-most-one
nav highlight across a representative pathname set.
- test/no-dialog-footer-show-close-button.test.ts: static guard that
grep-walks every production .tsx and fails if anything passes
`showCloseButton` to . Mirrors the existing
no-button-wrapping-card guard so the prop can't sneak back in.
Also self-checks the regex (matches single-line + multi-line +
other-prop combos; ignores clean DialogFooter and same-named props
on unrelated components).
463 → 477 web tests, all green; typecheck clean.
Co-Authored-By: Claude Opus 4.7 (1M context)
---
apps/web/src/app/login/login-form-client.tsx | 2 +-
apps/web/src/app/page.tsx | 2 +-
.../src/app/reminders/[id]/actions-bar.tsx | 2 +-
.../app/settings/users/user-row-client.tsx | 2 +-
apps/web/src/components/app-shell.tsx | 5 +-
apps/web/src/components/nav-config.test.ts | 88 +++++++++++++-
apps/web/src/components/nav-config.ts | 36 ++++++
...no-dialog-footer-show-close-button.test.ts | 112 ++++++++++++++++++
8 files changed, 243 insertions(+), 6 deletions(-)
create mode 100644 apps/web/src/test/no-dialog-footer-show-close-button.test.ts
diff --git a/apps/web/src/app/login/login-form-client.tsx b/apps/web/src/app/login/login-form-client.tsx
index 15cd900..41a2efb 100644
--- a/apps/web/src/app/login/login-form-client.tsx
+++ b/apps/web/src/app/login/login-form-client.tsx
@@ -87,7 +87,7 @@ export function LoginFormClient({ next }: { next: string }) {
Contact your administrator to reset it.
-
+