fix: sidebar width/centering + kanban card badge & table details

- Sidebar: expanded 256->200px, collapsed 80->64px; collapsed state now
  renders icon-only (label removed from flow) so icons are centered, not
  pushed left by an invisible text span
- Kanban cards: add StatusBadge + email line to match design reference
- Lead table: add "Mostrando N lead" footer and center/right-align
  Stato/Tag/Azioni headers per reference

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-10 16:28:43 +02:00
parent 86e1499e8f
commit 9eb2d45c67
3 changed files with 62 additions and 24 deletions
+32 -19
View File
@@ -34,30 +34,34 @@ export function AdminSidebar({ collapsed = false }: { collapsed?: boolean }) {
const isActive = (href: string, exact?: boolean) =>
exact ? pathname === href : pathname === href || pathname.startsWith(href + "/");
// Text fades out immediately on collapse, but only fades back in once the
// width transition is underway on expand (avoids reflow mid-animation).
const textClass = cn(
"whitespace-nowrap transition-opacity duration-200 delay-150",
collapsed && "opacity-0 pointer-events-none delay-0"
);
// Shared row layout: full width + gap + label when expanded, icon centered
// (no gap, no padding) when collapsed so nothing pushes the icon off-center.
const rowClass = collapsed ? "justify-center px-0" : "gap-3 px-3";
return (
<aside
className={cn(
"shrink-0 min-h-screen bg-[#1A463C] flex flex-col overflow-hidden",
"transition-[width] duration-350 ease-[cubic-bezier(0.4,0,0.2,1)]",
collapsed ? "w-20" : "w-64"
collapsed ? "w-16" : "w-[200px]"
)}
>
{/* Logo */}
<div className="px-5 py-5 border-b border-white/10">
<span className={cn("font-bold text-white tracking-tight text-sm", textClass)}>
iamcavalli
</span>
<div
className={cn(
"h-[57px] flex items-center border-b border-white/10",
collapsed ? "justify-center px-0" : "px-5"
)}
>
{!collapsed && (
<span className="font-bold text-white tracking-tight text-sm whitespace-nowrap">
iamcavalli
</span>
)}
</div>
{/* Nav links */}
<nav className="flex-1 px-3 py-4 flex flex-col gap-0.5">
<nav className="flex-1 px-2 py-4 flex flex-col gap-0.5">
{NAV_ITEMS.map(({ href, label, icon: Icon, exact }) => {
const active = isActive(href, exact);
return (
@@ -66,32 +70,41 @@ export function AdminSidebar({ collapsed = false }: { collapsed?: boolean }) {
href={href}
title={collapsed ? label : undefined}
className={cn(
"flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",
"flex items-center py-2 rounded-md text-sm transition-colors",
rowClass,
active
? "bg-white/15 text-white font-medium"
: "text-white/65 hover:text-white hover:bg-white/10"
)}
>
<Icon size={16} strokeWidth={1.8} className="shrink-0" />
<span className={textClass}>{label}</span>
{!collapsed && <span className="whitespace-nowrap">{label}</span>}
</Link>
);
})}
</nav>
{/* Theme + Logout */}
<div className="px-3 py-4 border-t border-white/10 flex flex-col gap-2">
<div className="flex items-center justify-between px-3">
<span className={cn("text-xs text-white/50", textClass)}>Tema</span>
<div className="px-2 py-4 border-t border-white/10 flex flex-col gap-2">
<div
className={cn(
"flex items-center py-1",
collapsed ? "justify-center px-0" : "justify-between px-3"
)}
>
{!collapsed && <span className="text-xs text-white/50">Tema</span>}
<ThemeToggle />
</div>
<button
onClick={() => signOut({ callbackUrl: "/admin/login" })}
title={collapsed ? "Esci" : undefined}
className="flex items-center gap-3 px-3 py-2 w-full rounded-md text-sm text-white/65 hover:text-white hover:bg-white/10 transition-colors"
className={cn(
"flex items-center py-2 w-full rounded-md text-sm text-white/65 hover:text-white hover:bg-white/10 transition-colors",
rowClass
)}
>
<LogOut size={16} strokeWidth={1.8} className="shrink-0" />
<span className={textClass}>Esci</span>
{!collapsed && <span className="whitespace-nowrap">Esci</span>}
</button>
</div>
</aside>