Moved to next js ssr (with fixes)

This commit is contained in:
anibus
2026-08-15 18:42:06 +03:00
parent 2184f1642c
commit 23bfad8956
21 changed files with 1473 additions and 1659 deletions
+7 -2
View File
@@ -1,4 +1,5 @@
import type { Metadata, Viewport } from 'next';
import { cookies } from 'next/headers';
import '@/src/index.css';
import '@/src/App.css';
import '@/src/css/Unit.css';
@@ -49,8 +50,12 @@ export default function RootLayout({
}: {
children: React.ReactNode;
}) {
// Читаем тему из cookie на сервере, чтобы сразу отрендерить нужную тему без мерцания.
const themeCookie = cookies().get('theme')?.value;
const initialMode = themeCookie === 'light' ? 'light' : 'dark';
return (
<html lang="en">
<html lang="en" data-theme={initialMode} style={{ colorScheme: initialMode }}>
<body>
{/* Yandex.Metrika */}
<script
@@ -69,7 +74,7 @@ export default function RootLayout({
/>
</div>
</noscript>
<ThemeProvider>
<ThemeProvider initialMode={initialMode}>
<AppShell>{children}</AppShell>
</ThemeProvider>
</body>