import dynamic from "next/dynamic";
import { NewColumn } from "~/components/area-riservata/potenziali";
import { AreaRiservataLayout } from "~/components/Layout";
import { LoadingPage } from "~/components/loading";
import type { NextPageWithLayout } from "~/pages/_app";
import { PotenzialiProvider } from "~/providers/PotenzialiProvider";

const PotenzialiBoard = dynamic(
	() =>
		import("~/components/area-riservata/potenziali").then(
			(mod) => mod.Potenziali,
		),
	{
		ssr: false,
		loading: () => <LoadingPage />,
	},
);

const AdminPotenziali: NextPageWithLayout = () => {
	return (
		<PotenzialiProvider>
			<div className="mx-1 flex-1 overflow-auto">
				<div className="mx-auto pt-4">
					<div className="mx-3 flex-wrap items-start justify-between pb-5 sm:flex">
						<div className="flex max-w-lg items-center gap-3">
							<h3 className="font-bold text-accent-foreground text-xl sm:text-2xl">
								Potenziali
							</h3>
						</div>
						<NewColumn />
					</div>

					<PotenzialiBoard />
				</div>
			</div>
		</PotenzialiProvider>
	);
};
export default AdminPotenziali;

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