38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import Head from "@/app/components/utils/head.tsx";
|
|
import { BackgroundProvider } from "@/app/game-engine/background-provider.tsx";
|
|
import { context } from "@bureaudouble/rsc/server/context";
|
|
import { ShellProvider } from "../game-engine/shell-provider.tsx";
|
|
import ChatHeader from "../components/header.tsx";
|
|
import { useServerI18n } from "../actions/locale.ts";
|
|
import { LocaleProvider } from "../game-engine/locale-provider.tsx";
|
|
|
|
interface LayoutProps extends Partial<React.ComponentProps<typeof Head>> {
|
|
className?: string | undefined;
|
|
children?: React.ReactNode;
|
|
style?: React.CSSProperties | undefined;
|
|
variant: "classical" | "terminal";
|
|
}
|
|
|
|
export default async ({ children, variant }: LayoutProps) => {
|
|
const url = new URL(context().request.url);
|
|
const { locale, dictionary } = await useServerI18n();
|
|
|
|
return (
|
|
<Head
|
|
disableAnalytics
|
|
htmlClassName="bg-background group/html"
|
|
fontsSources={[]}
|
|
>
|
|
<LocaleProvider dictionary={dictionary}>
|
|
<BackgroundProvider>
|
|
<ShellProvider variant={variant} asChild>
|
|
<div className="md:scale-95 md:rounded-[1rem] outline-5 outline-neutral-900 shell overflow-y-auto overflow-x-hidden h-dvh flex flex-col max-w-sm mx-auto bg-background relative text-foreground">
|
|
<ChatHeader variant={variant} locale={locale} url={url.href} />
|
|
{children}
|
|
</div>
|
|
</ShellProvider>
|
|
</BackgroundProvider>
|
|
</LocaleProvider>
|
|
</Head>
|
|
);
|
|
};
|