2026-08-15 18:42:06 +03:00

84 lines
2.8 KiB
TypeScript

import type { Metadata, Viewport } from 'next';
import { cookies } from 'next/headers';
import '@/src/index.css';
import '@/src/App.css';
import '@/src/css/Unit.css';
import '@/src/css/Building.css';
import { ThemeProvider } from '@/src/context/ThemeContext';
import AppShell from '@/components/AppShell';
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://dow-wiki.example.com';
export const metadata: Metadata = {
metadataBase: new URL(siteUrl),
title: {
default: 'Dawn of War Wiki — юниты, расы и здания всех модов',
template: '%s — Dawn of War Wiki',
},
description:
'Dawn of War wiki. Unification mod wiki. Unification mod unit stats. Supported all popular mods.',
manifest: '/manifest.json',
applicationName: 'Dawn of War Wiki',
verification: {
google: 'Q4XMn2UDpL2xmK7iBfaWQpVN8EPy8oGxN-7HqSKapb0',
},
openGraph: {
type: 'website',
siteName: 'Dawn of War Wiki',
title: 'Dawn of War Wiki — юниты, расы и здания всех модов',
description:
'Dawn of War wiki. Unification mod wiki. Unification mod unit stats. Supported all popular mods.',
images: ['/logo512.png'],
},
twitter: {
card: 'summary_large_image',
},
robots: {
index: true,
follow: true,
},
};
export const viewport: Viewport = {
themeColor: '#000000',
width: 'device-width',
initialScale: 1,
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
// Читаем тему из cookie на сервере, чтобы сразу отрендерить нужную тему без мерцания.
const themeCookie = cookies().get('theme')?.value;
const initialMode = themeCookie === 'light' ? 'light' : 'dark';
return (
<html lang="en" data-theme={initialMode} style={{ colorScheme: initialMode }}>
<body>
{/* Yandex.Metrika */}
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html:
"(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();for(var j=0;j<document.scripts.length;j++){if(document.scripts[j].src===r){return;}}k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})(window,document,\"script\",\"https://mc.yandex.ru/metrika/tag.js\",\"ym\");ym(99502794,\"init\",{clickmap:true,trackLinks:true,accurateTrackBounce:true,webvisor:true});",
}}
/>
<noscript>
<div>
<img
src="https://mc.yandex.ru/watch/99502794"
style={{ position: 'absolute', left: -9999 }}
alt=""
/>
</div>
</noscript>
<ThemeProvider initialMode={initialMode}>
<AppShell>{children}</AppShell>
</ThemeProvider>
</body>
</html>
);
}