"use client"; import { ReactNode } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { LayoutDashboard, Users, FolderKanban, Tags, Settings, LogOut, Sun, Moon, Shield, User } from "lucide-react"; import { useAuth } from "@/lib/auth-context"; import { Button } from "@/components/ui/button"; import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarProvider, SidebarTrigger, } from "@/components/ui/sidebar"; import { useTheme } from "next-themes"; interface DashboardLayoutProps { children: ReactNode; } export function DashboardLayout({ children }: DashboardLayoutProps) { const pathname = usePathname(); const { theme, setTheme } = useTheme(); const { user, logout } = useAuth(); const navigation = [ { name: "Tableau de bord", href: "/dashboard", icon: LayoutDashboard, }, { name: "Projets", href: "/projects", icon: FolderKanban, }, { name: "Personnes", href: "/persons", icon: Users, }, { name: "Tags", href: "/tags", icon: Tags, }, { name: "Paramètres", href: "/settings", icon: Settings, }, ]; return (
Groupes {navigation.map((item) => ( {item.name} ))} {/* User info */} {user && (
{user.avatar ? ( {user.name} ) : ( )}
{user.name} {user.role}
)} {/* Admin button */} {user && user.role === 'ADMIN' && (
)} {/* Theme and logout buttons */}
{children}
); }