33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { headers } from "next/headers";
|
|
import "@crosscode/ui/fonts.css";
|
|
import "./globals.css";
|
|
import { brandAttributes } from "@crosscode/ui";
|
|
import { BrandingProvider } from "@/components/BrandingProvider";
|
|
import { loadBranding, loadChurch, rgbVars } from "@/lib/branding";
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const b = await loadBranding();
|
|
// Sign-in pages never belong in search results (ROADMAP-v3 §11).
|
|
return { title: { default: `Sign in · ${b.name}`, template: `%s · ${b.name}` }, robots: { index: false, follow: false } };
|
|
}
|
|
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const nonce = (await headers()).get("x-nonce") ?? undefined;
|
|
const [b, church] = await Promise.all([loadBranding(), loadChurch()]);
|
|
const vars = rgbVars(b.colours.primary);
|
|
// 1.7.0: the church's font pairing and corners (fonts.css), shared with its other sites.
|
|
return (
|
|
<html lang="en-ZA" {...brandAttributes(b.style)}>
|
|
<head>
|
|
<style nonce={nonce}>{`:root{--brand:${vars.brand};--brand-dark:${vars.dark}}`}</style>
|
|
</head>
|
|
<body>
|
|
<BrandingProvider value={{ name: b.name, shortName: b.shortName, logoUrl: b.logoUrl, signupEnabled: b.signupEnabled, setupNeeded: b.setupNeeded, church }}>
|
|
{children}
|
|
</BrandingProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|