From 2283740d209e84b2c33e93aff67bce1fe184b235 Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Sun, 31 May 2026 20:08:33 +0200 Subject: [PATCH] feat(06-01): create AdminSidebar component with 7 nav links + logout - Client component using usePathname for active route highlighting - 7 nav links: Dashboard, Clienti, Progetti, Offerte, Forecast, Catalogo, Impostazioni - Logout button at bottom calls signOut with /admin/login callback - Green sidebar bg #1A463C matching brand --- src/components/admin/AdminSidebar.tsx | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/components/admin/AdminSidebar.tsx diff --git a/src/components/admin/AdminSidebar.tsx b/src/components/admin/AdminSidebar.tsx new file mode 100644 index 0000000..d55e20b --- /dev/null +++ b/src/components/admin/AdminSidebar.tsx @@ -0,0 +1,73 @@ +"use client"; + +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import { signOut } from "next-auth/react"; +import { + LayoutDashboard, + Users, + FolderOpen, + Tag, + TrendingUp, + BookOpen, + Settings, + LogOut, +} from "lucide-react"; + +const NAV_ITEMS = [ + { href: "/admin", label: "Dashboard", icon: LayoutDashboard, exact: true }, + { href: "/admin/clients", label: "Clienti", icon: Users }, + { href: "/admin/projects", label: "Progetti", icon: FolderOpen }, + { href: "/admin/offers", label: "Offerte", icon: Tag }, + { href: "/admin/forecast", label: "Forecast", icon: TrendingUp }, + { href: "/admin/catalog", label: "Catalogo", icon: BookOpen }, + { href: "/admin/impostazioni", label: "Impostazioni", icon: Settings }, +]; + +export function AdminSidebar() { + const pathname = usePathname(); + + const isActive = (href: string, exact?: boolean) => + exact ? pathname === href : pathname === href || pathname.startsWith(href + "/"); + + return ( + + ); +}