75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
import type { Metadata } from 'next';
|
|
import '../globals.css';
|
|
import { ThemeProvider } from '@/shared/config/theme-provider';
|
|
import { PRODUCT_INFO } from '@/shared/constants/data';
|
|
import { hasLocale, Locale, NextIntlClientProvider } from 'next-intl';
|
|
import { routing } from '@/shared/config/i18n/routing';
|
|
import { notFound } from 'next/navigation';
|
|
import Footer from '@/widgets/footer/ui';
|
|
import Navbar from '@/widgets/navbar/ui';
|
|
import { ReactNode } from 'react';
|
|
import { setRequestLocale } from 'next-intl/server';
|
|
import QueryProvider from '@/shared/config/react-query/QueryProvider';
|
|
import Script from 'next/script';
|
|
import { caveat, manrope } from '@/shared/config/fonts';
|
|
import Sidebar from '@/widgets/sidebar/ui';
|
|
|
|
export const metadata: Metadata = {
|
|
title: PRODUCT_INFO.name,
|
|
description: PRODUCT_INFO.description,
|
|
icons: PRODUCT_INFO.favicon,
|
|
};
|
|
|
|
type Props = {
|
|
children: ReactNode;
|
|
params: Promise<{ locale: Locale }>;
|
|
};
|
|
|
|
export function generateStaticParams() {
|
|
return routing.locales.map((locale) => ({ locale }));
|
|
}
|
|
|
|
export default async function RootLayout({ children, params }: Props) {
|
|
const { locale } = await params;
|
|
if (!hasLocale(routing.locales, locale)) {
|
|
notFound();
|
|
}
|
|
|
|
// Enable static rendering
|
|
setRequestLocale(locale);
|
|
|
|
return (
|
|
<html
|
|
lang={locale}
|
|
className={`${manrope.variable} ${caveat.variable}`}
|
|
suppressHydrationWarning
|
|
>
|
|
<body className={'antialiased'}>
|
|
<NextIntlClientProvider locale={locale}>
|
|
<ThemeProvider
|
|
attribute={'class'}
|
|
defaultTheme="light"
|
|
enableSystem
|
|
disableTransitionOnChange
|
|
>
|
|
<QueryProvider>
|
|
<Navbar />
|
|
<Sidebar />
|
|
<div className="overflow-x-hidden">
|
|
{children}
|
|
<Footer />
|
|
</div>
|
|
</QueryProvider>
|
|
</ThemeProvider>
|
|
</NextIntlClientProvider>
|
|
</body>
|
|
<Script
|
|
src="https://buttons.github.io/buttons.js"
|
|
strategy="lazyOnload"
|
|
async
|
|
defer
|
|
/>
|
|
</html>
|
|
);
|
|
}
|