This commit is contained in:
Louis Mazin 2026-09-19 15:31:41 +02:00
parent 32750a0cd7
commit 66669e575b
2 changed files with 68 additions and 62 deletions

View File

@ -62,7 +62,6 @@ const NavBar = () => {
}, 150);
};
// Fonction pour fermer le menu lorsqu'on clique sur un lien sur mobile
const handleCloseMenu = () => {
if (isMobile) {
toggleSidebar();
@ -78,12 +77,12 @@ const NavBar = () => {
{
title: 'Résumé hebdomadaire',
href: '/weekly-summary',
icon: CalendarDays,
icon: Clock,
},
{
title: 'Pointage',
href: '/pointage',
icon: Clock,
icon: CalendarDays,
},
];
@ -93,36 +92,35 @@ const NavBar = () => {
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
>
{/* Logo / nom de la boulangerie */}
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
asChild
size="lg"
tooltip="Le Fournil du Bocage"
>
<Link
to="/"
className="flex items-center gap-2"
onClick={handleCloseMenu}
>
<div className="flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<Wheat className="size-4" />
</div>
onClick={handleCloseMenu}
render={
<Link
to="/"
className="flex w-full items-center gap-2"
>
<div className="flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<Wheat className="size-4" />
</div>
<div className="grid min-w-0 flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">
Le Fournil du Bocage
</span>
<div className="grid min-w-0 flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">
Le Fournil du Bocage
</span>
<span className="truncate text-xs">
Gestion
</span>
</div>
</Link>
</SidebarMenuButton>
<span className="truncate text-xs">
Gestion
</span>
</div>
</Link>
}
/>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
@ -130,7 +128,7 @@ const NavBar = () => {
{/* Navigation */}
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>
<SidebarGroupLabel className="text-lg">
Navigation
</SidebarGroupLabel>
@ -142,21 +140,22 @@ const NavBar = () => {
return (
<SidebarMenuItem key={item.href}>
<SidebarMenuButton
asChild
tooltip={item.title}
>
<NavLink
to={item.href}
className="flex items-center gap-2"
onClick={handleCloseMenu}
>
<Icon className="size-4 shrink-0" />
onClick={handleCloseMenu}
className="w-full"
render={
<NavLink
to={item.href}
className="flex w-full items-center gap-2 text-base"
>
<Icon className="size-6 shrink-0" />
<span className="truncate">
{item.title}
</span>
</NavLink>
</SidebarMenuButton>
<span className="truncate text-base">
{item.title}
</span>
</NavLink>
}
/>
</SidebarMenuItem>
);
})}
@ -167,7 +166,7 @@ const NavBar = () => {
{/* Administration */}
{user.is_admin && (
<SidebarGroup>
<SidebarGroupLabel>
<SidebarGroupLabel className="text-lg">
Administration
</SidebarGroupLabel>
@ -175,27 +174,27 @@ const NavBar = () => {
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
asChild
tooltip="Comptes existants"
>
<NavLink
to="/users"
className="flex items-center gap-2"
onClick={handleCloseMenu}
>
<Users className="size-4 shrink-0" />
onClick={handleCloseMenu}
className="w-full"
render={
<NavLink
to="/users"
className="flex w-full items-center gap-2 text-base"
>
<Users className="size-6 shrink-0" />
<span className="truncate">
Comptes existants
</span>
</NavLink>
</SidebarMenuButton>
<span className="truncate text-base">
Comptes existants
</span>
</NavLink>
}
/>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
)}
</SidebarContent>
{/* Déconnexion */}
@ -203,16 +202,23 @@ const NavBar = () => {
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
onClick={logout}
tooltip="Déconnexion"
className="flex items-center gap-2"
>
<LogOut className="size-4 shrink-0" />
onClick={handleCloseMenu}
className="w-full"
render={
<button
type="button"
onClick={logout}
className="flex w-full items-center gap-2 text-base"
>
<LogOut className="size-6 shrink-0" />
<span className="truncate">
Déconnexion
</span>
</SidebarMenuButton>
<span className="truncate text-base">
Déconnexion
</span>
</button>
}
/>
</SidebarMenuItem>
</SidebarMenu>
</SidebarFooter>

View File

@ -29,7 +29,7 @@ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
const SIDEBAR_WIDTH = "16rem"
const SIDEBAR_WIDTH_MOBILE = "18rem"
const SIDEBAR_WIDTH_ICON = "3rem"
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
const SIDEBAR_KEYBOARD_SHORTCUT = null
const SidebarContext = React.createContext(null)