refactor(ui): isolate notelett navigation

This commit is contained in:
Saravana Achu Mac 2026-05-06 13:37:49 -07:00
parent 2a2c773ca1
commit 7063e59078
2 changed files with 24 additions and 13 deletions

View File

@ -1,9 +1,10 @@
"use client";
import { usePathname } from "next/navigation";
import { House, Search, Settings, Sparkles, FolderKanban, ShieldCheck, MessageCircle, Brain } from "lucide-react";
import { Sparkles } from "lucide-react";
import { PRODUCT_NAME } from "@/lib/product-config";
import { isFeatureEnabled } from "@/lib/feature-flags";
import { NOTELETT_NAV_ITEMS } from "@/lib/navigation";
import {
AppShellNav,
AppShellNavItem,
@ -12,17 +13,6 @@ import {
Panel,
} from "@/components/ui/Primitives";
const navItems: { href: string; label: string; icon: typeof House; flag?: string }[] = [
{ href: "/dashboard", label: "Dashboard", icon: House },
{ href: "/workspaces", label: "Workspaces", icon: FolderKanban },
{ href: "/reviews", label: "Reviews", icon: ShieldCheck, flag: "mcp_tools_enabled" },
{ href: "/prompts", label: "Prompts", icon: Sparkles },
{ href: "/search", label: "Search", icon: Search },
{ href: "/chat", label: "Workspace chat", icon: MessageCircle },
{ href: "/palace", label: "Palace", icon: Brain },
{ href: "/settings", label: "Settings", icon: Settings },
];
export function Sidebar({ open }: { open?: boolean }) {
const pathname = usePathname() ?? "";
@ -43,7 +33,7 @@ export function Sidebar({ open }: { open?: boolean }) {
</Panel>
<AppShellNav>
{navItems.filter((item) => !item.flag || isFeatureEnabled(item.flag)).map((item) => {
{NOTELETT_NAV_ITEMS.filter((item) => !item.flag || isFeatureEnabled(item.flag)).map((item) => {
const Icon = item.icon;
const active = pathname === item.href || pathname.startsWith(`${item.href}/`);
return (

21
web/src/lib/navigation.ts Normal file
View File

@ -0,0 +1,21 @@
import type { LucideIcon } from "lucide-react";
import { Brain, FolderKanban, House, MessageCircle, Search, Settings, ShieldCheck, Sparkles } from "lucide-react";
export type NoteLettNavItem = {
href: string;
label: string;
icon: LucideIcon;
flag?: string;
};
export const NOTELETT_NAV_ITEMS: NoteLettNavItem[] = [
{ href: "/dashboard", label: "Dashboard", icon: House },
{ href: "/workspaces", label: "Workspaces", icon: FolderKanban },
{ href: "/reviews", label: "Reviews", icon: ShieldCheck, flag: "mcp_tools_enabled" },
{ href: "/prompts", label: "Prompts", icon: Sparkles },
{ href: "/search", label: "Search", icon: Search },
{ href: "/chat", label: "Workspace chat", icon: MessageCircle },
{ href: "/palace", label: "Palace", icon: Brain },
{ href: "/settings", label: "Settings", icon: Settings },
];