78 lines
2.2 KiB
TypeScript
78 lines
2.2 KiB
TypeScript
import { mockDb } from '../../lib/mockDb';
|
||
import type { Metadata } from "next";
|
||
import { Unbounded, Golos_Text, IBM_Plex_Mono } from "next/font/google";
|
||
import { NextIntlClientProvider } from 'next-intl';
|
||
import { getMessages, setRequestLocale } from 'next-intl/server';
|
||
import { notFound } from 'next/navigation';
|
||
import { routing } from '@/i18n/routing';
|
||
import { headers } from 'next/headers';
|
||
import Navbar from '@/components/Navbar';
|
||
import Footer from '@/components/Footer';
|
||
import "../globals.css";
|
||
|
||
const unbounded = Unbounded({
|
||
variable: "--font-unbounded",
|
||
subsets: ["latin", "cyrillic"],
|
||
weight: ["400", "600", "800"],
|
||
});
|
||
|
||
const golosText = Golos_Text({
|
||
variable: "--font-golos",
|
||
subsets: ["latin", "cyrillic"],
|
||
weight: ["400", "500", "600"],
|
||
});
|
||
|
||
const ibmPlexMono = IBM_Plex_Mono({
|
||
variable: "--font-mono",
|
||
subsets: ["latin", "cyrillic"],
|
||
weight: ["400", "500"],
|
||
});
|
||
|
||
export const metadata: Metadata = {
|
||
title: "Marmaris Local — Yerel Rehber",
|
||
description: "Marmaris'in en iyi yerel mekanları, restoranları ve saklı apart otelleri.",
|
||
manifest: "/manifest.json",
|
||
};
|
||
|
||
export function generateStaticParams() {
|
||
return routing.locales.map((locale) => ({locale}));
|
||
}
|
||
|
||
export default async function RootLayout({
|
||
children,
|
||
params
|
||
}: Readonly<{
|
||
children: React.ReactNode;
|
||
params: Promise<{ locale: string }>;
|
||
}>) {
|
||
const { locale } = await params;
|
||
|
||
if (!routing.locales.includes(locale as any)) {
|
||
notFound();
|
||
}
|
||
|
||
setRequestLocale(locale);
|
||
const messages = await getMessages();
|
||
|
||
const headersList = await headers();
|
||
const pathname = headersList.get('x-pathname') || '';
|
||
const hideNavbarFooter = pathname.includes('/admin') || pathname.includes('/login');
|
||
|
||
const categories = await mockDb.getCategories();
|
||
|
||
return (
|
||
<html
|
||
lang={locale}
|
||
className={`${unbounded.variable} ${golosText.variable} ${ibmPlexMono.variable} h-full antialiased`}
|
||
>
|
||
<body className="min-h-full flex flex-col font-sans" suppressHydrationWarning>
|
||
<NextIntlClientProvider messages={messages}>
|
||
{!hideNavbarFooter && <Navbar categories={categories} />}
|
||
{children}
|
||
{!hideNavbarFooter && <Footer />}
|
||
</NextIntlClientProvider>
|
||
</body>
|
||
</html>
|
||
);
|
||
}
|