Files
NaMesa_site/reserva-mesa-dashboard/components/dashboard/Sidebar.tsx

79 lines
2.6 KiB
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils";
import {
LayoutDashboard,
CalendarDays,
Table as TableIcon,
History,
Settings,
LogOut,
ListOrdered,
Users
} from "lucide-react";
import { useAuth } from "@/hooks/useAuth";
const navigation = [
{ name: "Dashboard", href: "/", icon: LayoutDashboard },
{ name: "Reservas", href: "/reservas", icon: CalendarDays },
{ name: "Lista de Espera", href: "/lista-espera", icon: ListOrdered },
{ name: "Mesas", href: "/mesas", icon: TableIcon },
{ name: "Equipa", href: "/equipa", icon: Users },
{ name: "Histórico", href: "/historico", icon: History },
{ name: "Configurações", href: "/configuracoes", icon: Settings },
];
export function Sidebar() {
const pathname = usePathname();
const { logout } = useAuth();
return (
<div className="flex h-full flex-col bg-card border-r border-border">
<div className="flex h-20 items-center px-6">
<Link href="/" className="flex items-center gap-2">
<div className="h-8 w-8 rounded-lg bg-primary flex items-center justify-center">
<span className="text-primary-foreground font-bold text-xl">R</span>
</div>
<span className="text-xl font-display font-bold text-primary">ReservaMesa</span>
</Link>
</div>
<nav className="flex-1 space-y-1 px-3 py-4">
{navigation.map((item) => {
const isActive = pathname === item.href;
return (
<Link
key={item.name}
href={item.href}
className={cn(
"group flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200",
isActive
? "bg-primary/10 text-primary"
: "text-muted-foreground hover:bg-accent hover:text-accent-foreground"
)}
>
<item.icon className={cn(
"h-5 w-5",
isActive ? "text-primary" : "text-muted-foreground group-hover:text-accent-foreground"
)} />
{item.name}
</Link>
);
})}
</nav>
<div className="p-4 border-t border-border">
<button
onClick={() => logout()}
className="flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-all duration-200"
>
<LogOut className="h-5 w-5" />
Terminar Sessão
</button>
</div>
</div>
);
}