Archived
Public pages, auth, registration, payment, My Events and the kiosk: skip link, focus ring, labels tied to fields, named quantity buttons, announced errors, ModalOverlay popups (focus trap, Escape, focus return), contrast and underlined in-text links, reduced motion. Branding warns about a primary colour too light for white text and offers a darker shade. axe-core and keyboard checks in e2e/accessibility.spec.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 lines
3.2 KiB
TypeScript
83 lines
3.2 KiB
TypeScript
import type { Metadata } from "next";
|
|
import "./globals.css";
|
|
import { AuthProvider } from "@/contexts/AuthContext";
|
|
import { SiteSettingsProvider } from "@/contexts/SiteSettingsContext";
|
|
import { ToastProvider } from "@/components/shared/ToastProvider";
|
|
import { BannerBar } from "@/components/shared/BannerBar";
|
|
import { SetupGuard } from "@/components/shared/SetupGuard";
|
|
import HelpFab from "@/components/shared/HelpFab";
|
|
import { CookieConsent } from "@/components/shared/CookieConsent";
|
|
import { ImpersonationBanner } from "@/components/shared/ImpersonationBanner";
|
|
import { SkipLink } from "@/components/layout/SkipLink";
|
|
import { resolveToApiOrigin } from "@/lib/api";
|
|
import { getServerSettings } from "@/lib/serverSettings";
|
|
import { buildThemeCssVars } from "@/lib/colorScale";
|
|
import { appUrl } from "@/lib/siteConfig";
|
|
|
|
const appName = process.env.NEXT_PUBLIC_APP_NAME || 'Cross Code';
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const settings = await getServerSettings();
|
|
const faviconUrl = settings.favicon_url ? resolveToApiOrigin(settings.favicon_url) : null;
|
|
const logoUrl = settings.logo_url ? resolveToApiOrigin(settings.logo_url) : null;
|
|
const displayName = settings.org_name || appName;
|
|
const description = settings.org_tagline || `Manage and register for events with ${displayName}`;
|
|
|
|
return {
|
|
metadataBase: new URL(appUrl),
|
|
title: { default: displayName, template: `%s | ${displayName}` },
|
|
description,
|
|
icons: {
|
|
icon: faviconUrl || "/favicon.ico",
|
|
},
|
|
openGraph: {
|
|
type: "website",
|
|
siteName: displayName,
|
|
title: { default: displayName, template: `%s | ${displayName}` },
|
|
description,
|
|
...(logoUrl ? { images: [{ url: logoUrl }] } : {}),
|
|
},
|
|
twitter: {
|
|
card: "summary_large_image",
|
|
title: displayName,
|
|
description,
|
|
...(logoUrl ? { images: [logoUrl] } : {}),
|
|
},
|
|
// Per-deployment Search Console ownership check (Settings → Organisation).
|
|
...(settings.google_site_verification ? { verification: { google: settings.google_site_verification } } : {}),
|
|
};
|
|
}
|
|
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const settings = await getServerSettings();
|
|
const cssVars = buildThemeCssVars({
|
|
primary: settings.primary_color || settings.accent_color,
|
|
secondary: settings.secondary_color,
|
|
accent: settings.primary_color ? settings.accent_color : undefined,
|
|
});
|
|
|
|
return (
|
|
<html lang="en">
|
|
<body>
|
|
{cssVars && (
|
|
<style id="brand-theme" dangerouslySetInnerHTML={{ __html: `:root{${cssVars}}` }} />
|
|
)}
|
|
<SkipLink />
|
|
<SiteSettingsProvider initialSettings={settings}>
|
|
<AuthProvider>
|
|
<ToastProvider>
|
|
<SetupGuard />
|
|
<ImpersonationBanner />
|
|
<BannerBar />
|
|
{children}
|
|
<HelpFab />
|
|
<CookieConsent />
|
|
</ToastProvider>
|
|
</AuthProvider>
|
|
</SiteSettingsProvider>
|
|
</body>
|
|
</html>
|
|
|
|
);
|
|
}
|