From a20a9de2d7def198bf64db4155858f06b2e32466 Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Sat, 11 Jul 2026 12:18:10 +0200 Subject: [PATCH] =?UTF-8?q?style:=20rifinitura=20Quiet=20Luxury=20dashboar?= =?UTF-8?q?d=20=E2=80=94=20bordi=20soft,=20badge,=20colori?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allinea la dashboard alla rifinitura del mock (finezza bordi/colori/badge): - Card su border-border-light (slate-100) per il bordo sottile - KPI: valore verde su Incassato Reale, delta verde "+N questo mese" su Clienti Attivi (nuova metrica getDashboardStats.clientiNuoviMese) - Redditività: badge "Ottimo" con tint emerald soft (non brand primary) - Follow-up: righe come box bordati (no avatar), link "Apri →" primary - Forecast: selettore anno (pill interattiva) spostato nell'header della card, barre non-picco grigie (bg-border), rimosso il numero "mese prossimo" - Offerte Più Richieste: rimossa la pill totale nell'header Co-Authored-By: Claude Opus 4.8 --- src/app/admin/page.tsx | 54 ++++++------ src/components/admin/ForecastChart.tsx | 48 ++++------- src/components/admin/OffersSoldChart.tsx | 15 ++-- src/components/admin/YearSelector.tsx | 6 +- .../admin/dashboard/ClientProfitability.tsx | 6 +- .../admin/dashboard/FollowUpWidget.tsx | 84 +++++++------------ src/lib/dashboard-queries.ts | 11 ++- 7 files changed, 95 insertions(+), 129 deletions(-) diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index eb43536..7d09676 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -17,32 +17,34 @@ export const revalidate = 0; function MetricCard({ label, value, + valueAccent, + delta, sub, - positive, }: { label: string; value: string; + valueAccent?: boolean; + delta?: string; sub?: string; - positive?: boolean; }) { return ( -
+
{label}
- {value} - {sub && ( - - {sub} - - )} + + {value} + + {delta ? ( + {delta} + ) : sub ? ( + {sub} + ) : null}
); @@ -80,14 +82,14 @@ export default async function AdminDashboard({ return (
- {/* Toolbar: selettore anno (governa i KPI year-scoped + redditività) */} -
- -
- {/* KPI strip */}
- + 0 ? `+${kpi.clientiNuoviMese} questo mese` : undefined} + sub="Totale corrente" + /> 0} sub={`${collectedPct}% del totale`} - positive={data.collected > 0} - /> - +
{/* Griglia contenuti: 2/3 + 1/3 */}
{/* Colonna 2/3 */}
- + } />
diff --git a/src/components/admin/ForecastChart.tsx b/src/components/admin/ForecastChart.tsx index 6e979a2..08df5c4 100644 --- a/src/components/admin/ForecastChart.tsx +++ b/src/components/admin/ForecastChart.tsx @@ -1,22 +1,19 @@ +import type { ReactNode } from "react"; import type { ForecastMonth } from "@/lib/forecast-queries"; -function fmtEur(n: number) { - return n.toLocaleString("it-IT", { - style: "currency", - currency: "EUR", - minimumFractionDigits: 0, - maximumFractionDigits: 0, - }); -} - -export function ForecastChart({ data }: { data: ForecastMonth[] }) { +export function ForecastChart({ + data, + headerAction, +}: { + data: ForecastMonth[]; + headerAction?: ReactNode; +}) { const max = Math.max(...data.map((d) => d.total), 1); - // index 0 = mese corrente, index 1 = mese prossimo (evidenziato) - const nextMonth = data[1]; + // index 1 = mese prossimo (evidenziato) return ( -
-
+
+

Previsione Flussi di Cassa (12 Mesi) @@ -25,28 +22,19 @@ export function ForecastChart({ data }: { data: ForecastMonth[] }) { Stima basata su retainer attivi e saldi dilazionati

- {nextMonth && ( -
-

- {fmtEur(nextMonth.total)} -

-

- Previsto {nextMonth.label} -

-
- )} + {headerAction}
-
+
{data.map((m, i) => { const pct = Math.round((m.total / max) * 100); const isNext = i === 1; return ( -
-
+
+
0 ? "4px" : "0" }} title={`${m.label}: ${m.total.toLocaleString("it-IT", { style: "currency", currency: "EUR", minimumFractionDigits: 2 })}`} @@ -54,7 +42,7 @@ export function ForecastChart({ data }: { data: ForecastMonth[] }) {
{m.label.split(" ")[0]} diff --git a/src/components/admin/OffersSoldChart.tsx b/src/components/admin/OffersSoldChart.tsx index 20e1153..5abfa48 100644 --- a/src/components/admin/OffersSoldChart.tsx +++ b/src/components/admin/OffersSoldChart.tsx @@ -5,22 +5,17 @@ export function OffersSoldChart({ data }: { data: OffersSoldBreakdown }) { if (data.rows.length === 0) { return ( -
+

Nessuna offerta venduta finora.

); } return ( -
-
-

- Offerte Più Richieste -

- - {data.total} - -
+
+

+ Offerte Più Richieste +

{data.rows.map((row, i) => { const pct = Math.round((row.count / max) * 100); diff --git a/src/components/admin/YearSelector.tsx b/src/components/admin/YearSelector.tsx index 5757ad2..ddf8b25 100644 --- a/src/components/admin/YearSelector.tsx +++ b/src/components/admin/YearSelector.tsx @@ -11,10 +11,10 @@ export function YearSelector({ currentYear }: { currentYear: number }) { } return ( -
+