infoalloggi-monorepo/apps/infoalloggi/src/pages/termini-condizioni.tsx
Marco Pedone 9c18ca37ab Refactor API structure and update flag handling
- Replaced references to `api.settings` with `api.etichette`, `api.flags`, and `api.strings` in various admin pages to align with new API structure.
- Removed the deprecated `settingsRouter` and introduced `flagsRouter`, `etichetteRouter`, and `stringsRouter` to handle respective functionalities.
- Updated the `Flags` schema to change the `value` field from string to boolean.
- Modified flag handling logic in the `SendMessage` and `NewMail` functions to check for boolean flags instead of string values.
- Added migration script to convert the `value` column in the `flags` table from string to boolean.
- Implemented new routers for banners, etichette, flags, revalidation, and strings to encapsulate related functionalities.
2025-11-20 12:38:42 +01:00

49 lines
1.4 KiB
TypeScript

import type { GetServerSideProps, NextPage } from "next";
import Head from "next/head";
import { useTranslation } from "~/providers/I18nProvider";
import type { TestiEStringheStingaId } from "~/schemas/public/TestiEStringhe";
import { generateSSGHelper } from "~/server/utils/ssgHelper";
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.strings.getStringa.useQuery({
stringaId: key,
});
return (
<>
<Head>
<title>{t.termini_condizioni_title}</title>
<meta content={t.termini_condizioni_desc} name="description" />
</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 const getServerSideProps = (async (context) => {
const locale = context.locale || "it";
const key = locale === "en" ? "TERMINI_CONDIZIONI_ENG" : "TERMINI_CONDIZIONI";
const helpers = generateSSGHelper();
await helpers.strings.getStringa.prefetch({
stringaId: key as TestiEStringheStingaId,
});
return {
props: {
trpcState: helpers.dehydrate(),
},
};
}) satisfies GetServerSideProps;
export default Termini_Condizioni;