From 191b548e787dff4f7e2f3fbaa0639439fe19162b Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Sun, 31 May 2026 20:09:09 +0200 Subject: [PATCH] feat(06-01): move client list to /admin/clients, /admin redirects to clients - New /admin/clients/page.tsx contains full client list with getAllClientsWithPayments - Toggle archived link updated from /admin?archived=1 to /admin/clients?archived=1 - /admin/page.tsx replaced with redirect() to /admin/clients --- src/app/admin/clients/page.tsx | 67 ++++++++++++++++++++++++++++++++ src/app/admin/page.tsx | 71 +++------------------------------- 2 files changed, 72 insertions(+), 66 deletions(-) create mode 100644 src/app/admin/clients/page.tsx diff --git a/src/app/admin/clients/page.tsx b/src/app/admin/clients/page.tsx new file mode 100644 index 0000000..460f15a --- /dev/null +++ b/src/app/admin/clients/page.tsx @@ -0,0 +1,67 @@ +import Link from "next/link"; +import { getAllClientsWithPayments } from "@/lib/admin-queries"; +import { ClientRow } from "@/components/admin/ClientRow"; +import { Button } from "@/components/ui/button"; + +export const revalidate = 0; + +export default async function AdminClientsPage({ + searchParams, +}: { + searchParams: Promise<{ archived?: string }>; +}) { + const { archived } = await searchParams; + const showArchived = archived === "1"; + const clients = await getAllClientsWithPayments(showArchived); + + return ( +
+
+
+

Clienti

+ + {showArchived ? "Nascondi archiviati" : "Mostra archiviati"} + +
+ +
+ + {clients.length === 0 ? ( +
+

{showArchived ? "Nessun cliente archiviato." : "Nessun cliente ancora."}

+ {!showArchived && ( +

+ + Crea il primo cliente + +

+ )} +
+ ) : ( +
+ + + + + + + + + + + + {clients.map((client) => ( + + ))} + +
ClienteLTVImporto incassatoImporto da saldareLink
+
+ )} +
+ ); +} diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 0d80a59..4222666 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -1,67 +1,6 @@ -import Link from "next/link"; -import { getAllClientsWithPayments } from "@/lib/admin-queries"; -import { ClientRow } from "@/components/admin/ClientRow"; -import { Button } from "@/components/ui/button"; +import { redirect } from "next/navigation"; -export const revalidate = 0; - -export default async function AdminDashboard({ - searchParams, -}: { - searchParams: Promise<{ archived?: string }>; -}) { - const { archived } = await searchParams; - const showArchived = archived === "1"; - const clients = await getAllClientsWithPayments(showArchived); - - return ( -
-
-
-

Clienti

- - {showArchived ? "Nascondi archiviati" : "Mostra archiviati"} - -
- -
- - {clients.length === 0 ? ( -
-

{showArchived ? "Nessun cliente archiviato." : "Nessun cliente ancora."}

- {!showArchived && ( -

- - Crea il primo cliente - -

- )} -
- ) : ( -
- - - - - - - - - - - - {clients.map((client) => ( - - ))} - -
ClienteLTVImporto incassatoImporto da saldareLink
-
- )} -
- ); -} \ No newline at end of file +// Dashboard page — content added in Phase 6 Plan 02 +export default function AdminRoot() { + redirect("/admin/clients"); +}