import { ThemeProvider } from "@/context/ThemeContext";
import "@/styles/globals.scss";
import type { Metadata } from "next";
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
import localFont from "next/font/local";
import { ReactNode } from "react";

const geistSans = localFont({
	src: "./fonts/GeistVF.woff",
	variable: "--font-geist-sans",
	weight: "100 900",
});
const geistMono = localFont({
	src: "./fonts/GeistMonoVF.woff",
	variable: "--font-geist-mono",
	weight: "100 900",
});

export const metadata: Metadata = {
	title: "Time Tracker",
	description: "Time Tracker",
};

type Props = {
	children: ReactNode;
	locale: string;
};

export default async function BaseLayout({ children, locale }: Props) {
	const messages = await getMessages();
	return (
		<html lang={locale}>
			<NextIntlClientProvider messages={messages}>
				<ThemeProvider>
					<body
						className={`${geistSans.variable} ${geistMono.variable} antialiased `}>
						{children}
					</body>
				</ThemeProvider>
			</NextIntlClientProvider>
		</html>
	);
}
