2025-06-07 16:31:52 +03:30
|
|
|
import Footer from '@/components/layout/footer/Footer';
|
|
|
|
|
import '@/app/globals.css';
|
|
|
|
|
import 'leaflet/dist/leaflet.css';
|
|
|
|
|
import { notFound } from 'next/navigation';
|
|
|
|
|
import { NextIntlClientProvider } from 'next-intl';
|
2025-06-09 11:29:54 +03:30
|
|
|
import type { IPageParams } from '@/models/layout.d';
|
2025-06-07 16:31:52 +03:30
|
|
|
|
|
|
|
|
export default async function RootLayout({
|
|
|
|
|
children,
|
|
|
|
|
params,
|
|
|
|
|
}: Readonly<{
|
|
|
|
|
children: React.ReactNode;
|
2025-06-09 11:29:54 +03:30
|
|
|
params: IPageParams;
|
2025-06-07 16:31:52 +03:30
|
|
|
}>) {
|
2025-06-08 15:52:05 +03:30
|
|
|
const paramsData = await params;
|
|
|
|
|
const locale = paramsData.locale;
|
2025-06-07 16:31:52 +03:30
|
|
|
|
2025-06-08 10:05:37 +03:30
|
|
|
const fontClass = locale === 'fa' ? 'font-fa' : 'font-en';
|
|
|
|
|
|
2025-06-07 16:31:52 +03:30
|
|
|
let messages;
|
|
|
|
|
try {
|
2025-06-08 09:25:38 +03:30
|
|
|
messages = (await import(`../../../messages/${locale}.json`)).default;
|
2025-06-07 16:31:52 +03:30
|
|
|
} catch (error) {
|
|
|
|
|
notFound();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<html lang={locale} dir={locale === 'fa' ? 'rtl' : 'ltr'}>
|
2025-06-08 10:05:37 +03:30
|
|
|
<body className={`min-h-svh w-full overflow-x-hidden ${fontClass}`}>
|
2025-06-07 16:31:52 +03:30
|
|
|
<NextIntlClientProvider locale={locale} messages={messages}>
|
|
|
|
|
{children}
|
|
|
|
|
<Footer />
|
|
|
|
|
</NextIntlClientProvider>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
);
|
|
|
|
|
}
|