diff --git a/mvp/b2c/src/app/admin/layout.tsx b/mvp/b2c/src/app/admin/layout.tsx index 6f408ce..ee7b34d 100644 --- a/mvp/b2c/src/app/admin/layout.tsx +++ b/mvp/b2c/src/app/admin/layout.tsx @@ -6,9 +6,9 @@ import AppNav from '@/components/AppNav'; export const metadata: Metadata = { title: 'Admin · Reformix' }; const ADMIN_LINKS = [ - { href: '/admin', label: 'Resumen' }, - { href: '/admin/usuarios', label: 'Usuarios' }, - { href: '/admin/planes', label: 'Planes' }, + { href: '/admin', label: 'Resumen', icon: 'resumen' }, + { href: '/admin/usuarios', label: 'Usuarios', icon: 'usuarios' }, + { href: '/admin/planes', label: 'Planes', icon: 'planes' }, ] as const; export default async function AdminLayout({ children }: { children: React.ReactNode }) { @@ -26,7 +26,7 @@ export default async function AdminLayout({ children }: { children: React.ReactN -
{children}
+
{children}
); } diff --git a/mvp/b2c/src/app/panel/layout.tsx b/mvp/b2c/src/app/panel/layout.tsx index 56e9cc5..bbbdfa8 100644 --- a/mvp/b2c/src/app/panel/layout.tsx +++ b/mvp/b2c/src/app/panel/layout.tsx @@ -7,9 +7,9 @@ import { eq } from 'drizzle-orm'; import AppNav from '@/components/AppNav'; const PANEL_LINKS = [ - { href: '/panel', label: 'Leads' }, - { href: '/panel/precios', label: 'Precios' }, - { href: '/panel/empresa', label: 'Empresa' }, + { href: '/panel', label: 'Leads', icon: 'leads' }, + { href: '/panel/precios', label: 'Precios', icon: 'precios' }, + { href: '/panel/empresa', label: 'Empresa', icon: 'empresa' }, ] as const; export const metadata: Metadata = { @@ -41,7 +41,7 @@ export default async function PanelLayout({ children }: { children: React.ReactN -
{children}
+
{children}
); } diff --git a/mvp/b2c/src/components/AppNav.tsx b/mvp/b2c/src/components/AppNav.tsx index 79cbc29..c3bab22 100644 --- a/mvp/b2c/src/components/AppNav.tsx +++ b/mvp/b2c/src/components/AppNav.tsx @@ -1,10 +1,17 @@ 'use client'; -import { useState } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; -export type AppNavLink = { href: string; label: string }; +export type AppNavIcon = + | 'leads' + | 'precios' + | 'empresa' + | 'resumen' + | 'usuarios' + | 'planes'; + +export type AppNavLink = { href: string; label: string; icon: AppNavIcon }; // El enlace activo es el href más específico (más largo) que prefija el pathname. function activeHref(pathname: string, links: readonly AppNavLink[]): string { @@ -17,14 +24,79 @@ function activeHref(pathname: string, links: readonly AppNavLink[]): string { return best; } +const ICON_PATHS: Record = { + leads: ( + <> + + + + ), + precios: ( + <> + + + + ), + empresa: ( + <> + + + + ), + resumen: ( + <> + + + + + + ), + usuarios: ( + <> + + + + + ), + planes: ( + <> + + + + ), + salir: ( + <> + + + + ), +}; + +function Icon({ name }: { name: AppNavIcon | 'salir' }) { + return ( + + ); +} + export default function AppNav({ links }: { links: readonly AppNavLink[] }) { const pathname = usePathname(); - const [open, setOpen] = useState(false); const active = activeHref(pathname, links); return ( <> - {/* Escritorio */} + {/* Escritorio: navegación horizontal en la cabecera */} - {/* Móvil: botón hamburguesa */} - - - {/* Móvil: panel desplegable */} - {open && ( - <> - - - - - - )} +
+ {links.map((l) => { + const isActive = active === l.href; + return ( + + {isActive && ( +
+ ); }