import Head from "next/head";
import { EmailAccordion } from "~/components/area-riservata/comunicazioni";
import { AreaRiservataLayout } from "~/components/Layout";
import type { NextPageWithLayout } from "~/pages/_app";
import { useTranslation } from "~/providers/I18nProvider";
import { useEnforcedSession } from "~/providers/SessionProvider";

const Comunicazioni: NextPageWithLayout = () => {
	const { t } = useTranslation();
	const session = useEnforcedSession();

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

			<div className="mx-auto max-w-8xl grow p-4">
				<div className="p-1">
					<h1 className="font-bold text-2xl text-primary">Comunicazioni</h1>
				</div>

				<EmailAccordion
					isAdmin={session.user.isAdmin}
					userId={session.user.id}
				/>
			</div>
		</>
	);
};
export default Comunicazioni;
export async function getServerSideProps() {
	return {
		props: {},
	};
}

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