peppa/apps/web/app/layout.tsx
peppa-bot d8a37833f3
All checks were successful
peppa/build build: success за 16с
peppa/bundle bundle: success за 0с
peppa/lint lint: success за 1с
peppa/typecheck typecheck: success за 21с
PEP-217: Web Vitals пользователей, проверка веса JS в CI, словари не в браузерном бандле
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 17:03:07 +05:00

33 lines
1.4 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 { dictionary, 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} dict={locale === "ru" ? undefined : dictionary(locale)}>
<ErrorReporter />
{children}
</I18nProvider>
</body>
</html>
);
}