informe-comercial-alfa/app/layout.js

67 lines
2.8 KiB
JavaScript
Raw Normal View History

import "./globals.css";
import { auth, signIn, signOut } from "./lib/auth";
import AppShell from "./components/AppShell";
export const metadata = {
title: "Informe Comercial ALFA+",
description: "Analítica comercial en vivo sobre Dynamics 365",
};
// Mismo orden y agrupación que assets/js/utils.js del sitio HTML — no reordenar sin actualizar
// también ese archivo, se desincronizan los dos diseños.
const PAGES = [
{ href: "/", label: "Agenda", ico: "🗓", grupo: "Actividades", built: true },
{ href: "/actividades", label: "Plan de Actividades", ico: "✓", grupo: "Actividades", built: true },
{ href: "/prevision", label: "Previsión de Ventas", ico: "◎", grupo: "Ventas", built: true },
{ href: "/tuberia", label: "Tubería de Ventas", ico: "▤", grupo: "Ventas", built: true },
{ href: "/resumen", label: "Ventas Resumen", ico: "▣", grupo: "Ventas", built: true },
{ href: "/ganadas", label: "Oportunidades Ganadas", ico: "▲", grupo: "Ventas", built: true },
{ href: "/perdemos", label: "Oportunidades Perdidas", ico: "▼", grupo: "Ventas", built: true },
{ href: "/tendencia", label: "Tendencia", ico: "📈", grupo: "Ventas", built: true },
{ href: "/renovaciones/prevision", label: "Previsión de Renovaciones", ico: "◍", grupo: "Renovaciones", built: true },
{ href: "/renovaciones/tuberia", label: "Tubería de Renovaciones", ico: "▥", grupo: "Renovaciones", built: true },
{ href: "/renovaciones/logradas", label: "Renovaciones Logradas", ico: "♻", grupo: "Renovaciones", built: true },
{ href: "/renovaciones/perdidas", label: "Renovaciones Perdidas", ico: "✖", grupo: "Renovaciones", built: true },
{ href: "/nuevas", label: "Nuevas Oportunidades", ico: "◔", grupo: "Análisis", built: true },
{ href: "/mapa", label: "Mapa Geográfico", ico: "◈", grupo: "Análisis", built: false },
{ href: "/precio", label: "Precio por Mbps", ico: "⊟", grupo: "Análisis", built: false },
{ href: "/detalle", label: "Detalle", ico: "☰", grupo: "Análisis", built: true },
];
export default async function RootLayout({ children }) {
const session = await auth();
async function handleSignIn() {
"use server";
await signIn("microsoft-entra-id");
}
async function handleSignOut() {
"use server";
await signOut();
}
return (
<html lang="es">
<head>
<link rel="stylesheet" href="/assets/css/base.css" />
<link rel="stylesheet" href="/assets/css/layout.css" />
<link rel="stylesheet" href="/assets/css/components.css" />
</head>
<body>
<AppShell
pages={PAGES}
session={session?.email ? { email: session.email, isAdmin: session.isAdmin } : null}
onSignIn={handleSignIn}
onSignOut={handleSignOut}
>
{children}
</AppShell>
</body>
</html>
);
}