import Header from "@/components/nav_foot/header";
import Navbar from "@/components/nav_foot/navbar";
import Footer from "@/components/nav_foot/footer";
import Contact from "@/components/pageParts/contact";
import UpScrollIcon from "@/components/lib_components/upScroll";
import { Suspense } from "react";
import Time from "@/components/lib_components/time";
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";

export default async function LangLayout({
  children,
  params,
}: {
  children: React.ReactNode;
  params: Promise<{ lang: string }>;
}) {
  const { lang } = await params;
  const messages = await getMessages();

  return (
    <html lang={lang} dir="rtl" suppressHydrationWarning>
      <body>
        <NextIntlClientProvider messages={messages}>
          <Suspense fallback={null}>
            <Header />
          </Suspense>
          <Navbar />
          {children}
          <section id="contact">
            <Contact />
          </section>
          <Footer />
          <UpScrollIcon />
          <Time />
        </NextIntlClientProvider>
      </body>
    </html>
  );
}
