Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
67 lines
2.7 KiB
TypeScript
67 lines
2.7 KiB
TypeScript
import type { Metadata } from "next";
|
|
import localFont from "next/font/local";
|
|
import "./globals.css";
|
|
import { AdminAuthProvider } from "@/app/lib/AdminAuthContext";
|
|
import { ThemeProvider } from "@/app/lib/theme";
|
|
import { StorefrontOriginProvider } from "@/app/lib/storefront";
|
|
import { MessagesProvider } from "@/app/lib/i18n/MessagesProvider";
|
|
import { LocalesProvider } from "@/app/lib/i18n/LocalesProvider";
|
|
import { requestCatalog, requestLocale, getServerT } from "@/app/lib/server/i18n";
|
|
import { loadMemberPortalUrl } from "@/app/lib/server/memberPortalUrl";
|
|
import AppShell from "@/app/components/app/AppShell";
|
|
|
|
// Self-hosted: the CI Docker build has no network access to Google Fonts
|
|
// (next/font/google fetches at build time).
|
|
const inter = localFont({
|
|
src: "./fonts/inter-latin-wght-normal.woff2",
|
|
weight: "100 900",
|
|
variable: "--font-inter",
|
|
display: "swap",
|
|
});
|
|
const dmSans = localFont({
|
|
src: "./fonts/dm-sans-latin-wght-normal.woff2",
|
|
weight: "100 1000",
|
|
variable: "--font-dm-sans",
|
|
display: "swap",
|
|
});
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const t = await getServerT();
|
|
return {
|
|
title: t("BackOfficeMetaTitle"),
|
|
description: t("LayoutMetaDescription"),
|
|
};
|
|
}
|
|
|
|
// Locale resolution mirrors solvway-customer-portal's app/layout.tsx: the
|
|
// bb_locale cookie wins when present (set client-side by LocaleSwitcher),
|
|
// else Accept-Language resolved against the RUNTIME registry codes, else
|
|
// DEFAULT_LOCALE. The catalog is loaded server-side (version-aware cache, see
|
|
// lib/server/messages.ts) and handed to every descendant through
|
|
// MessagesProvider; the runtime locale list (lib/server/locales.ts ->
|
|
// /api/admin/locales, FALLBACK_LOCALES on failure) goes through
|
|
// LocalesProvider for the switcher and the /messages per-locale inputs.
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
// Resolution lives in lib/server/i18n.ts so getServerT (server components) can never disagree with it.
|
|
const [{ locale, locales }, messages] = await Promise.all([requestLocale(), requestCatalog()]);
|
|
const memberPortalUrl = await loadMemberPortalUrl();
|
|
|
|
return (
|
|
<html lang={locale.replace("_", "-")} className={`${inter.variable} ${dmSans.variable}`}>
|
|
<body className="antialiased">
|
|
<LocalesProvider locales={locales}>
|
|
<MessagesProvider locale={locale} messages={messages}>
|
|
<ThemeProvider>
|
|
<StorefrontOriginProvider origin={memberPortalUrl}>
|
|
<AdminAuthProvider>
|
|
<AppShell>{children}</AppShell>
|
|
</AdminAuthProvider>
|
|
</StorefrontOriginProvider>
|
|
</ThemeProvider>
|
|
</MessagesProvider>
|
|
</LocalesProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|