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-11 17:13:51 +03:30
|
|
|
import Head from 'next/head';
|
2025-06-16 14:27:41 +03:30
|
|
|
import { getTranslations } from 'next-intl/server';
|
|
|
|
|
import { host } from '@/config';
|
|
|
|
|
|
|
|
|
|
export async function generateMetadata({ params }: { params: IPageParams }) {
|
|
|
|
|
const { locale } = await params;
|
|
|
|
|
const t = await getTranslations({ locale });
|
|
|
|
|
const url = `${host}/${locale}`;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
title: {
|
|
|
|
|
default: t('meta.defaultTitle'),
|
|
|
|
|
template: t('meta.titleTemplate'),
|
|
|
|
|
},
|
|
|
|
|
description: t('meta.defaultDescription'),
|
|
|
|
|
openGraph: {
|
|
|
|
|
title: t('meta.defaultTitle'),
|
|
|
|
|
description: t('meta.defaultDescription'),
|
|
|
|
|
siteName: t('meta.siteName'),
|
|
|
|
|
type: 'website',
|
|
|
|
|
locale,
|
|
|
|
|
url,
|
|
|
|
|
},
|
|
|
|
|
authors: [{ name: t('meta.author') }],
|
|
|
|
|
};
|
|
|
|
|
}
|
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-11 17:13:51 +03:30
|
|
|
<Head>
|
|
|
|
|
<meta name="robots" content="index, follow" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
<meta property="og:site_name" content="کارخانه آجرپزی پاسارگاد" />
|
|
|
|
|
<meta name="author" content="پاسارگاد" />
|
|
|
|
|
<link rel="icon" href="/favicon.ico" />
|
|
|
|
|
</Head>
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|