import React from "react";
import Header from "@/components/header/Header";
import ClientMenu from "@/components/menu/menu";
import { retrievePageByUrl } from "@/eventRouters/pageRetriever";

async function DashboardPage({
  searchParams,
}: {
  searchParams: Promise<{ [key: string]: string | undefined }>;
}) {
  const activePage = "/application";
  const searchParamsInstance = await searchParams;
  const lang = (searchParamsInstance?.lang as "en" | "tr") || "en";
  const PageComponent = retrievePageByUrl(activePage);

  return (
    <>
      <div className="min-h-screen min-w-screen flex h-screen w-screen">
        {/* Sidebar */}
        <aside className="w-1/4 border-r p-4 overflow-y-auto">
          <ClientMenu lang={lang} activePage={activePage} />
        </aside>

        {/* Main Content Area */}
        <div className="flex flex-col w-3/4 overflow-y-auto">
          {/* Header Component */}
          <Header lang={lang} />
          <PageComponent lang={lang} queryParams={searchParamsInstance} />
        </div>
      </div>
    </>
  );
}

export default DashboardPage;
