2025-08-28 18:27:07 +02:00
|
|
|
import { RefreshCcw } from "lucide-react";
|
2025-08-04 17:45:44 +02:00
|
|
|
import { AreaRiservataLayout } from "~/components/Layout";
|
|
|
|
|
import { LoadingPage } from "~/components/loading";
|
|
|
|
|
import { Status500 } from "~/components/status-page";
|
|
|
|
|
import { AnnunciTable } from "~/components/tables/annunci-tables";
|
2025-08-28 18:27:07 +02:00
|
|
|
import type { NextPageWithLayout } from "~/pages/_app";
|
|
|
|
|
import { api } from "~/utils/api";
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
const Admin_Annunci: NextPageWithLayout = () => {
|
2025-08-28 18:27:07 +02:00
|
|
|
const { data, isLoading, refetch } = api.annunci.getAnnunciList.useQuery();
|
|
|
|
|
if (isLoading) return <LoadingPage />;
|
|
|
|
|
if (!data) return <Status500 />;
|
|
|
|
|
return (
|
|
|
|
|
<div className="mx-1 flex-1 overflow-auto">
|
|
|
|
|
<div className="mx-auto pt-4">
|
|
|
|
|
<div className="mx-3 items-start justify-between md:flex">
|
|
|
|
|
<div className="flex max-w-lg items-center gap-3">
|
|
|
|
|
<h3 className="text-2xl font-bold">Annunci</h3>
|
|
|
|
|
<button
|
|
|
|
|
className="cursor-pointer"
|
2025-08-29 16:18:32 +02:00
|
|
|
onClick={async () => await refetch()}
|
|
|
|
|
type="button"
|
2025-08-28 18:27:07 +02:00
|
|
|
>
|
|
|
|
|
<RefreshCcw className="size-6" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<AnnunciTable data={data} />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Admin_Annunci;
|
|
|
|
|
|
|
|
|
|
Admin_Annunci.getLayout = function getLayout(page) {
|
2025-08-28 18:27:07 +02:00
|
|
|
return <AreaRiservataLayout>{page}</AreaRiservataLayout>;
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|