import { useState, useEffect } from "react"; import { Link, Outlet, useLocation, useNavigate } from "react-router-dom"; import { Sparkles, Calculator, BarChart3, Landmark, PiggyBank, Droplets, LogOut, TrendingUp, Wallet, Menu, Sun, Moon, Eye, EyeOff, type LucideIcon, } from "lucide-react"; import { useTheme } from "@/contexts/theme-context"; import { usePrivacy } from "@/contexts/privacy-context"; import { useAuth } from "@/AuthContext"; import { Button } from "@/components/ui/button"; import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetClose, } from "@/components/ui/sheet"; import { Separator } from "@/components/ui/separator"; import { cn } from "@/lib/utils"; interface NavSection { label: string; items: { to: string; icon: LucideIcon; label: string }[]; } const navSections: NavSection[] = [ { label: "General", items: [{ to: "/asistente", icon: Sparkles, label: "Asistente" }], }, { label: "Finanzas", items: [ { to: "/budget", icon: Calculator, label: "Presupuesto" }, { to: "/salarios", icon: Landmark, label: "Salarios" }, { to: "/pensions", icon: PiggyBank, label: "Pensiones" }, { to: "/proyecciones", icon: TrendingUp, label: "Proyecciones" }, { to: "/analytics", icon: BarChart3, label: "Analytics" }, ], }, { label: "Servicios", items: [ { to: "/servicios-municipales", icon: Droplets, label: "Municipalidad" }, ], }, ]; function SidebarNav({ onNavigate }: { onNavigate?: () => void }) { const { pathname } = useLocation(); const isActive = (to: string) => pathname === to || pathname.startsWith(`${to}/`); return ( ); } export default function Layout() { const { theme, toggleTheme } = useTheme(); const { privacyMode, togglePrivacy } = usePrivacy(); const { logout } = useAuth(); const navigate = useNavigate(); const [mobileOpen, setMobileOpen] = useState(false); const handleLogout = async () => { await logout(); navigate("/login", { replace: true }); }; return (
WealthySmart
WealthySmart
setMobileOpen(false)} />
}>
); }