Files

51 lines
1.3 KiB
TypeScript

import type { Metadata } from 'next'
import { Geist, Geist_Mono } from 'next/font/google'
import './globals.css'
import { I18nProvider } from '@/lib/i18n/context'
import { getLocale, loadMessages } from '@/lib/i18n/server'
const geistSans = Geist({
variable: '--font-geist-sans',
subsets: ['latin'],
})
const geistMono = Geist_Mono({
variable: '--font-geist-mono',
subsets: ['latin'],
})
export const metadata: Metadata = {
title: 'IMS — HSE Incident Management',
description: 'Setia Corporation HSE Incident Management System',
}
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode
}>) {
const locale = await getLocale()
const messages = await loadMessages(locale)
return (
<html
lang={locale}
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
>
<head>
<link rel="manifest" href="/manifest.json" />
</head>
<body className="min-h-full flex flex-col">
<I18nProvider messages={messages}>
{children}
</I18nProvider>
<script
dangerouslySetInnerHTML={{
__html: `if('serviceWorker'in navigator){navigator.serviceWorker.register('/sw.js',{scope:'/'}).catch(console.error)}`,
}}
/>
</body>
</html>
)
}