2026-01-14 12:02:03 +01:00
|
|
|
import Head from "next/head";
|
|
|
|
|
import { AreaRiservataLayout } from "~/components/Layout";
|
|
|
|
|
import type { NextPageWithLayout } from "~/pages/_app";
|
|
|
|
|
import { api } from "~/utils/api";
|
|
|
|
|
|
|
|
|
|
const Impostazioni: NextPageWithLayout = () => {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Head>
|
2026-01-19 10:23:16 +01:00
|
|
|
<title>Impostazioni - Infoalloggi.it</title>
|
2026-01-14 12:02:03 +01:00
|
|
|
</Head>
|
|
|
|
|
|
|
|
|
|
<div className="mx-3 flex flex-1 flex-col gap-4 overflow-auto pt-5">
|
|
|
|
|
<div className="items-start justify-between md:flex">
|
|
|
|
|
<div className="mx-1 flex items-center">
|
|
|
|
|
<h3 className="font-bold text-2xl">Impostazioni</h3>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<StripeSection />
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
export default Impostazioni;
|
|
|
|
|
|
|
|
|
|
Impostazioni.getLayout = function getLayout(page) {
|
|
|
|
|
return <AreaRiservataLayout>{page}</AreaRiservataLayout>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const StripeSection = () => {
|
|
|
|
|
const { data, isLoading } = api.stripe.health.useQuery();
|
|
|
|
|
if (isLoading) {
|
|
|
|
|
return <div>Loading...</div>;
|
|
|
|
|
}
|
2026-01-19 10:23:16 +01:00
|
|
|
|
2026-01-14 12:02:03 +01:00
|
|
|
return (
|
|
|
|
|
<div className="rounded-lg border p-4">
|
|
|
|
|
<h4 className="mb-2 font-semibold text-lg">
|
|
|
|
|
Stripe Status: {data?.success ? "Sano" : "Non sano"}
|
|
|
|
|
</h4>
|
|
|
|
|
<p>Endpoint Webhook:</p>
|
|
|
|
|
{data?.endpoints?.data.map((endpoint) => (
|
|
|
|
|
<div className="mb-2" key={endpoint.id}>
|
2026-01-19 09:36:35 +01:00
|
|
|
<p>ID: {endpoint.id}</p>
|
|
|
|
|
<p>URL: {endpoint.url}</p>
|
2026-01-14 12:02:03 +01:00
|
|
|
|
|
|
|
|
<p>Eventi attivi: </p>
|
|
|
|
|
<ul className="list-inside list-disc">
|
|
|
|
|
{endpoint.enabled_events.map((event) => (
|
|
|
|
|
<li key={event}>{event}</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Versione Api: {endpoint.api_version}</p>
|
2026-01-19 09:36:35 +01:00
|
|
|
<p>Stato: {endpoint.status}</p>
|
|
|
|
|
|
2026-01-14 12:02:03 +01:00
|
|
|
<hr className="my-2" />
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|