feat: Dashboard admin redesign to Quiet Luxury + client profitability widget

Replica il mock design-reference/pagina-dashboard: layout condensato a
schermata singola (4 KPI + griglia 2/3-1/3), token semantici per dual-theme.

- Nuova query getClientProfitability(year): valore orario reale per cliente
  (contrattualizzato / ore tracciate) con badge margine, target 100 €/h
- Nuovo widget ClientProfitability "Analisi Oraria & Redditività Clienti"
- Rewrite /admin: KPI strip + Cashflow + Redditività | Follow-up + Offerte
  Più Richieste. Rimossi chart mensile, card extra, barre ore/cliente
- Tokenizzati ForecastChart, OffersSoldChart, FollowUpWidget, YearSelector
  (ora pill interattiva); rimosso MonthlyChart e prop availableYears inutile
- DESIGN-SYSTEM.md: inventario + note dashboard (applied 2026-07-11)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 11:57:10 +02:00
parent e5fa07bba3
commit 08aadc1d97
9 changed files with 622 additions and 254 deletions
+20
View File
@@ -148,6 +148,8 @@ across all future admin pages.
| `LeadsViewToggle` | `src/components/admin/leads/LeadsViewToggle.tsx` | Wires `SearchInput` + `SegmentedToggle` together with the table/kanban views. |
| `MilestoneStepper` | `src/components/client/MilestoneStepper.tsx` | Client-portal horizontal milestone stepper: one node per real phase, connecting line filled by `global_progress_pct`. Done = filled `bg-primary` ✓, active = `border-primary` outline, upcoming = `bg-muted`. |
| `LeadDetail` | `src/components/admin/leads/LeadDetail.tsx` | Lead detail page (`/admin/pipeline/[id]`): bespoke header (name + inline `StatusBadge` + action bar), asymmetric `lg:grid-cols-3` layout (1/3 profile card w/ icon-chip rows + tags, 2/3 Note/Follow-up + unified timeline). |
| `ClientProfitability` | `src/components/admin/dashboard/ClientProfitability.tsx` | Dashboard widget: valore orario reale per cliente (`getClientProfitability` → contrattualizzato ÷ ore tracciate) con badge margine (Ottimo `bg-primary/10 text-primary` / In Linea `bg-muted`). |
| `YearSelector` | `src/components/admin/YearSelector.tsx` | Selettore anno restilizzato a pill (`rounded-full border-border bg-card shadow-card`), frecce ←/→, valore `font-mono`. Guida i dati year-scoped della dashboard via `?year=`. |
**Unified timeline pattern**: activities + transcripts merged into one
reverse-chronological "Storico delle Interazioni". Vertical connector = absolute
@@ -157,6 +159,24 @@ expandable (`line-clamp-2` → "Mostra tutto/meno"); activity nodes are muted
(`bg-muted border-border`). Dates are `font-mono` — activities relative
(`formatDistanceToNow`), transcripts absolute (`d MMMM yyyy`).
### Admin Dashboard restyle notes
The `/admin` dashboard was migrated to "Quiet Luxury" (applied 2026-07-11),
replicating `design-reference/pagina-dashboard`. It is a condensed single-screen
layout: no in-`<main>` `PageHeader` (sidebar + shell header carry the chrome).
- **KPI strip**: 4 `bg-card` metric cards (Clienti Attivi · Contrattualizzato ·
Incassato Reale · Ore Tracciate). Value `text-2xl font-bold font-mono`, label
`text-[10px] uppercase text-muted-foreground`. Positive delta uses
`text-emerald-600 dark:text-emerald-400`.
- **Griglia `lg:grid-cols-3`**: 2/3 col = `ForecastChart` (istogramma flussi 12
mesi, mese prossimo evidenziato `bg-primary`) + `ClientProfitability`; 1/3 col =
`FollowUpWidget` (count pill amber) + `OffersSoldChart` ("Offerte Più Richieste").
- **Year selector** interattivo (`YearSelector`) in una toolbar top-right; governa
i KPI year-scoped + redditività. Il forecast è rolling-12-mesi (non year-scoped).
- Widget rimossi dal legacy: chart incassi mensili, card "Da incassare"/"Clienti
acquisiti", barre "Ore per cliente" (sostituite dalla redditività oraria).
### Client Portal restyle notes
The `/client/[token]` portal was migrated to the same "Quiet Luxury" tokens