"use client"; // Globale Navigation ueber alle Modul-Frontends (SHL-01 Akzeptanzkriterium 1). // Statische Registry statt Live-Abruf: die Modul-Frontends dieses Testhosts // nutzen unterschiedliche, noch nicht vereinheitlichte Anmeldemodelle // (Core-Sitzung vs. feste Demo-Kennung per Umgebungsvariable) -- ein // gemeinsamer Live-Abruf ueber /api/visible-modules wuerde fuer die Haelfte // der Module eine Core-Anmeldung voraussetzen, die sie bisher nicht haben. // Dieselbe Liste wie web/portal/config/modules.json, hier dupliziert, weil // jedes Modul sein eigenes, unabhaengig gebautes Next.js-Bundle ist. import type { ReactNode } from "react"; import { Shell } from "./Shell"; export interface ModuleRegistryEntry { key: string; label: string; href: string; } export const MODULE_REGISTRY: ModuleRegistryEntry[] = [ { key: "dms", label: "Dokumente", href: "http://localhost:3101" }, { key: "dms_upload", label: "Dokumente hochladen", href: "http://localhost:3107" }, { key: "mail", label: "Postfach", href: "http://localhost:3102" }, { key: "workflow", label: "Aufgaben & Freigaben", href: "http://localhost:3103" }, { key: "workflow_cases", label: "Akten & Vorgänge", href: "http://localhost:3108" }, { key: "routing_rules", label: "Routing-Regeln", href: "http://localhost:3109" }, { key: "ai", label: "KI-Funktionen", href: "http://localhost:3104" }, { key: "ai_extraction", label: "Extraktions-Korrektur", href: "http://localhost:3110" }, { key: "connect", label: "Externe Anbindungen", href: "http://localhost:3105" }, { key: "connect_datev", label: "DATEV-Export", href: "http://localhost:3111" }, { key: "tenant_admin", label: "Mandantenverwaltung", href: "http://localhost:3106" }, { key: "rbac_admin", label: "Rollen & Rechte", href: "http://localhost:3112" }, { key: "kennzahlen_dashboard", label: "Kennzahlen", href: "http://localhost:3113" }, { key: "portal", label: "Übersicht", href: "http://localhost:3900" }, ]; export interface ModuleNavShellProps { activeKey: string; children: ReactNode; } function resolveHref(href: string): string { try { const url = new URL(href); if (url.hostname === "localhost" && typeof window !== "undefined" && window.location.hostname !== "localhost") { url.hostname = window.location.hostname; } return url.toString(); } catch { return href; } } function tenantLabel(): string { if (typeof process === "undefined") return ""; return process.env.NEXT_PUBLIC_TENANT_SLUG ?? process.env.NEXT_PUBLIC_MAIL_TENANT_SLUG ?? "demo"; } export function ModuleNavShell({ activeKey, children }: ModuleNavShellProps) { const modules = MODULE_REGISTRY.map((m) => ({ key: m.key, label: m.label, href: resolveHref(m.href), active: m.key === activeKey, })); return ( {children} ); }