33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import { cookies } from "next/headers";
|
|
import { GeistSans } from "geist/font/sans";
|
|
import { GeistMono } from "geist/font/mono";
|
|
import { productName } from "@peppa/shared/i18n";
|
|
import { cn } from "@/lib/utils";
|
|
import { THEME_COOKIE } from "@/lib/theme";
|
|
import { getLocale, getT } from "@/lib/i18n";
|
|
import { ErrorReporter } from "@/components/ErrorReporter";
|
|
import { I18nProvider } from "@/components/I18n";
|
|
import "./app.css";
|
|
|
|
export async function generateMetadata() {
|
|
const t = await getT();
|
|
return { title: productName(t.locale), description: t("Peppa FACTORY: опишите идею словами — ИИ-агенты сделают продукт"), icons: { icon: "/icon.svg" } };
|
|
}
|
|
|
|
export default async function RootLayout({ children }: { children: ReactNode }) {
|
|
// Dark by default; the cookie is read on the server so a light choice renders without a dark flash.
|
|
const light = (await cookies()).get(THEME_COOKIE)?.value === "light";
|
|
const locale = await getLocale();
|
|
return (
|
|
<html lang={locale === "kk" ? "kk" : locale} className={cn(GeistSans.variable, GeistMono.variable, !light && "dark")}>
|
|
<body>
|
|
<I18nProvider locale={locale}>
|
|
<ErrorReporter />
|
|
{children}
|
|
</I18nProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|