import type { Metadata } from "next"; import { headers } from "next/headers"; import { redirect } from "next/navigation"; import { AdminShell } from "@/admin/Shell"; import { loadMe, signInHref } from "@/lib/admin"; export const metadata: Metadata = { title: "Admin", robots: { index: false, follow: false } }; export const dynamic = "force-dynamic"; /** Every admin page: signed in through the church's Accounts (ยง10), else off to sign in and back. */ export default async function AdminLayout({ children }: { children: React.ReactNode }) { const me = await loadMe(); if (!me) { const path = (await headers()).get("x-ccw-path") || "/admin"; redirect(signInHref(path.startsWith("/admin") ? path : "/admin")); } return {children}; }