'use client'; import React from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { cn } from '@/lib/utils'; import { useUIStore } from '@/stores/ui.store'; import { LayoutDashboard, LineChart, Wallet, History, Settings, HelpCircle, ChevronLeft, ChevronRight, TrendingUp, Bot, Shield, Bell, } from 'lucide-react'; /** * Item de navegación */ interface NavItem { label: string; href: string; icon: React.ReactNode; badge?: string | number; children?: NavItem[]; } /** * Grupos de navegación */ interface NavGroup { label?: string; items: NavItem[]; } /** * Navegación principal */ const navigation: NavGroup[] = [ { items: [ { label: 'Dashboard', href: '/dashboard', icon: , }, ], }, { label: 'Trading', items: [ { label: 'Estrategias', href: '/strategies', icon: , badge: 3, }, { label: 'Portfolio', href: '/portfolio', icon: , }, { label: 'Mercados', href: '/markets', icon: , }, { label: 'Historial', href: '/history', icon: , }, ], }, { label: 'Analisis', items: [ { label: 'Performance', href: '/analytics', icon: , }, { label: 'Riesgo', href: '/risk', icon: , }, ], }, { label: 'Sistema', items: [ { label: 'Notificaciones', href: '/notifications', icon: , badge: 5, }, { label: 'Configuracion', href: '/settings', icon: , }, { label: 'Ayuda', href: '/help', icon: , }, ], }, ]; /** * Componente NavLink */ interface NavLinkProps { item: NavItem; collapsed: boolean; } const NavLink: React.FC = ({ item, collapsed }) => { const pathname = usePathname(); const isActive = pathname === item.href || pathname.startsWith(`${item.href}/`); return ( {/* Active Indicator */} {isActive && ( )} {/* Icon */} {item.icon} {/* Label */} {!collapsed && ( {item.label} )} {/* Badge */} {item.badge && !collapsed && ( {item.badge} )} {/* Tooltip when collapsed */} {collapsed && ( {item.label} {item.badge && ( {item.badge} )} )} ); }; /** * Componente Sidebar * * Barra lateral de navegación con soporte para colapsado y grupos de navegación. */ export const Sidebar: React.FC = () => { const { sidebarOpen, sidebarCollapsed, toggleSidebarCollapsed, isMobile, setSidebarOpen } = useUIStore(); // En mobile, cerrar al hacer click en overlay const handleOverlayClick = () => { if (isMobile) { setSidebarOpen(false); } }; return ( <> {/* Overlay mobile */} {isMobile && sidebarOpen && (