import type { NextPage } from "next";
import Head from "next/head";
import { useTranslation } from "~/providers/I18nProvider";
import type { TestiEStringheStingaId } from "~/schemas/public/TestiEStringhe";
import { api } from "~/utils/api";

const Termini_Condizioni: NextPage = () => {
	const { t, locale } = useTranslation();
	const key = (
		locale === "en" ? "TERMINI_CONDIZIONI_ENG" : "TERMINI_CONDIZIONI"
	) as TestiEStringheStingaId;
	const { data } = api.settings.getStringa.useQuery({
		stringaId: key,
	});
	return (
		<>
			<Head>
				<title>{t.termini_condizioni_title}</title>
				<meta name="description" content={t.termini_condizioni_desc} />
			</Head>

			<div className="mx-auto flex h-full items-center justify-center p-4">
				{data && (
					<div
						className="prose max-w-5xl"
						dangerouslySetInnerHTML={{ __html: data.stringa_value || "" }}
					/>
				)}
			</div>
		</>
	);
};
export default Termini_Condizioni;
