import { ReactNode } from "react"; import { AppShell } from "@/components/app-shell"; import { Button, PageHeader } from "@/components/ui"; import { getLocale, getTranslator } from "@/lib/i18n"; import { getSession } from "@/lib/auth"; import { adminNav, agentNav, superAdminNav } from "@/lib/mock-data"; type ShellType = "admin" | "agent" | "super-admin"; const shellMap = { admin: { nav: adminNav, titleKey: "admin_title" as const, subtitleKey: "admin_subtitle" as const }, agent: { nav: agentNav, titleKey: "agent_title" as const, subtitleKey: "agent_subtitle" as const }, "super-admin": { nav: superAdminNav, titleKey: "super_admin_title" as const, subtitleKey: "super_admin_subtitle" as const } } as const; export async function ShellPage({ shell, title, description, actions, children }: { shell: ShellType; title: string; description: string; actions?: ReactNode; children: ReactNode; }) { const locale = await getLocale(); const t = getTranslator(locale); const config = shellMap[shell]; const session = await getSession(); const roleLabel = session?.role === "super_admin" ? t("roles", "super_admin") : session?.role === "agent" ? t("roles", "agent") : t("roles", "admin_client"); const tenantName = session?.tenantName ?? "Inbox Suite"; const shellTitle = t("shell", config.titleKey); const shellSubtitle = t("shell", config.subtitleKey); return (
{children}
); } export function PlaceholderActions({ primaryHref, primaryLabel, secondaryHref, secondaryLabel }: { primaryHref?: string; primaryLabel?: string; secondaryHref?: string; secondaryLabel?: string; }) { return ( <> {secondaryHref && secondaryLabel ? ( ) : null} {primaryHref && primaryLabel ? : null} ); }