diff --git a/docs/frontend.md b/docs/frontend.md
index f52569b44..bb22efac8 100644
--- a/docs/frontend.md
+++ b/docs/frontend.md
@@ -34,6 +34,14 @@ nextjs-frontend/
app/openapi-client/ generated from the API's OpenAPI schema; never edit by hand
```
+## Navigation
+
+The nav rail (`components/app-shell/nav-config.ts`) is in four groups, each named above its first item (a line when
+the rail is collapsed to icons): what people use every day (Home, Library, Search, Chat, Notes), **Explore** what Lens
+found (Entities, Topics, Graph, Podcasts, Reports), **Automate** what runs by itself (Pipelines, Routines, Extensions,
+Sensors, or Sources for people who aren't admins), and **Manage** Lens (Costs, Analytics, Settings, Admin). Every page
+stays one click from Home; ⌘K reaches every page, recording and setting by name.
+
## Design system
Colour is semantic, never decorative: blue means working, selected or a link; green means ready or succeeded; red
diff --git a/nextjs-frontend/__tests__/nav-groups.test.tsx b/nextjs-frontend/__tests__/nav-groups.test.tsx
new file mode 100644
index 000000000..03dd5397d
--- /dev/null
+++ b/nextjs-frontend/__tests__/nav-groups.test.tsx
@@ -0,0 +1,31 @@
+import { render, screen } from "@testing-library/react";
+import "@testing-library/jest-dom";
+
+import { Nav } from "@/components/app-shell/nav";
+import { TooltipProvider } from "@/components/ui/tooltip";
+
+jest.mock("next/navigation", () => ({ usePathname: () => "/settings/llm" }));
+jest.mock("@/components/notes/notes-tree", () => ({ NotesTree: () => null }));
+
+const nav = (collapsed: boolean) =>
+ render(
+
+
+ ,
+ );
+
+test("names each group above its first item", () => {
+ nav(false);
+ const text = screen.getByRole("navigation", { name: "Primary" }).textContent ?? "";
+ expect(text.indexOf("Explore")).toBeLessThan(text.indexOf("Entities"));
+ expect(text.indexOf("Notes")).toBeLessThan(text.indexOf("Explore"));
+ expect(text.indexOf("Automate")).toBeLessThan(text.indexOf("Pipelines"));
+ expect(text.indexOf("Manage")).toBeLessThan(text.indexOf("Costs"));
+ expect(screen.getByRole("link", { name: "Settings" })).toHaveAttribute("aria-current", "page");
+});
+
+test("collapsed to icons, the groups are lines rather than names", () => {
+ nav(true);
+ expect(screen.queryByText("Explore")).not.toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Entities" })).toBeInTheDocument();
+});
diff --git a/nextjs-frontend/__tests__/navigation.test.ts b/nextjs-frontend/__tests__/navigation.test.ts
index 02e8f0a66..7f4497f5d 100644
--- a/nextjs-frontend/__tests__/navigation.test.ts
+++ b/nextjs-frontend/__tests__/navigation.test.ts
@@ -20,6 +20,19 @@ describe("navigation", () => {
);
});
+ it("keeps each group together, in order: every day, Explore, Automate, Manage", () => {
+ for (const admin of [true, false]) {
+ const groups = navFor(admin).map((i) => i.group);
+ const order = groups.filter((g, i) => g !== groups[i - 1]);
+ expect(order).toEqual(["", "Explore", "Automate", "Manage"]);
+ }
+ expect(
+ navFor(true)
+ .filter((i) => i.group === "Manage")
+ .map((i) => i.label),
+ ).toEqual(["Costs", "Analytics", "Settings", "Admin"]);
+ });
+
it("matches the active section", () => {
expect(isActive("/", "/")).toBe(true);
expect(isActive("/library", "/")).toBe(false);
diff --git a/nextjs-frontend/components/app-shell/nav-config.ts b/nextjs-frontend/components/app-shell/nav-config.ts
index e300f4b53..2e0a3bd5b 100644
--- a/nextjs-frontend/components/app-shell/nav-config.ts
+++ b/nextjs-frontend/components/app-shell/nav-config.ts
@@ -31,38 +31,42 @@ export type NavItem = {
membersOnly?: boolean;
/** A count shown next to the label (library size, speakers to review in Settings). */
countKey?: "recordings" | "reviews";
- /** Draw a divider after this item. */
- divider?: boolean;
+ /** The group it's in, named above its first item; the first group (what people use every day) has no name. */
+ group: NavGroup;
};
-/** Primary navigation, in the design's order (Nav.dc.html). */
+export type NavGroup = "" | "Explore" | "Automate" | "Manage";
+
+/** Primary navigation, in the design's order (Nav.dc.html), in groups: what people use every day, what Lens found in
+ * it, what runs by itself, and running Lens. */
export const NAV: NavItem[] = [
- { label: "Home", href: "/", icon: House },
+ { label: "Home", href: "/", icon: House, group: "" },
{
label: "Library",
href: "/library",
icon: LibraryBig,
countKey: "recordings",
+ group: "",
},
- { label: "Search", href: "/search", icon: Search },
- { label: "Chat", href: "/chat", icon: MessagesSquare },
- { label: "Notes", href: "/notes", icon: NotebookPen },
- { label: "Entities", href: "/entities", icon: Shapes },
- { label: "Topics", href: "/topics", icon: Tags },
- { label: "Graph", href: "/graph", icon: Waypoints },
- { label: "Podcasts", href: "/podcasts", icon: Podcast },
- { label: "Reports", href: "/reports", icon: ChartNoAxesColumn },
- { label: "Costs", href: "/costs", icon: Wallet, divider: true },
- { label: "Pipelines", href: "/pipelines", icon: Workflow },
- { label: "Routines", href: "/routines", icon: CalendarClock, adminOnly: true },
- { label: "Extensions", href: "/extensions", icon: Blocks },
+ { label: "Search", href: "/search", icon: Search, group: "" },
+ { label: "Chat", href: "/chat", icon: MessagesSquare, group: "" },
+ { label: "Notes", href: "/notes", icon: NotebookPen, group: "" },
+ { label: "Entities", href: "/entities", icon: Shapes, group: "Explore" },
+ { label: "Topics", href: "/topics", icon: Tags, group: "Explore" },
+ { label: "Graph", href: "/graph", icon: Waypoints, group: "Explore" },
+ { label: "Podcasts", href: "/podcasts", icon: Podcast, group: "Explore" },
+ { label: "Reports", href: "/reports", icon: ChartNoAxesColumn, group: "Explore" },
+ { label: "Pipelines", href: "/pipelines", icon: Workflow, group: "Automate" },
+ { label: "Routines", href: "/routines", icon: CalendarClock, adminOnly: true, group: "Automate" },
+ { label: "Extensions", href: "/extensions", icon: Blocks, group: "Automate" },
// Admins see every source as a sensor; members see the watched folders feeding their namespaces.
- { label: "Sensors", href: "/sensors", icon: RadioTower, adminOnly: true },
- { label: "Sources", href: "/sources", icon: HardDriveDownload, membersOnly: true },
- { label: "Analytics", href: "/analytics", icon: ChartLine, adminOnly: true },
+ { label: "Sensors", href: "/sensors", icon: RadioTower, adminOnly: true, group: "Automate" },
+ { label: "Sources", href: "/sources", icon: HardDriveDownload, membersOnly: true, group: "Automate" },
+ { label: "Costs", href: "/costs", icon: Wallet, group: "Manage" },
+ { label: "Analytics", href: "/analytics", icon: ChartLine, adminOnly: true, group: "Manage" },
// Everyone has Settings: members find Speakers there, admins the archive's settings too.
- { label: "Settings", href: "/settings", icon: Settings, countKey: "reviews" },
- { label: "Admin", href: "/admin", icon: Shield, adminOnly: true },
+ { label: "Settings", href: "/settings", icon: Settings, countKey: "reviews", group: "Manage" },
+ { label: "Admin", href: "/admin", icon: Shield, adminOnly: true, group: "Manage" },
];
export function navFor(admin: boolean): NavItem[] {
diff --git a/nextjs-frontend/components/app-shell/nav.tsx b/nextjs-frontend/components/app-shell/nav.tsx
index 64696dbf0..a8109ad5d 100644
--- a/nextjs-frontend/components/app-shell/nav.tsx
+++ b/nextjs-frontend/components/app-shell/nav.tsx
@@ -45,7 +45,9 @@ export function Nav({
{top}
- {navFor(admin).map((it) => {
+ {navFor(admin).map((it, i, all) => {
+ // a group's name goes above its first item; collapsed to icons, a line does
+ const opens = it.group && it.group !== all[i - 1]?.group;
const on = isActive(pathname, it.href);
const n = it.countKey ? counts[it.countKey] : undefined;
const link = (
@@ -54,7 +56,7 @@ export function Nav({
onClick={onNavigate}
aria-current={on ? "page" : undefined}
className={cn(
- "flex h-[34px] items-center gap-[11px] whitespace-nowrap rounded-sm px-2.5 text-[14px] transition-colors duration-fast",
+ "flex h-8 items-center gap-[11px] whitespace-nowrap rounded-sm px-2.5 text-[14px] transition-colors duration-fast",
on ? "bg-blue-surface font-bold text-fg-accent" : "font-medium text-fg-strong hover:bg-surface-neutral",
collapsed && "justify-center px-0",
)}
@@ -72,6 +74,14 @@ export function Nav({
);
return (
+ {opens &&
+ (collapsed ? (
+
+ ) : (
+
+ {it.group}
+
+ ))}
{collapsed ? (
{link}
@@ -79,7 +89,6 @@ export function Nav({
) : (
link
)}
- {it.divider && }
);
})}