Mejora la navegación móvil del panel y admin
Extrae un AppNav reutilizable con menú hamburguesa desplegable en móvil y resaltado del enlace activo. Antes la marca y los enlaces se apretaban en una sola fila en pantallas pequeñas; ahora el nombre de empresa se oculta en móvil y los enlaces pasan a un desplegable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,27 +1,29 @@
|
||||
import Link from 'next/link';
|
||||
import type { Metadata } from 'next';
|
||||
import { requireAdmin } from '@/lib/auth/current-user';
|
||||
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' },
|
||||
] as const;
|
||||
|
||||
export default async function AdminLayout({ children }: { children: React.ReactNode }) {
|
||||
await requireAdmin();
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<header className="sticky top-0 z-10 bg-white border-b border-gray-200">
|
||||
<div className="max-w-6xl mx-auto px-6 h-16 flex items-center justify-between">
|
||||
<Link href="/admin" className="flex items-center gap-3">
|
||||
<span className="inline-flex items-center justify-center w-8 h-8 rounded-lg bg-black text-white font-black italic text-lg leading-none">R</span>
|
||||
<header className="sticky top-0 z-20 bg-white border-b border-gray-200">
|
||||
<div className="relative max-w-6xl mx-auto px-6 h-16 flex items-center justify-between">
|
||||
<Link href="/admin" className="flex items-center gap-2 min-w-0">
|
||||
<span className="inline-flex shrink-0 items-center justify-center w-8 h-8 rounded-lg bg-black text-white font-black italic text-lg leading-none">R</span>
|
||||
<span className="font-extrabold tracking-tight text-black">Reformix</span>
|
||||
<span className="text-gray-300">/</span>
|
||||
<span className="text-sm font-medium text-gray-600">Admin</span>
|
||||
<span className="hidden sm:inline text-gray-300">/</span>
|
||||
<span className="hidden sm:inline text-sm font-medium text-gray-600">Admin</span>
|
||||
</Link>
|
||||
<nav className="flex items-center gap-4 text-xs font-medium">
|
||||
<Link href="/admin" className="text-gray-500 hover:text-black">Resumen</Link>
|
||||
<Link href="/admin/usuarios" className="text-gray-500 hover:text-black">Usuarios</Link>
|
||||
<Link href="/admin/planes" className="text-gray-500 hover:text-black">Planes</Link>
|
||||
<form action="/logout" method="post"><button type="submit" className="text-gray-500 hover:text-black">Salir</button></form>
|
||||
</nav>
|
||||
<AppNav links={ADMIN_LINKS} />
|
||||
</div>
|
||||
</header>
|
||||
<main className="max-w-6xl mx-auto px-6 py-8">{children}</main>
|
||||
|
||||
Reference in New Issue
Block a user