mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import type { Metadata } from 'next';
|
|
import { headers } from 'next/headers';
|
|
import './globals.css';
|
|
import { Providers } from './providers';
|
|
import AppSidebar from '@/components/AppSidebar';
|
|
import MobileTopBar from '@/components/MobileTopBar';
|
|
import BottomTabBar from '@/components/BottomTabBar';
|
|
import { LoadingIndicator } from '@/components/LoadingIndicator';
|
|
import SupportWidget from '@/features/support/SupportWidgetLazy';
|
|
|
|
export const metadata: Metadata = {
|
|
title: 'EDR Passenger Portal - Book your train journey',
|
|
description: 'Book train tickets on the Ethio-Djibouti Railway',
|
|
};
|
|
|
|
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>
|
|
<body className="font-sans antialiased">
|
|
<script
|
|
nonce={nonce}
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
(function() {
|
|
try {
|
|
var theme = localStorage.getItem('theme');
|
|
var effectiveTheme = 'light';
|
|
|
|
if (theme === 'dark') {
|
|
effectiveTheme = 'dark';
|
|
} else if (theme === 'light') {
|
|
effectiveTheme = 'light';
|
|
} else if (theme === 'system' || !theme) {
|
|
effectiveTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
}
|
|
|
|
document.documentElement.classList.add(effectiveTheme);
|
|
} catch (e) {}
|
|
})();
|
|
`,
|
|
}}
|
|
/>
|
|
<Providers>
|
|
<LoadingIndicator />
|
|
<AppSidebar />
|
|
<div className="lg:pl-64 flex flex-col min-h-screen">
|
|
<MobileTopBar />
|
|
<main className="flex-1">
|
|
{children}
|
|
</main>
|
|
<BottomTabBar />
|
|
</div>
|
|
<SupportWidget />
|
|
</Providers>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|