infoalloggi-monorepo/apps/infoalloggi/src/pages/privacy-policy.tsx

51 lines
1.4 KiB
TypeScript
Raw Normal View History

import type { GetServerSideProps, NextPage } from "next";
2025-08-28 18:27:07 +02:00
import Head from "next/head";
2025-08-04 17:45:44 +02:00
import { useTranslation } from "~/providers/I18nProvider";
import type { TestiEStringheStingaId } from "~/schemas/public/TestiEStringhe";
import { generateSSGHelper } from "~/server/utils/ssgHelper";
2025-08-28 18:27:07 +02:00
import { api } from "~/utils/api";
2025-08-04 17:45:44 +02:00
const PrivacyPolicy: NextPage = () => {
2025-08-28 18:27:07 +02:00
const { t, locale } = useTranslation();
const key = (
locale === "en" ? "PRIVACY_POLICY_ENG" : "PRIVACY_POLICY"
) as TestiEStringheStingaId;
const { data } = api.settings.getStringa.useQuery({
stringaId: key,
});
return (
<>
<Head>
<title>{t.privacy_policy_title}</title>
2025-08-29 16:18:32 +02:00
<meta content={t.privacy_policy_desc} name="description" />
2025-08-28 18:27:07 +02:00
</Head>
2025-08-04 17:45:44 +02:00
2025-08-28 18:27:07 +02:00
<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>
</>
);
2025-08-04 17:45:44 +02:00
};
export const getServerSideProps = (async (context) => {
const locale = context.locale || "it";
const key = locale === "en" ? "PRIVACY_POLICY_ENG" : "PRIVACY_POLICY";
const helpers = generateSSGHelper();
await helpers.settings.getStringa.prefetch({
stringaId: key as TestiEStringheStingaId,
});
return {
props: {
trpcState: helpers.dehydrate(),
},
};
}) satisfies GetServerSideProps;
2025-08-04 17:45:44 +02:00
export default PrivacyPolicy;