Files
clienthub/.planning/milestones/v2.2-phases/18-cleanup-consolidamento/18-02-SUMMARY.md
T
simone f7eb7eec23 docs(planning): archivia v2.1/v2.2/v2.3 e documenta v2.4
.planning/ documentava in dettaglio cio che era vecchio e per niente cio
che e in produzione: le fasi 11-22 (v2.1 e v2.2, chiuse a giugno) erano
ancora in phases/ mentre v1.0 e v2.0 stavano gia in milestones/, e il
lavoro degli ultimi due mesi - gate OTP e ciclo di vita dei retainer, cioe
quello che gira su hub.iamcavalli.net - non aveva nessuna cartella.

- phases/{11,12,14} -> milestones/v2.1-phases/, phases/{18..22} ->
  milestones/v2.2-phases/. Ora phases/ contiene solo la milestone in
  corso, che e quello che state.cjs conta per il progresso
- v2.1-ROADMAP.md ricostruito: era l'unica milestone senza archivio,
  interrotta dal reset del 19/06 e mai chiusa formalmente
- v2.3-ROADMAP.md + v2.3-REQUIREMENTS.md: v2.3 e stata eseguita fuori dal
  ciclo GSD, non esistono PLAN/SUMMARY per fase. L'archivio E la doc
- REQUIREMENTS.md riscritto per v2.4 con il backlog reale
- phases/13 e phases/26: SUMMARY ricostruiti da commit, migration e
  STATUS.md. 26 e il primo numero libero
- research/: cancellate 4 varianti dello stesso PITFALLS e FEATURES/
  SUMMARY, superati da PROJECT.md. Diverse anti-feature erano ormai
  contraddette dai fatti (il Kanban e stato costruito in Phase 19,
  l'email in v2.3, il time tracking esiste)
- cancellati UI-RULES.md e DESIGN-SYSTEM.md (CLAUDE.md li dichiara
  superseded: impongono l'inverso della regola attuale) e HANDOFF.md,
  fermo al 13/06
- SECURITY-*.md -> security/: audit chiuso, ma i report restano la doc di
  cosa e stato ruotato e perche
- PROJECT.md/MILESTONES.md/ROADMAP.md allineati: milestone corrente v2.4,
  sessione OTP 90gg non 30, migrazioni fino alla 0016

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 22:38:36 +02:00

114 lines
5.0 KiB
Markdown

---
phase: 18-cleanup-consolidamento
plan: "02"
subsystem: ui
tags: [nextjs, analytics, dashboard, react, tailwind]
# Dependency graph
requires:
- phase: analytics-queries
provides: getAnalyticsByYear, getMonthlyCollected, getAvailableYears, getTimeByClient, getTotalTrackedHours
provides:
- Admin dashboard at /admin integrates annual statistics (MetricCard, MonthlyChart, time tracking per client)
- /admin/analytics route deleted — returns 404
- YearSelector navigates to /admin?year=Y
affects: [18-cleanup-consolidamento, admin-ui, analytics]
# Tech tracking
tech-stack:
added: []
patterns:
- Server page accepts searchParams for year filtering
- Analytics queries co-located with dashboard queries in same async page
key-files:
created: []
modified:
- src/app/admin/page.tsx
- src/components/admin/YearSelector.tsx
deleted:
- src/app/admin/analytics/page.tsx
key-decisions:
- "Unified fmtEur to accept number (analytics version); KPI card callers wrapped with parseFloat() for string DB values"
- "Two separate awaits in AdminDashboard: getDashboardStats() first, then analytics Promise.all — acceptable for clarity"
- "Stale .next cache (OfferSelector.tsx reference) cleared before final build — pre-existing issue, not introduced by this plan"
patterns-established:
- "Statistics section appended after activity feed — existing dashboard structure preserved above new section"
requirements-completed:
- CLEAN-03
# Metrics
duration: 15min
completed: 2026-06-19
---
# Phase 18 Plan 02: Consolidate Analytics Dashboard Summary
**Merged /admin/analytics statistics (MetricCard, MonthlyChart, per-client time tracking) into /admin dashboard and deleted the duplicate route**
## Performance
- **Duration:** ~15 min
- **Started:** 2026-06-19T10:04:00Z
- **Completed:** 2026-06-19T10:19:00Z
- **Tasks:** 2
- **Files modified:** 3 (2 modified, 1 deleted)
## Accomplishments
- AdminDashboard now shows annual statistics section below activity feed: MetricCard economic metrics, MonthlyChart, and per-client time tracking bars
- /admin/analytics route deleted — navigating there returns 404
- YearSelector updated to navigate to /admin?year=Y instead of /admin/analytics?year=Y
- fmtEur unified to number-accepting version (more robust); existing KPI card string values wrapped with parseFloat()
## Task Commits
1. **Task 1: Integra statistiche annuali nella Dashboard** — included in `14bdbab` (feat)
2. **Task 2: Elimina rotta /admin/analytics** — included in `14bdbab` (feat)
**Plan metadata:** (docs commit below)
## Files Created/Modified
- `src/app/admin/page.tsx` — Added analytics imports, searchParams, analytics queries, MetricCard, fmtSeconds, fmtEur(number), statistics section
- `src/components/admin/YearSelector.tsx` — Updated router.push from /admin/analytics to /admin
- `src/app/admin/analytics/page.tsx` — Deleted
## Decisions Made
- Unified `fmtEur` to the `number` version from analytics (cleaner, no `parseFloat` internally). Updated the two KPI card callers that received string values from DB to pass `parseFloat(kpi.revenueTotale)` and `parseFloat(kpi.pagamentiInSospeso)`.
- Used two sequential awaits (getDashboardStats first, then analytics Promise.all) rather than one large combined Promise.all — avoids mixing query concerns and follows plan guidance for acceptable two-await pattern.
- Preserved all existing dashboard content (FollowUpWidget, KPI cards, activity feed) exactly; statistics section appended at the bottom with `mt-10`.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Cleared stale .next cache referencing deleted OfferSelector.tsx**
- **Found during:** Build verification after Task 2
- **Issue:** Stale `.next/tsconfig.tsbuildinfo` incremental cache listed `src/components/admin/quotes/OfferSelector.tsx` as a root file. That file had been deleted in a prior session. TypeScript errored with "File not found — root file specified for compilation." The pre-existing cache was masking this because prior builds hit cached output.
- **Fix:** Ran `rm -rf .next` to clear the stale incremental cache, then rebuilt clean.
- **Files modified:** .next/ (cache only — not tracked in git)
- **Verification:** Clean build passes with TypeScript check and all routes compiled correctly.
- **Committed in:** n/a (cache not committed)
---
**Total deviations:** 1 auto-fixed (Rule 3 - blocking)
**Impact on plan:** Required to get a clean build. Pre-existing issue unrelated to this plan's scope. .next/ is gitignored so no source changes.
## Issues Encountered
- Stale `.next` incremental TypeScript cache referenced `OfferSelector.tsx` (deleted in a prior session). Cleared cache, rebuilt clean. Build passes correctly.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- /admin is the single analytics entry point — ready for 18-03 and any future admin UI work
- No stale routes remain in the analytics path
- Build is clean
---
*Phase: 18-cleanup-consolidamento*
*Completed: 2026-06-19*