import QwilightView from "@/components/QwilightView";
import { Stores } from "@/state/Stores";
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
import { ReactNode } from "react";

import "react-contexify/dist/ReactContexify.css";
import "react-toastify/dist/ReactToastify.css";
import "@/app/globals.scss";

export default async function RootLayout({
  children,
  params: { language },
}: {
  children: ReactNode;
  params: { language: string };
}) {
  return (
    <html lang={language} data-bs-theme="dark">
      <head>
        <title>Qwilight</title>
      </head>
      <body>
        <NextIntlClientProvider
          locale={language}
          messages={await getMessages({ locale: language })}
        >
          <Stores>
            <QwilightView>{children}</QwilightView>
          </Stores>
        </NextIntlClientProvider>
      </body>
    </html>
  );
}
