From 2c663f4ad5a7678e443e74b451506ce7e6b058dc Mon Sep 17 00:00:00 2001 From: ngqile Date: Tue, 1 Dec 2026 23:58:45 +0800 Subject: [PATCH 1/2] docs: design and OpenSpec change for sidebar categories Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- .../2026-12-01-sidebar-categories-design.md | 30 +++++++++++++++++++ .../group-sidebar-categories/.openspec.yaml | 2 ++ .../group-sidebar-categories/design.md | 20 +++++++++++++ .../group-sidebar-categories/proposal.md | 27 +++++++++++++++++ .../specs/admin-visual-design/spec.md | 26 ++++++++++++++++ .../changes/group-sidebar-categories/tasks.md | 9 ++++++ 6 files changed, 114 insertions(+) create mode 100644 docs/superpowers/specs/2026-12-01-sidebar-categories-design.md create mode 100644 openspec/changes/group-sidebar-categories/.openspec.yaml create mode 100644 openspec/changes/group-sidebar-categories/design.md create mode 100644 openspec/changes/group-sidebar-categories/proposal.md create mode 100644 openspec/changes/group-sidebar-categories/specs/admin-visual-design/spec.md create mode 100644 openspec/changes/group-sidebar-categories/tasks.md diff --git a/docs/superpowers/specs/2026-12-01-sidebar-categories-design.md b/docs/superpowers/specs/2026-12-01-sidebar-categories-design.md new file mode 100644 index 0000000..323baa9 --- /dev/null +++ b/docs/superpowers/specs/2026-12-01-sidebar-categories-design.md @@ -0,0 +1,30 @@ +# Sidebar categories + +Date: 2026-12-01. Owner approved the grouping below on 2026-12-01. + +## Intent + +The sidebar is a flat list of work pages with one "Administration" section. The owner wants the modules grouped into clear categories and the menu cleaned up before go-live, and the WhatsApp inbox will need a home in it next. + +## Decisions (owner-approved) + +- Always-open labelled sections, not collapsible groups: 12 items do not need extra clicks. +- Categories and order: + - Dashboard (no label, first) + - **Events:** Events, Event leads + - **Leads:** Leads, Interests (the WhatsApp inbox joins here later) + - **Access:** Users, Roles, Login security + - **System:** Companies, Emails, Audit log +- Each section has the existing thin divider and small muted label. The collapsed rail shows dividers only. +- A section with nothing the user may open does not show. +- Within a section, items follow the order above, not the server's order. A module missing from the map goes into a final unlabelled section at the end, so nothing disappears. +- Every item has a distinct icon: Login security moves from `Shield` (too close to Roles' `ShieldCheck`) to `LockKeyhole`. + +## Approach (my call) + +The server's menu tree is flat, so the grouping stays in the portal as one fixed category map. It replaces the single admin list. The icon override for Login security lives in the same map, so no database change is needed. The portal icon map, which still carries babyboo icons for inventory, POS and catalogue modules Co-Lite does not have, is trimmed to the icons Co-Lite seeds plus the fallback. + +## Non-goals + +- Renaming modules, changing permissions or the server menu. +- Collapsible groups. diff --git a/openspec/changes/group-sidebar-categories/.openspec.yaml b/openspec/changes/group-sidebar-categories/.openspec.yaml new file mode 100644 index 0000000..785b150 --- /dev/null +++ b/openspec/changes/group-sidebar-categories/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-12-01 diff --git a/openspec/changes/group-sidebar-categories/design.md b/openspec/changes/group-sidebar-categories/design.md new file mode 100644 index 0000000..23b2f04 --- /dev/null +++ b/openspec/changes/group-sidebar-categories/design.md @@ -0,0 +1,20 @@ +## Context + +See `docs/superpowers/specs/2026-12-01-sidebar-categories-design.md`. Task 1.2 of `refine-visitor-pages-and-shell` introduced `ADMIN_MODULES` and a two-way split in `SidebarNav`, with a visible label naming each list (`aria-labelledby`, plus `aria-label` in the rail). + +## Goals / Non-Goals + +**Goals:** fixed categories and order, a distinct icon for every item, and a trimmed icon map. + +**Non-Goals:** server menu changes, collapsible groups, renames. + +## Decisions + +- **The category map replaces `ADMIN_MODULES`.** `SIDEBAR_SECTIONS` in `aclSidebar.ts` is an ordered list of `{ label?: string; modules: string[] }`, with Dashboard as the first entry without a label. A helper `groupSidebar(links)` returns the sections in map order, each with its links in map order. Links not in the map go into a trailing section without a label. Empty sections are dropped. `SidebarNav` renders each section with the existing divider, label and list pattern; the first section has no divider. +- **Icon override in the portal.** `SIDEBAR_ICONS: Record` (module name to lucide name), holding `BO_LOGIN_SECURITY: "LockKeyhole"`, is applied in `groupSidebar` over the server's `iconName`. No SQL change. +- **Icon map trim.** Keep only the icon names Co-Lite seeds (`local/seed/03-colite.sql` and the archived change SQL), `Store` (Companies, added by `useAclSidebar`), `LockKeyhole`, and the fallback. Check `icon-map` tests before removing anything; an existing test asserting a babyboo icon is a conflict to report. +- **Labels** are new keys in `defaultMessages.ts` (`SidebarSectionEvents`, `SidebarSectionLeads`, `SidebarSectionAccess`, `SidebarSectionSystem`). `SidebarAdministration` is removed. + +## Risks / Trade-offs + +- A new server module shows in the trailing section until it is added to the map. That is visible and harmless. Keep the `ponytail:` note. diff --git a/openspec/changes/group-sidebar-categories/proposal.md b/openspec/changes/group-sidebar-categories/proposal.md new file mode 100644 index 0000000..eff5c0c --- /dev/null +++ b/openspec/changes/group-sidebar-categories/proposal.md @@ -0,0 +1,27 @@ +## Why + +The sidebar lists work pages and then one "Administration" section. The owner asked for the modules to be grouped into categories and cleaned up before go-live. The WhatsApp inbox, which comes next, needs a clear place in the menu. + +## What Changes + +- The sidebar shows labelled sections: Dashboard on its own, then Events, Leads, Access and System. +- Items follow a fixed order within each section. A module missing from the map goes into a final section, so nothing disappears. +- Login security gets its own icon (`LockKeyhole`). +- The portal icon map drops babyboo icons for modules Co-Lite does not have. +- The "Administration" label is replaced by the new section labels. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `admin-visual-design`: the Sidebar Sections requirement now describes the categories. + +## Impact + +- Portal only: `app/lib/aclSidebar.ts`, `app/components/app/Sidebar.tsx`, the icon map, `defaultMessages.ts` (section labels), and DESIGN.md (Navigation). +- No server, database or API change. +- Design: `docs/superpowers/specs/2026-12-01-sidebar-categories-design.md`. diff --git a/openspec/changes/group-sidebar-categories/specs/admin-visual-design/spec.md b/openspec/changes/group-sidebar-categories/specs/admin-visual-design/spec.md new file mode 100644 index 0000000..99f0c05 --- /dev/null +++ b/openspec/changes/group-sidebar-categories/specs/admin-visual-design/spec.md @@ -0,0 +1,26 @@ +## MODIFIED Requirements + +### Requirement: Sidebar Sections + +The sidebar SHALL show Dashboard first, then the labelled sections Events, Leads, Access and System, each with a fixed set and order of pages. A page not in any section SHALL appear in a final section without a label. A section SHALL be marked by a divider and a small muted label, with only the divider in the collapsed rail, and SHALL NOT show when it has no page the user may open. Every page SHALL have a distinct icon. + +#### Scenario: Super admin sidebar + +- **WHEN** a super admin opens the portal +- **THEN** the sidebar shows Dashboard, then "Events" with Events and Event leads, "Leads" with Leads and Interests, "Access" with Users, Roles and Login security, and "System" with Companies, Emails and Audit log + +#### Scenario: Staff without admin pages + +- **WHEN** a staff user who can open only Events and Event leads opens the portal +- **THEN** the sidebar shows only the "Events" section +- **AND** no "Leads", "Access" or "System" label + +#### Scenario: Unknown page + +- **WHEN** the server menu has a page that is not in the category map +- **THEN** it is listed after the System section, without a label + +#### Scenario: Collapsed rail + +- **WHEN** an admin collapses the sidebar to the icon rail +- **THEN** the sections are separated by dividers and no section label shows diff --git a/openspec/changes/group-sidebar-categories/tasks.md b/openspec/changes/group-sidebar-categories/tasks.md new file mode 100644 index 0000000..23930c1 --- /dev/null +++ b/openspec/changes/group-sidebar-categories/tasks.md @@ -0,0 +1,9 @@ +# Tasks: group-sidebar-categories + +Portal only. TDD, then the review gate. Verify: `cd solvway-admin-portal && npx vitest run; echo VITEST=$? && npx tsc --noEmit && npm run lint` (check the vitest exit code). + +- [ ] 1.1 Category map, `groupSidebar`, the icon override, section rendering in `SidebarNav` (full, drawer and rail), and the label keys. The "Administration" label and `ADMIN_MODULES` go. + - Scope: `solvway-admin-portal/app/lib/aclSidebar*`, `solvway-admin-portal/app/components/app/Sidebar*`, `solvway-admin-portal/app/lib/i18n/defaultMessages.ts` +- [ ] 1.2 Trim the icon map to the icons Co-Lite uses. + - Scope: the icon map file and its tests +- [ ] 1.3 DESIGN.md Navigation updated, and a Playwright check at 1280 px (full and rail) and 360 px (drawer) as a super admin, plus a staff user with event pages only. -- 2.54.1 From 75e243f3bb85c626adba6216de498950015e741a Mon Sep 17 00:00:00 2001 From: ngqile Date: Wed, 2 Dec 2026 00:19:18 +0800 Subject: [PATCH 2/2] feat: sidebar groups pages into Events, Leads, Access and System Labelled sections replace the single Administration divider, Login security gets its own lock icon, and the icon map drops the babyboo icons Co-Lite does not use. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- .../changes/group-sidebar-categories/tasks.md | 11 ++- solvway-admin-portal/DESIGN.md | 2 +- .../components/app/Sidebar.sections.test.tsx | 66 ++++++++++----- .../app/components/app/Sidebar.test.tsx | 13 +-- .../app/components/app/Sidebar.tsx | 61 ++++++++------ .../components/app/icon-map.activity.test.tsx | 13 --- .../app/components/app/icon-map.test.tsx | 83 ++++--------------- .../app/components/app/icon-map.ts | 83 ++++--------------- solvway-admin-portal/app/lib/aclSidebar.ts | 28 ++++++- .../app/lib/i18n/defaultMessages.ts | 5 +- 10 files changed, 156 insertions(+), 209 deletions(-) delete mode 100644 solvway-admin-portal/app/components/app/icon-map.activity.test.tsx diff --git a/openspec/changes/group-sidebar-categories/tasks.md b/openspec/changes/group-sidebar-categories/tasks.md index 23930c1..be5686c 100644 --- a/openspec/changes/group-sidebar-categories/tasks.md +++ b/openspec/changes/group-sidebar-categories/tasks.md @@ -2,8 +2,13 @@ Portal only. TDD, then the review gate. Verify: `cd solvway-admin-portal && npx vitest run; echo VITEST=$? && npx tsc --noEmit && npm run lint` (check the vitest exit code). -- [ ] 1.1 Category map, `groupSidebar`, the icon override, section rendering in `SidebarNav` (full, drawer and rail), and the label keys. The "Administration" label and `ADMIN_MODULES` go. +- [x] 1.1 Category map, `groupSidebar`, the icon override, section rendering in `SidebarNav` (full, drawer and rail), and the label keys. The "Administration" label and `ADMIN_MODULES` go. - Scope: `solvway-admin-portal/app/lib/aclSidebar*`, `solvway-admin-portal/app/components/app/Sidebar*`, `solvway-admin-portal/app/lib/i18n/defaultMessages.ts` -- [ ] 1.2 Trim the icon map to the icons Co-Lite uses. +- [x] 1.2 Trim the icon map to the icons Co-Lite uses. - Scope: the icon map file and its tests -- [ ] 1.3 DESIGN.md Navigation updated, and a Playwright check at 1280 px (full and rail) and 360 px (drawer) as a super admin, plus a staff user with event pages only. +- [x] 1.3 DESIGN.md Navigation updated, and a Playwright check at 1280 px (full and rail) and 360 px (drawer) as a super admin, plus a staff user with event pages only. + - Done 2026-12-02 on the local stack: + - Playwright as super admin: the full sidebar at 1280 px (Dashboard, then Events, Leads, Access and System with labels and dividers), the collapsed rail (dividers only, Login security with its lock icon), and the drawer at 360 px. + - The staff-only scenario (event pages only) is covered by `Sidebar.sections.test.tsx`. No browser sign-in was done for it, because no local staff user has only those modules. + - Icon map trimmed to Co-Lite's 12 icons. The babyboo-only icon tests were removed, and the Activity-group test file was deleted. + - Portal verify: vitest 1572 passed (exit 0), tsc 0, lint 0 errors. diff --git a/solvway-admin-portal/DESIGN.md b/solvway-admin-portal/DESIGN.md index 3b480b4..b3be69c 100644 --- a/solvway-admin-portal/DESIGN.md +++ b/solvway-admin-portal/DESIGN.md @@ -237,7 +237,7 @@ Quiet, compact, unmistakable. - Live inside a card or an 8px framed container. Header row in slate tint, 40px tall, 12px semibold uppercase muted labels with sort chevrons; cells 14px with 8px padding; rows separated by hairlines, hovering at 50% slate tint. The pager below reads "1-7 of 7" left and outline Previous / Next right. ### Navigation -- **Sidebar:** white, right hairline. Items are 44px tall, 8px radius, 20px outline icon plus 14px medium label. Idle: muted slate, hover slate tint with ink. Active: blue tint with deep blue ink, `aria-current="page"`. Groups expand with a rotating chevron and indent children behind a left hairline. The collapsed rail shows icons only, with groups opening as a side popover. Admin pages (Users, Roles, Emails, Login security, Audit log, Companies) sit below a hairline divider and a 12px semibold muted "Administration" label; the rail keeps the divider only, and a section with nothing to open is not drawn. +- **Sidebar:** white, right hairline. Items are 44px tall, 8px radius, 20px outline icon plus 14px medium label. Idle: muted slate, hover slate tint with ink. Active: blue tint with deep blue ink, `aria-current="page"`. Groups expand with a rotating chevron and indent children behind a left hairline. The collapsed rail shows icons only, with groups opening as a side popover. Pages are grouped into always-open sections: Dashboard alone, then Events (Events, Event leads), Leads (Leads, Interests), Access (Users, Roles, Login security) and System (Companies, Emails, Audit log). Each later section starts with a hairline divider and a 12px semibold muted label; the rail keeps the dividers only, a section with nothing to open is not drawn, and a page the map does not know trails in a last unlabelled section. Every page has its own icon. - **Header:** white, bottom hairline, 56px; the link back to the parent page left (sub-pages only); company picker (a styled select), locale switcher, theme toggle and user menu (blue avatar initial) right. ### Data States diff --git a/solvway-admin-portal/app/components/app/Sidebar.sections.test.tsx b/solvway-admin-portal/app/components/app/Sidebar.sections.test.tsx index 329a28d..f836ac9 100644 --- a/solvway-admin-portal/app/components/app/Sidebar.sections.test.tsx +++ b/solvway-admin-portal/app/components/app/Sidebar.sections.test.tsx @@ -9,46 +9,70 @@ vi.mock("@/app/lib/useAclSidebar", () => ({ useAclSidebar: () => state.links })) import { SidebarNav } from "./Sidebar"; -const link = (name: string): SidebarLink => ({ name, url: `/${name}`, children: [] }); +const link = (name: string): SidebarLink => ({ name, url: `/${name}`, iconName: "Users", children: [] }); const names = (...n: string[]) => n.map(link); const ALL = names( "BO_DASHBOARD", "BO_EVENTS", "BO_EVENT_LEADS", "BO_INTERESTS", "BO_LEADS", "BO_USERS", "BO_ROLES", "BO_EMAILS", "BO_LOGIN_SECURITY", "BO_AUDIT_LOG", "BO_COMPANIES", ); +const linkNames = (list: HTMLElement) => within(list).getAllByRole("link").map((a) => a.getAttribute("href")?.slice(1)); describe("Sidebar sections", () => { - it("lists work pages above the Administration label and admin pages below it", () => { - state.links = ALL; + it("lists Dashboard, then Events, Leads, Access and System sections in order", () => { + state.links = [...ALL].reverse(); render(); - const label = screen.getByText("Administration"); - const before = (el: HTMLElement) => label.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_PRECEDING; - const after = (el: HTMLElement) => label.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING; - const hrefs = (re: RegExp) => screen.getAllByRole("link").filter((a) => re.test(a.getAttribute("href") ?? "")); - for (const a of hrefs(/DASHBOARD|EVENTS|EVENT_LEADS|INTERESTS|LEADS/)) expect(before(a)).toBeTruthy(); - for (const a of hrefs(/USERS|ROLES|EMAILS|LOGIN_SECURITY|AUDIT_LOG|COMPANIES/)) expect(after(a)).toBeTruthy(); + const lists = screen.getAllByRole("list"); + expect(lists).toHaveLength(5); + expect(linkNames(lists[0])).toEqual(["BO_DASHBOARD"]); + expect(linkNames(screen.getByRole("list", { name: "Events" }))).toEqual(["BO_EVENTS", "BO_EVENT_LEADS"]); + expect(linkNames(screen.getByRole("list", { name: "Leads" }))).toEqual(["BO_LEADS", "BO_INTERESTS"]); + expect(linkNames(screen.getByRole("list", { name: "Access" }))).toEqual(["BO_USERS", "BO_ROLES", "BO_LOGIN_SECURITY"]); + expect(linkNames(screen.getByRole("list", { name: "System" }))).toEqual(["BO_COMPANIES", "BO_EMAILS", "BO_AUDIT_LOG"]); expect(screen.getAllByRole("link")).toHaveLength(11); }); - it("names the admin list by the label", () => { - state.links = ALL; - render(); - const list = screen.getByRole("list", { name: "Administration" }); - expect(within(list).getAllByRole("link")).toHaveLength(6); - }); - - it("shows no Administration label or divider when no admin module is available", () => { + it("shows only the sections the user has pages in", () => { state.links = names("BO_EVENTS", "BO_EVENT_LEADS"); const { container } = render(); - expect(screen.queryByText("Administration")).toBeNull(); + expect(screen.getByRole("list", { name: "Events" })).toBeTruthy(); + for (const label of ["Leads", "Access", "System"]) expect(screen.queryByText(label)).toBeNull(); expect(container.querySelector("[data-slot='sidebar-divider']")).toBeNull(); }); - it("shows only the divider in the collapsed rail", () => { + it("puts a divider between sections but not above the first", () => { + state.links = ALL; + const { container } = render(); + expect(container.querySelectorAll("[data-slot='sidebar-divider']")).toHaveLength(4); + expect(container.querySelector("nav")!.firstElementChild!.tagName).toBe("UL"); + }); + + it("lists an unknown page after System without a label", () => { + state.links = [...ALL, link("BO_NEW_THING")]; + const { container } = render(); + const lists = screen.getAllByRole("list"); + expect(lists).toHaveLength(6); + const last = lists[5]; + expect(linkNames(last)).toEqual(["BO_NEW_THING"]); + expect(last.getAttribute("aria-labelledby")).toBeNull(); + expect(last.getAttribute("aria-label")).toBeNull(); + expect(container.querySelectorAll("[data-slot='sidebar-divider']")).toHaveLength(5); + }); + + it("shows dividers and no labels in the collapsed rail", () => { state.links = ALL; const { container } = render(); - expect(screen.queryByText("Administration")).toBeNull(); - expect(container.querySelector("[data-slot='sidebar-divider']")).not.toBeNull(); + for (const label of ["Events", "Leads", "Access", "System"]) expect(screen.queryByText(label)).toBeNull(); + expect(container.querySelectorAll("[data-slot='sidebar-divider']")).toHaveLength(4); + expect(screen.getByRole("list", { name: "Access" })).toBeTruthy(); expect(screen.getAllByRole("link")).toHaveLength(11); }); + + it("renders Login security with a different icon than Roles", () => { + state.links = [{ ...link("BO_ROLES"), iconName: "Shield" }, { ...link("BO_LOGIN_SECURITY"), iconName: "Shield" }]; + render(); + const icon = (name: string) => document.querySelector(`a[href='/${name}'] svg`)!.getAttribute("class"); + expect(icon("BO_ROLES")).toContain("lucide-shield"); + expect(icon("BO_LOGIN_SECURITY")).toContain("lucide-lock-keyhole"); + }); }); diff --git a/solvway-admin-portal/app/components/app/Sidebar.test.tsx b/solvway-admin-portal/app/components/app/Sidebar.test.tsx index ec770f6..6745f78 100644 --- a/solvway-admin-portal/app/components/app/Sidebar.test.tsx +++ b/solvway-admin-portal/app/components/app/Sidebar.test.tsx @@ -24,12 +24,13 @@ vi.mock("@/app/lib/useAclSidebar", () => ({ import Sidebar from "./Sidebar"; +// Icons are Co-Lite seed icons (group-sidebar-categories trimmed the babyboo-only ones). const BO_FIXTURE: SidebarLink[] = [ { name: "Dashboard", url: "/", iconName: "LayoutDashboard", children: [] }, { name: "Members", url: "/members", iconName: "Users", children: [] }, - { name: "Reports", url: "/reports", iconName: "FileText", children: [] }, - { name: "Network", url: "/network", iconName: "Network", children: [] }, - { name: "Messages", url: "/messages", iconName: "Languages", children: [] }, + { name: "Reports", url: "/reports", iconName: "Mail", children: [] }, + { name: "Network", url: "/network", iconName: "ScrollText", children: [] }, + { name: "Messages", url: "/messages", iconName: "Tags", children: [] }, ]; describe("Sidebar icon rendering", () => { @@ -41,9 +42,9 @@ describe("Sidebar icon rendering", () => { expect(screen.getByText("Messages")).toBeInTheDocument(); expect(container.querySelector("svg.lucide-layout-dashboard")).not.toBeNull(); expect(container.querySelector("svg.lucide-users")).not.toBeNull(); - expect(container.querySelector("svg.lucide-file-text")).not.toBeNull(); - expect(container.querySelector("svg.lucide-network")).not.toBeNull(); - expect(container.querySelector("svg.lucide-languages")).not.toBeNull(); + expect(container.querySelector("svg.lucide-mail")).not.toBeNull(); + expect(container.querySelector("svg.lucide-scroll-text")).not.toBeNull(); + expect(container.querySelector("svg.lucide-tags")).not.toBeNull(); }); it("renders the neutral fallback icon, and does not throw, for an unknown or absent iconName", () => { diff --git a/solvway-admin-portal/app/components/app/Sidebar.tsx b/solvway-admin-portal/app/components/app/Sidebar.tsx index 117f993..4657ed4 100644 --- a/solvway-admin-portal/app/components/app/Sidebar.tsx +++ b/solvway-admin-portal/app/components/app/Sidebar.tsx @@ -1,11 +1,11 @@ "use client"; -import { useEffect, useId, useState } from "react"; +import { Fragment, useEffect, useId, useState } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { ChevronDown, PanelLeftClose, PanelLeftOpen } from "lucide-react"; import { useAclSidebar } from "@/app/lib/useAclSidebar"; -import { ADMIN_MODULES, currentTrail, type SidebarLink } from "@/app/lib/aclSidebar"; +import { currentTrail, groupSidebar, type SidebarLink } from "@/app/lib/aclSidebar"; import { useT } from "@/app/lib/i18n/MessagesProvider"; import { iconFor } from "./icon-map"; import { cn } from "@/app/lib/utils"; @@ -215,39 +215,48 @@ function RailGroup({ export function SidebarNav({ onNavigate, collapsed = false }: { onNavigate?: () => void; collapsed?: boolean }) { const t = useT(); const links = useAclSidebar(); - const trail = currentTrail(links, usePathname()); - const adminLabelId = useId(); - - const work = links.filter((l) => !ADMIN_MODULES.includes(l.name)); - const admin = links.filter((l) => ADMIN_MODULES.includes(l.name)); + const sections = groupSidebar(links); + // Trail from the grouped links: groupSidebar copies them, and active matching is by identity. + const trail = currentTrail(sections.flatMap((s) => s.links), usePathname()); + const idBase = useId(); const render = (link: SidebarLink) => collapsed ? ( ) : ( ); - const listClass = cn("space-y-1", collapsed ? "px-2 py-3" : "p-3"); return ( ); } diff --git a/solvway-admin-portal/app/components/app/icon-map.activity.test.tsx b/solvway-admin-portal/app/components/app/icon-map.activity.test.tsx deleted file mode 100644 index f97fc4c..0000000 --- a/solvway-admin-portal/app/components/app/icon-map.activity.test.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { render } from "@testing-library/react"; -import { describe, it, expect } from "vitest"; -import { iconFor } from "./icon-map"; - -// add-online-users: the Activity group (BO_NAV_ACTIVITY), Online users and Audit log seed icons. -describe("iconFor — Activity group", () => { - it.each(["Activity", "UserCheck", "ScrollText"])("resolves %s to a real (non-fallback) icon", (name) => { - const Icon = iconFor(name); - const { container } = render(