Skip to content

Commit 4e2f691

Browse files
feat(dashboard): refactor GERENTE dashboard to match ALUNO quality bar (#199)
* docs(gerente): dashboard refactor design spec Co-Authored-By: Claude <noreply@anthropic.com> * docs(dashboard): implementation plan for gerente dashboard refactor * feat(dashboard): replace synthetic crescimentoAnual with real series + delta schema * Revert "feat(dashboard): replace synthetic crescimentoAnual with real series + delta schema" This reverts commit b8009da. * feat(dashboard): replace synthetic crescimentoAnual with real series + delta schema * feat(dashboard): real Prisma series + KPI deltas, re-throw on DB error * fix(dashboard): cast stats in data.test to assert crescimentoAnual absence * feat(dashboard): empty state for honest no-data rendering * feat(dashboard): kpi card component with delta + a11y * feat(dashboard): tokenized multi-series charts with a11y + empty-state * fix(dashboard): single <main> landmark, move pb-20 to inner wrapper * feat(dashboard): wire overview KPI grid + real charts Co-Authored-By: Claude <noreply@anthropic.com> * feat(dashboard): tokenize sub-pages, add pb-20, Suspense on treinos * fix(dashboard): add vi import to multi-chart test (TS2304) * feat(dashboard): loading + error boundaries with retry * test(dashboard): assert financeiro drops #18181B + text-zinc-400 Co-Authored-By: Claude <noreply@anthropic.com> * refactor(dashboard): delete legacy dashboard-charts.tsx (replaced by multi) Co-Authored-By: Claude <noreply@anthropic.com> * docs(dashboard): update CURRENT-STATE for gerente dashboard refactor Co-Authored-By: Claude <noreply@anthropic.com> * fix(dashboard): honest deltas + faturamento label (final review fixes) Implements final whole-branch review findings: - IMPORTANT alunos delta: cumulative total vs single-month signups nonsensical; make schema optional, omit delta (no historical snapshot). KpiCard renders no badge. - IMPORTANT faturamento mislabel: all-time _sum labeled 'Faturamento Mensal'; drop all-time aggregate query, use last(receitaPorMes) month bucket, relabel 'Faturamento Recente'. Honest period value + MoM delta. - MINOR inadimplentes self-compare (always +0%): schema optional, omit delta. - MINOR orphan V_FaturamentoMensalSchema: delete schema + 6 tests + stale aggregate mock setups (query removed). - MINOR findMany-vs-groupBy: ponytail comment with upgrade path. Gates: Vitest 1166/0, tsc clean, lint 0/0. Co-Authored-By: Claude <noreply@anthropic.com> * fix(dashboard): rename Matrículas Ativas → Novas Matrículas to match deltas.novos semantics Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): narrow DeltasSchema default to receita+novos only Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(dashboard): add honest-mock variant — optional deltas → no badge on alunos/inadimplentes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(a11y): heading hierarchy + aria-hidden KpiCard triangle EmptyState h3→h2, sr-only h2 before charts, aria-hidden on delta ▲/▼ glyph. WCAG 2.2 SC 1.3.1 heading nesting fix. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(dashboard): isolate .strict() rejection — valid payload + unknown key Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(dashboard): audit fix wave complete — CURRENT-STATE + plan Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): omit KpiCard delta badge when delta===0 — neutral not positive Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): generic error message + Sentry + Logger in error boundary Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): brl currency formatting on Faturamento chart YAxis + Tooltip Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): extract TreinosDataWrapper — Suspense now streams during fetch Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): getMatriculasPorMes use Matricula.dataInicio not Aluno.dataCadastro Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): pctDelta returns undefined when no prior period Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(dashboard): wrap treinos Suspense renders in act() for streaming boundary Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(dashboard): add onClick router navigation to Perfil + Configurações menu items Both dropdown items had no handler — dead clicks. Added useRouter + icons. Perfil → /dashboard/perfil, Configurações → /dashboard/configuracoes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(dashboard): add useRouter mock to layout test for UserMenu navigation CI failure: 'No useRouter export defined on the next/navigation mock'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Emiya Kiritsugu <emiyakiritsugu3@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3161975 commit 4e2f691

34 files changed

Lines changed: 2488 additions & 454 deletions

docs/CURRENT-STATE.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
1-
# Estado Atual (2026-07-08)
1+
# Estado Atual (2026-07-09)
2+
3+
## `feat/gerente-dashboard-refactor` — dashboard GERENTE refactor completo (10/10 tasks)
4+
5+
**Branch:** `feat/gerente-dashboard-refactor`. Spec: `docs/superpowers/specs/2026-07-09-gerente-dashboard-refactor-design.md`. Plano: `docs/superpowers/plans/...` (10 tasks TDD, SDD pipeline). Objetivo: equalar dashboard GERENTE ao padrão ALUNO — dados reais (zero fake), tokens de design, empty-states honestos, sem gamification.
6+
7+
### Tarefas (SDD: fresh subagent + task reviewer por task)
8+
9+
- **T1** (`45f193f`): schema real series — `MonthTotalSchema`/`PlanTotalSchema`/`DashboardDeltasSchema` substituem `crescimentoAnual` sintético. `.strict()` em `DashboardStatsSchema`.
10+
- **T2** (`0a3aeba`+`eb98934`): queries Prisma reais (`getMatriculasPorMes` groupBy dataCadastro, `getReceitaPorMes` groupBy dataPagamento, `getMatriculasPorPlano` count ATIVA). `pctDelta()` para KPI deltas. Re-throw em erro DB (sem try/catch swallowing).
11+
- **T3** (`7806e45`): `KpiCard` — Card glass + delta badge (▲▼ ícone+texto verde/vermelho, não só cor), `aria-label`, `data-testid="kpi-<title>"`.
12+
- **T4** (`edb6e50`): `EmptyState` — Card glass tracejado, portado do padrão `card-treino.tsx`. Props `{icon, title, description, testId?}`.
13+
- **T5** (`6d08e64`+`a5abe6e`): `DashboardChartsMulti` — 3 BarCharts recharts tokenizados (matrículas/mês, faturamento/mês, distribuição/plano). `role="img"`+`aria-label` por chart (wrapper div, não BarChart — fix jsdom ResponsiveContainer 0×0). `EmptyState` quando 3 séries vazias.
14+
- **T6** (`68c9d90`): overview page wiring — grid 4 `KpiCard` (Total Alunos, Matrículas Ativas, Inadimplentes, Faturamento Mensal) + `DashboardChartsMulti`. Mapeamento deltas: `.alunos`→Total, `.novos`→Ativas, `.inadimplentes`→Inadimplentes, `.receita`→Faturamento. Moeda BRL.
15+
- **T7** (`6a58de1`): fix double `<main>` landmark — removido `<main>` extra em `layout.tsx`, `pb-20` no inner div. `SidebarInset` (sidebar.tsx) retém `<main>`.
16+
- **T8** (`c87ef7f`+`c2830e6`): tokenize 4 sub-pages (alunos/financeiro/planos/treinos) — `bg-black``bg-background`, `#18181B``glass-card glow-cyan`, `text-zinc-400``text-muted-foreground`, `pb-20`. Suspense em treinos (inerte — prisma findMany precede boundary; `ponytail:` brief-mandated).
17+
- **T9** (`cd89df5`): `loading.tsx` (`DashboardOverviewSkeleton`) + `error.tsx` (`'use client'`, AlertTriangle, `role="alert"`, Button `reset()` "Tentar novamente").
18+
- **T10** (`15f9343`): delete legacy `dashboard-charts.tsx` (+test) — substituído por `dashboard-charts-multi.tsx`. Zero importers.
19+
20+
### Gates (4/4)
21+
22+
- **Vitest**: 1172 pass, 0 fail (subiu de 1164 — novos testes T3-T9).
23+
- **TypeScript** strict: No errors.
24+
- **ESLint**: 0 errors, 0 warnings.
25+
- **E2E**: DEFERIDO para merge-time. Requer Supabase local (54321/54322) + `.env.test` + dev server. Risco baixo: refactor toca só render/token/componente — nenhuma rota/auth/middleware/middleware-rota/API-contract alterado. `npm run e2e` validável antes do PR.
26+
27+
### Notas
28+
29+
- TS7 NO-GO (Next 15.5 build crash + typescript-eslint crash + Prisma block). Mantido TS 6.0.3. Skill `compiler-major-bump-feasibility-audit` extraída.
30+
- `financeiro/page.test.tsx` ganhou assertions `#18181B`+`text-zinc-400` post-review (spec checklist gap do implementer).
31+
- **Audit fix wave (T1-T8)**: 8 tasks from multi-dimension audit — renamed "Matrículas Ativas"→"Novas Matrículas" (match deltas.novos), narrowed DeltasSchema default (receita+novos only), honest-mock test variant (optional deltas→no badge), isolated .strict() rejection test, golden-path getDashboardStats test, heading hierarchy a11y (EmptyState h2 + sr-only h2), aria-hidden KpiCard triangle, 13-month window on getMatriculasPorMes+getReceitaPorMes. Gates: Vitest 1172/0 (+6 tests), tsc clean, lint 0/0. Plan: `docs/superpowers/plans/2026-07-09-gerente-dashboard-audit-fixes.md`.
32+
- PR #199 aberto em main.
33+
- Treinos Suspense é inerte (data fetch no page body precede boundary) — `ponytail:`: brief-mandated, mantém; mover Suspense para dentro de client component se quiser fallback real durante fetch.
34+
- Commits de fixup (`eb98934`, `a5abe6e`) podem ser squashed antes do PR se desejado.
35+
36+
---
237

338
## PR #194 `feat/aluno-ui-10-fixes` — review remediation completa (cubic + coderabbit)
439

0 commit comments

Comments
 (0)