import type { ReactNode } from "react";
import type { LayoutProps } from '@/core/types/common';

import { getServerSession } from "next-auth";
import { authOptions } from "@/core/lib/auth/options";

import ProfileHeader from '@/core/common/ProfileHeader';

export const dynamic = "force-dynamic";
// TODO: The shit implementation of the these pages, should be refactored and remade,
//  because there's no normal way to handle related states and UI.

export default async function Layout(props: LayoutProps): Promise<ReactNode>  {

  const session = await getServerSession(authOptions);

  return (
    <div className={"min-h-screen h-full pb-8 flex flex-col items-center bg-[#F6F6F6] px-4"}>
      <div className={"flex flex-col w-full max-w-[1440px] pt-5"}>
        <ProfileHeader session={session} />
        <section className={"flex-grow justify-center"}>
          <div className={`min-h-screen pt-20`}>
            {props.children}
          </div>
        </section>
      </div>
    </div>
  );
}
