Redesign admin/staff sidebar: collapsible categories, icons, role-accurate nav #45
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/admin-nav-redesign"
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?
Summary
Redesigns the left-side navigation in the admin/staff area (
/admin). The sidebar was a flat, ungrouped list of 12 links with no hierarchy, no way to collapse anything, and role gating on only one item. This restructures it into collapsible category sections, adds a small icon per item, and makes each item's visibility match the server's role enforcement.All changes are contained to two files — no routes, server code, or view components were touched.
What changed
Grouped, collapsible navigation
The flat
NAVarray becomes a grouped structure rendered as an accordion:localStorage(admin.nav.collapsed).stroke="currentColor"style asProviderIcon.jsx— no new dependency; icons inherit the active/inactive text color).Role-accurate visibility
Previously only the Moderation item was role-gated; everything else was shown to both admin and editor, so an editor saw Settings / Users / Authentication / Discord Bot / Bot Activity links that 403 on use. Each item now carries a
rolesarray matching server-side enforcement (server/src/router/v1/admin/admin.routes.js):admin,editoradmin,moderatoradminadmin,editor,moderator; Account → everyoneGroups whose items are all filtered out for the current role are dropped, so no empty category headers render.
Hero Editor persists via the
adminOnlysettings endpoints, so it's grouped under System and gated to admins (it would 403 for editors otherwise).Existing moderator confinement is preserved unchanged — moderators still see only Moderation + Account, and the redirect that bounces them out of other sections still applies.
Rename
"Bot Activity" → "Web Bot Activity" (nav label + header title) to distinguish the bot-scoring / IP-ban view from the Discord Bot.
Files
client/src/routes/admin/AdminLayout.jsx— groupedNAV, inline-SVG icon set, per-item role filtering, accordion collapse state (localStorage + active-route auto-open), updatedTITLES.client/src/styles/theme.css— new.admin-nav-group / -head / -chev / -items / -linkclasses near.admin-grid; sidebar width (236px) and mobile stacking (max-width: 760px) unchanged; reuses existing color tokens only.Verification
npm run build(client) passes clean — 200 modules, no errors.Notes / possible follow-ups
ROLESconstant was introduced (roles remain string literals, matching the rest of the codebase) — a future cleanup could centralize them.adminOnlysettings. If editors should manage it, a dedicated staff-writable hero endpoint would let it move back into Content.🤖 Generated with Claude Code