2026-06-03 03:12:14 +07:00
|
|
|
import { motion } from "framer-motion";
|
2026-06-01 16:42:36 +07:00
|
|
|
import { BarChart3, MessageSquare, Radio } from "lucide-react";
|
|
|
|
|
import type { DashboardTab } from "../entities/ui/types";
|
|
|
|
|
import { cn } from "../shared/lib/utils";
|
2026-06-03 03:12:14 +07:00
|
|
|
import { ChibiMascot } from "./mascot/ChibiMascot";
|
2026-06-01 16:42:36 +07:00
|
|
|
|
2026-06-01 21:44:29 +07:00
|
|
|
const navItems: Array<{ id: DashboardTab; label: string; icon: typeof Radio }> =
|
|
|
|
|
[
|
|
|
|
|
{ id: "live", label: "Live", icon: Radio },
|
|
|
|
|
{ id: "messages", label: "Messages", icon: MessageSquare },
|
|
|
|
|
{ id: "analytics", label: "Analytics", icon: BarChart3 },
|
|
|
|
|
];
|
2026-06-01 16:42:36 +07:00
|
|
|
|
|
|
|
|
interface SidebarProps {
|
|
|
|
|
activeTab: DashboardTab;
|
|
|
|
|
onTabChange: (tab: DashboardTab) => void;
|
|
|
|
|
collapsed?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-03 03:12:14 +07:00
|
|
|
export function Sidebar({
|
|
|
|
|
activeTab,
|
|
|
|
|
onTabChange,
|
|
|
|
|
collapsed = true,
|
|
|
|
|
}: SidebarProps) {
|
2026-06-01 16:42:36 +07:00
|
|
|
return (
|
2026-06-03 03:12:14 +07:00
|
|
|
<motion.nav
|
2026-06-01 16:42:36 +07:00
|
|
|
className={cn(
|
2026-06-03 03:12:14 +07:00
|
|
|
"hidden shrink-0 flex-col border-r border-[#7EC8E3]/20 bg-white/70 backdrop-blur-md transition-all duration-300 md:flex",
|
2026-06-01 16:42:36 +07:00
|
|
|
collapsed ? "w-16" : "w-64",
|
|
|
|
|
)}
|
2026-06-03 03:12:14 +07:00
|
|
|
layout
|
|
|
|
|
transition={{ type: "spring", stiffness: 300, damping: 30 }}
|
2026-06-01 16:42:36 +07:00
|
|
|
>
|
2026-06-03 03:12:14 +07:00
|
|
|
{/* App icon only — no branding text */}
|
2026-06-01 21:44:29 +07:00
|
|
|
<div
|
|
|
|
|
className={cn(
|
2026-06-03 03:12:14 +07:00
|
|
|
"flex items-center py-5",
|
|
|
|
|
collapsed ? "justify-center" : "px-4",
|
2026-06-01 21:44:29 +07:00
|
|
|
)}
|
|
|
|
|
>
|
2026-06-03 03:12:14 +07:00
|
|
|
<img src="/logo.svg" alt="GMW" className="h-8 w-8 rounded-xl" />
|
2026-06-01 16:42:36 +07:00
|
|
|
</div>
|
2026-06-03 03:12:14 +07:00
|
|
|
|
|
|
|
|
{/* Navigation items */}
|
|
|
|
|
<div className="flex flex-col gap-1 px-2">
|
2026-06-01 16:42:36 +07:00
|
|
|
{navItems.map((item) => {
|
|
|
|
|
const Icon = item.icon;
|
2026-06-03 03:12:14 +07:00
|
|
|
const isActive = activeTab === item.id;
|
2026-06-01 16:42:36 +07:00
|
|
|
return (
|
2026-06-03 03:12:14 +07:00
|
|
|
<button
|
2026-06-01 16:42:36 +07:00
|
|
|
key={item.id}
|
|
|
|
|
onClick={() => onTabChange(item.id)}
|
|
|
|
|
title={collapsed ? item.label : undefined}
|
2026-06-03 03:12:14 +07:00
|
|
|
className={cn(
|
|
|
|
|
"group relative flex items-center rounded-xl p-2.5 text-sm font-medium transition-all duration-200 ease-out",
|
|
|
|
|
collapsed ? "justify-center" : "gap-3",
|
|
|
|
|
isActive
|
|
|
|
|
? "bg-primary-soft text-primary ring-2 ring-primary/20"
|
|
|
|
|
: "text-muted-foreground hover:bg-primary-soft/40 hover:text-primary/80",
|
|
|
|
|
)}
|
|
|
|
|
onMouseEnter={(e) => {
|
2026-06-03 03:21:20 +07:00
|
|
|
e.currentTarget.style.transform = "translateX(2px) scale(1.1)";
|
2026-06-03 03:12:14 +07:00
|
|
|
}}
|
|
|
|
|
onMouseLeave={(e) => {
|
|
|
|
|
e.currentTarget.style.transform = "translateX(0) scale(1)";
|
|
|
|
|
}}
|
2026-06-01 16:42:36 +07:00
|
|
|
>
|
2026-06-03 03:12:14 +07:00
|
|
|
<Icon className="h-4 w-4 shrink-0" />
|
|
|
|
|
{!collapsed && <span>{item.label}</span>}
|
|
|
|
|
</button>
|
2026-06-01 16:42:36 +07:00
|
|
|
);
|
|
|
|
|
})}
|
2026-06-03 03:12:14 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Spacer pushes mascot to bottom */}
|
|
|
|
|
<div className="flex-1" />
|
|
|
|
|
|
|
|
|
|
{/* Chibi mascot */}
|
|
|
|
|
<div className="flex justify-center pb-4">
|
|
|
|
|
<ChibiMascot size="sm" variant="idle" />
|
|
|
|
|
</div>
|
|
|
|
|
</motion.nav>
|
2026-06-01 16:42:36 +07:00
|
|
|
);
|
|
|
|
|
}
|