diff --git a/frontend/app/components/Sidebar.tsx b/frontend/app/components/Sidebar.tsx index 93431fa..36c84d2 100644 --- a/frontend/app/components/Sidebar.tsx +++ b/frontend/app/components/Sidebar.tsx @@ -2,40 +2,95 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; -import { LayoutDashboard, FolderKanban, Blocks, MessageSquare, BarChart3 } from "lucide-react"; +import { + LayoutDashboard, + FolderKanban, + Blocks, + MessageSquare, + BarChart3, +} from "lucide-react"; + +function getNavigationState( + pathname: string, + path: string +) { + return { + isActive: + pathname === path, + className: `flex items-center gap-2 rounded-xl px-3 py-2 transition ${ + pathname === path + ? "bg-teal-700 text-white shadow-sm" + : "text-slate-700 hover:bg-slate-200" + }`, + }; +} export default function Sidebar() { const pathname = usePathname(); const navItems = [ - { href: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, - { href: "/projects", label: "Projects", icon: FolderKanban }, - { href: "/workspace", label: "Workspace", icon: Blocks }, - { href: "/insights/overview", label: "Insights", icon: BarChart3 }, - { href: "/chat", label: "Chat", icon: MessageSquare }, + { + href: "/dashboard", + label: "Dashboard", + icon: LayoutDashboard, + }, + { + href: "/projects", + label: "Projects", + icon: FolderKanban, + }, + { + href: "/workspace", + label: "Workspace", + icon: Blocks, + }, + { + href: "/insights/overview", + label: "Insights", + icon: BarChart3, + }, + { + href: "/chat", + label: "Chat", + icon: MessageSquare, + }, ]; - const linkClass = (path: string) => - `flex items-center gap-2 rounded-xl px-3 py-2 transition ${ - pathname === path - ? "bg-teal-700 text-white shadow-sm" - : "text-slate-700 hover:bg-slate-200" - }`; - return (