import { useTranslation } from "~/providers/I18nProvider";
import type { NextPageWithLayout } from "~/pages/_app";
import { useSession } from "~/providers/SessionProvider";
import { LoadingPage } from "~/components/loading";
import { Status500 } from "~/components/status-page";
import { AreaRiservataLayout } from "~/components/Layout";
import Head from "next/head";
import { AllegatiComp } from "~/components/area-riservata/allegati";
const Allegati: NextPageWithLayout = () => {
  const { t } = useTranslation();
  const session = useSession();

  if (session.status === "pending") return <LoadingPage />;
  if (!session || !session.user) return <Status500 />;

  return (
    <>
      <Head>
        <title>{t.heads.area_riservata_titolo}</title>
        <meta name="description" content={t.heads.area_riservata_description} />
      </Head>

      <div className="grow p-4">
        <AllegatiComp userId={session.user.id} isAdmin={session.user.isAdmin} />
      </div>
    </>
  );
};
export default Allegati;

Allegati.getLayout = function getLayout(page) {
  return <AreaRiservataLayout>{page}</AreaRiservataLayout>;
};
