diff --git a/frontend/src/components/BillingCycleSelector.tsx b/frontend/src/components/BillingCycleSelector.tsx index 2022af9..59eaebd 100644 --- a/frontend/src/components/BillingCycleSelector.tsx +++ b/frontend/src/components/BillingCycleSelector.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { Calendar } from 'lucide-react'; -import api from '../api'; +import api from '@/lib/api'; import { Select, SelectContent, diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index c06cf28..6e6ce3c 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -1,6 +1,7 @@ -import { NavLink, Outlet, useNavigate } from 'react-router-dom'; +import { useState, useEffect } from "react"; +import { Link, Outlet, useLocation, useNavigate } from "react-router-dom"; import { - LayoutDashboard, + Sparkles, Calculator, BarChart3, Landmark, @@ -15,24 +16,20 @@ import { Eye, EyeOff, type LucideIcon, -} from 'lucide-react'; -import { useEffect, useState } from 'react'; -import { useAuth } from '../AuthContext'; -import { useTheme } from '../ThemeContext'; -import { usePrivacy } from '../PrivacyContext'; -import { subscribeToPush } from '../pushNotifications'; -import { Button } from '@/components/ui/button'; +} 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'; - -// ─── Navigation Structure ──────────────────────────────────────────────────── +} from "@/components/ui/sheet"; +import { Separator } from "@/components/ui/separator"; +import { cn } from "@/lib/utils"; interface NavSection { label: string; @@ -41,32 +38,32 @@ interface NavSection { const navSections: NavSection[] = [ { - label: 'General', + label: "General", + items: [{ to: "/asistente", icon: Sparkles, label: "Asistente" }], + }, + { + label: "Finanzas", items: [ - { to: '/', icon: LayoutDashboard, label: 'Dashboard' }, + { 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: 'Finanzas', + label: "Servicios", 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' }, + { to: "/servicios-municipales", icon: Droplets, label: "Municipalidad" }, ], }, ]; -// ─── Shared Nav Renderer ───────────────────────────────────────────────────── - function SidebarNav({ onNavigate }: { onNavigate?: () => void }) { + const { pathname } = useLocation(); + const isActive = (to: string) => + pathname === to || pathname.startsWith(`${to}/`); + return (