mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 03:40:56 +00:00
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { Metadata } from 'next';
|
|
import { headers } from 'next/headers';
|
|
import '@/styles/globals.css';
|
|
import Providers from './providers';
|
|
|
|
export const metadata: Metadata = {
|
|
title: 'EDR Passenger Back-office',
|
|
description: 'Ethio-Djibouti Railway Passenger Back-office',
|
|
};
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
// Nonce set per-request by middleware; required for this inline script under the CSP.
|
|
const nonce = headers().get('x-nonce') ?? undefined;
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<script
|
|
nonce={nonce}
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
(function() {
|
|
try {
|
|
const stored = localStorage.getItem('edr-theme');
|
|
const theme = stored ? JSON.parse(stored).state.isDark : window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
if (theme) document.documentElement.classList.add('dark');
|
|
} catch (e) {}
|
|
})();
|
|
`,
|
|
}}
|
|
/>
|
|
</head>
|
|
<body className="font-sans antialiased">
|
|
<Providers>{children}</Providers>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|