Repository navigation
fix(settings): give admins a way back into Users and Usage analytics - #1630
Conversation
The Settings consolidation (#1544) dropped the only entry point to the two admin pages: `/v2/admin/users` and `/v2/admin/analytics` kept their routes and still render (checked live: 142 users, 50 signups / 30d, the activation funnel), but nothing linked to them, so the user-stats view Sam relies on was reachable only by typing the URL. Adds an admin-only Administration section at the end of Settings — two bordered link rows, ink label + muted detail — and the matching nav entry. Members see nothing new. Test: a member renders no Administration link or Usage analytics text; an admin gets the section with both links pointing at the existing routes. The Settings suite now renders under a MemoryRouter because the page links. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JavWvyVL478UfEhJjcfMgX
lilyshen0722
left a comment
There was a problem hiding this comment.
APPROVED at a78dc9272f5f9be3ba063d4e0136e0f26c920202.
The orphan premise is exact
On origin/main, the only live reference to /v2/admin/users is V2AdminAnalytics.tsx:160 — a crosslink from one orphaned page to the other. The other hit, components/UserProfile.tsx, is not routed in App.tsx, so it is unreachable. Nothing in the shell led into either page.
The role test discriminates in both directions
| mutation | result |
|---|---|
isAdmin = true (section shown to everyone) |
1 red |
isAdmin = false (hidden from admins too) |
1 red |
Control 5/5. Both halves matter: a one-sided test would pass while leaking the section to members, or while silently never rendering it for the admins it exists for.
The security question this PR raises, answered
Adding a link increases discoverability, so it is only safe if the pages are gated server-side rather than by the link's absence. They are: backend/routes/admin/analytics.ts mounts auth + adminAuth on both /funnel and /usage, behind a read limiter. The client-side isAdmin is therefore a presentation choice, not the boundary — a member who types the URL still gets nothing.
I checked that rather than assuming, because "restore the missing link" would be the wrong change if absence had been doing the gating.
On the class
This is #1627's lesson inverted, as the description says: a consolidation that folds a page has to grep for every link into the pages it stops listing, not just the pages it removes. Both instances this week were reachable-surface bookkeeping rather than logic errors, and in both cases the code behind the missing link still worked perfectly.
lilyshen0722
left a comment
There was a problem hiding this comment.
UX-GATE: APPROVED @ a78dc92 — waved through by inspection: two bordered link rows (1px #d0d5dd, r4, 10px 12px, hover #f2f4f7) with a 600 13/18 label and a 12px muted detail, admin-only, in the existing Settings section grammar; nothing sub-floor, no new colour, no shadow. Not walked in a browser; a settings pass under Signal is Coverage-page work, not this fix.
The admin user-stats view was not deleted, only orphaned. The Settings consolidation (#1544) removed the last link to
/v2/admin/usersand/v2/admin/analytics; both routes survived and both pages still render (checked live in Sam's session: 142 users, 50 signups in 30 days, the activation funnel), but nothing in the shell led to them.Fix
An admin-only Administration section at the end of Settings, with two bordered link rows (Users · Usage analytics) and the matching left-nav entry. Members see nothing new; the pages keep their
ProtectedRoute requireAdmin.Proof
MemoryRouterbecause the page links.🤖 Generated with Claude Code
https://claude.ai/code/session_01JavWvyVL478UfEhJjcfMgX