Files
crosscode-platform/apps/website/frontend/src/app/admin/layout.tsx
T
joshuaandClaude Opus 5.5 84c5b0c08e feat(website): the admin, with drafts, preview, publish and restore
Admin API and screens: dashboard and setup checklist, template and
style, pages and blocks, ministries, leadership, media library with
the storage limit, publish and history. Pending changes with who and
when, discard one, one Publish, restore any version (each version
keeps the working copy's rows, never sent to visitors). Preview on
the site's own addresses with a bar (widths, back, publish); shared
preview links for 7 days or until revoked. Roles checked, same-origin
changes only. Publish refreshes the public pages at once
(WEBSITE_CONTENT_CACHE_SECONDS). E2E on a production build: the
admin's flows and axe on every screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:30:29 +02:00

19 lines
791 B
TypeScript

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 <AdminShell user={me.user}>{children}</AdminShell>;
}