import Image from "next/image"; import Link from "next/link"; import { ReactNode } from "react"; import { getLocale, getTranslator, type NavKey } from "@/lib/i18n"; import type { NavItem } from "@/lib/mock-data"; type ShellContext = { userName: string; roleLabel: string; tenantName: string; }; const navIconByKey: Record = { dashboard: "dashboard", shared_inbox: "inbox", inbox: "inbox", contacts: "contacts", broadcast: "campaign", templates: "article", team: "group", reports: "bar_chart", settings: "settings", billing: "payments", audit_log: "history", tenants: "domain", channels: "settings_input_antenna", security_events: "notifications_active", webhook_logs: "webhook", alerts: "warning", quick_tools: "auto_fix_high", performance: "trending_up", new_chat: "chat", search: "search", logout: "logout", global_search: "search", campaign: "campaign" }; function initials(name: string) { return name .split(" ") .filter(Boolean) .map((part) => part[0]?.toUpperCase()) .slice(0, 2) .join(""); } function LocaleSwitcher({ locale }: { locale: "id" | "en" }) { const nextLocale = locale === "id" ? "en" : "id"; return ( {nextLocale.toUpperCase()} ); } export async function AppShell({ title, subtitle, nav, context, children }: { title: string; subtitle: string; nav: NavItem[]; context: ShellContext; children: ReactNode; }) { const locale = await getLocale(); const t = getTranslator(locale); return (

{subtitle}

{title}

search
{context.userName} • {context.roleLabel} • {context.tenantName}
{children}
); }