mirror of
https://github.com/LucasKalil-Programador/world-2026-hub.git
synced 2026-07-04 17:41:28 -03:00
docs: log stats screen Stage A (feature/stats-final-screen)
Append the Stage A entry to project-memory.md, refresh project-map.md (app.js/stats.js descriptions + optional data layers + branch note), and add the A-J stage tracker to TODO.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
387fab3c8b
commit
f3751f0042
3 changed files with 53 additions and 6 deletions
|
|
@ -72,6 +72,27 @@ Use checkboxes to track progress. Items marked **🔴 BLOCKER** prevent release;
|
|||
|
||||
---
|
||||
|
||||
## 7. Stats final screen — `feature/stats-final-screen` (post-Cup release)
|
||||
|
||||
Full build of `.agents/stats-screen-plan.md` on a feature branch, merged to `master` at the end of
|
||||
the Cup. One approval gate before each stage. A–F are buildable from today's data; G/H/I are
|
||||
data-blocked (graceful-degradation shell lets the UI land dark until JSON arrives).
|
||||
|
||||
### 🟢 OPTIONAL (release feature)
|
||||
- [x] ~~Stage 0 — branch `feature/stats-final-screen` off `master`~~
|
||||
- [x] ~~Stage A — degradation engine + fault-tolerant `loadData` + sticky scrollspy sub-nav + media fallback~~ (2026-06-16)
|
||||
- [ ] Stage B — verdict hero (gated on FINAL finished; aggregate-hero fallback) + goals-by-round chart
|
||||
- [ ] Stage C — final ranking 1–48 (phase-reached chain), favorite-row highlight, team record cards
|
||||
- [ ] Stage D — auto record-cards + "format-48 debuts" band
|
||||
- [ ] Stage E — 104-match results archive (accordion by phase, row → modal)
|
||||
- [ ] Stage F — team comparator (diverging bars)
|
||||
- [ ] Stage G — Layer 2 cheap data (attendance, `cards`→{y,r} migration, decidedIn, coords) — **SCHEDULE LATE**
|
||||
- [ ] Stage H — Layer 3 players (`players.json` + `player-events.json` + `awards.json`)
|
||||
- [ ] Stage I — Layer 4 editorial (`curiosities.json` + `all-time-baselines.json`)
|
||||
- [ ] Stage J — polish (responsive/a11y audit, perf, Lighthouse, `DATA_VERSION` bump, README/i18n)
|
||||
|
||||
---
|
||||
|
||||
## Quick final checklist
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
Navigation map of the codebase. Use this to find which file owns a concern before reading code.
|
||||
|
||||
> **Status 2026-06-12 (all 12 steps + real-data migration done):** everything works with **real World Cup 2026 data** — all views, bracket interactions, simulation, responsive/a11y pass, favorites, time toggle, challenge, share link, `.ics` export. Remaining: keep `results.json` current, fill `thirdPlaceAssignment` after the group stage (~Jun 27), Lighthouse run + GitHub Pages deploy. Spec source of truth: `world-cup-2026-hub-spec-en.md` + `complement-spec-worldcup2026-en.md` (complement **wins on conflict**).
|
||||
>
|
||||
> **Branch note (2026-06-16):** the full post-Cup Stats screen (`.agents/stats-screen-plan.md`, stages A–J) is being built on **`feature/stats-final-screen`** (merges to `master` at the end of the Cup). **Stage A done** on that branch (degradation engine + fault-tolerant `loadData` + sticky scrollspy sub-nav + flag monogram fallback). `master` keeps the partial Stats tab + daily refreshes. Descriptions below reflect the branch.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -51,7 +53,10 @@ worldcup2026/
|
|||
│ │ │ live data refresh (startResultsPolling: 90s poll of
|
||||
│ │ │ results.json, no-store + ?t, content signature, pauses
|
||||
│ │ │ when tab hidden, stops at FINAL; on change also refetches
|
||||
│ │ │ bracket-config.json; fires `datachange`)
|
||||
│ │ │ bracket-config.json; fires `datachange`);
|
||||
│ │ │ loadOptional() = fault-tolerant fetch of the stats screen's
|
||||
│ │ │ optional data layers (absent → silent empty default);
|
||||
│ │ │ trackHeaderHeight() keeps the --header-h CSS var live
|
||||
│ │ ├── schedule.js Match list, filters (incl. occurrence toggle
|
||||
│ │ │ Played/Upcoming via hybrid matchState), search,
|
||||
│ │ │ sort, "My Matches"; 60s clock-tick re-render
|
||||
|
|
@ -63,8 +68,12 @@ worldcup2026/
|
|||
│ │ ├── storage.js localStorage wrapper — wc2026_* keys, auto-JSON
|
||||
│ │ ├── i18n.js EN/PT-BR dicts + t(key), lang toggle
|
||||
│ │ ├── stats.js ★ Stats tab: tournament-to-date aggregates (finished
|
||||
│ │ │ matches only), hero pulse + overview + goals-by-stage.
|
||||
│ │ │ PARTIAL (during-cup) — grows into the post-cup plan.
|
||||
│ │ │ matches only), hero pulse + overview + goals-by-stage +
|
||||
│ │ │ 48-team sortable table. SECTIONS registry (graceful-
|
||||
│ │ │ degradation gate: section + chip render only if available,
|
||||
│ │ │ else removed from DOM) + sticky scrollspy sub-nav (anchor
|
||||
│ │ │ chips, hash-safe) + flagImg monogram fallback. Grows into
|
||||
│ │ │ the post-cup plan (.agents/stats-screen-plan.md, A–J).
|
||||
│ │ └── calendar.js .ics export (RFC 5545, CRLF, Blob download)
|
||||
│ ├── images/ Team flag SVGs, stadium placeholders
|
||||
│ └── icons/ PWA app icons (from the header trophy logo): icon.svg
|
||||
|
|
@ -80,9 +89,13 @@ worldcup2026/
|
|||
│ ├── results.json { matchId, homeScore, awayScore, penalties?, status } —
|
||||
│ │ update as the tournament progresses
|
||||
│ ├── stadiums.json 16 real venues: { id, name, city, capacity, image, timezone }
|
||||
│ └── bracket-config.json ★ official R32 structure + thirdPlaceAssignment (all null) —
|
||||
│ the ONLY file to edit once real 3rd places are known
|
||||
│ (slot → allowed-groups table in project-memory.md)
|
||||
│ ├── bracket-config.json ★ official R32 structure + thirdPlaceAssignment (all null) —
|
||||
│ │ the ONLY file to edit once real 3rd places are known
|
||||
│ │ (slot → allowed-groups table in project-memory.md)
|
||||
│ └── (optional, NOT yet created) stats-screen data layers loaded fault-tolerantly by
|
||||
│ loadOptional(): players.json, player-events.json,
|
||||
│ awards.json, keeper-stats.json, curiosities.json,
|
||||
│ all-time-baselines.json — absent = silent empty default
|
||||
│
|
||||
├── README.md Setup, GitHub Pages deploy, JSON maintenance guide
|
||||
├── how-update.md Real-data migration runbook (mock → real — DONE 2026-06-12)
|
||||
|
|
|
|||
|
|
@ -240,6 +240,19 @@ Static web app showing the FIFA World Cup 2026 (Mexico/USA/Canada, 48 teams) —
|
|||
- **Deploy:** os arquivos novos (manifest.json, favicon.ico, assets/icons/) **não** estão no `exclude` do `deploy.yml` → sobem normalmente. HTTPS da Hostinger já satisfaz o requisito de PWA.
|
||||
- **Verificado (preview localhost:8126, contexto seguro):** manifest 200 e parseado (name/short/start `.`/scope `./`/display standalone/theme `#081421`); todos os ícones 200 `image/png`; `favicon.ico` 200; `<meta theme-color>` + apple tags presentes; **console limpo**; app intacto (hero FRA×SEN, 4 cards do dashboard, 16 encerradas/88 próximas — sem regressão visual). **Não testável pelo preview:** o prompt de instalação real / "Add to Home Screen" + ícone no SO — confirmar no Chrome/Edge devtools (aba Application) ou num celular após o deploy.
|
||||
|
||||
### Stats final screen — branch + Stage A (2026-06-16)
|
||||
- **New feature branch `feature/stats-final-screen`** (off `master`) to build the full post-Cup stats screen from `.agents/stats-screen-plan.md` (stages A–J). `master` stays live with the partial Stats tab + daily refreshes; merge `master`→branch periodically; the branch merges back to `master` at the **end of the Cup** (= release). Pure-UI stages **A–F first**; schema-changing data stages (esp. **G**, which migrates `results.json` `cards`→`{y,r}`) deferred to late to avoid conflicting with master's daily `results.json` edits. **Approval gate before each stage.**
|
||||
- **Stage A — degradation engine + scaffolding (DONE, branch only):**
|
||||
- **Fault-tolerant `loadData()` (`app.js`):** the 6 core files still **throw** on failure (fatal → `showError`); 6 NEW optional layers (`players`, `player-events`, `awards`, `keeper-stats`, `curiosities`, `all-time-baselines`) load via `loadOptional(name, fallback)` → an **absent/404 file returns the empty default SILENTLY** (graceful degradation §0.2; absence is the normal "layer not arrived yet" state and keeps the console clean for verification), and it **warns only on a present-but-malformed file**. Exposed on `data` as `players/playerEvents/awards/keeperStats/curiosities/allTimeBaselines`. Core + optional fetch concurrently (two `Promise.all`, core awaited first).
|
||||
- **`DATA_VERSION` deliberately NOT bumped in Stage A** — no deployed *data* changed (the optional files don't exist yet), and bumping it on the branch would conflict with master's daily bump on every merge. Bump only when real data files land (Stage G/H). (Supersedes the plan's literal "bump when wiring loadData".)
|
||||
- **Section-gating contract — `SECTIONS` registry in `stats.js`:** each section `{ id, navKey, available(model), body(model) }` renders — and shows its sub-nav chip — **only when `available` holds**; otherwise it is **omitted from the DOM entirely** (no placeholder, no `—`, no "coming soon"), and the nav never points at emptiness (§0.1). Overview/Teams are `available:()=>true`; players/records/comparator/archive are `available:()=>false` (chips absent until later stages flip them + supply `body`).
|
||||
- **Sticky scrollspy sub-nav:** `render()` now emits hero + `<nav.stats-subnav>` (anchor chips) + one `<section.stats-section>` per available section + footer. Chips are `<a href="#stats-{id}">` but their click is **`preventDefault` + `scrollIntoView`** — they **NEVER set `location.hash`** (the tab router listens on `hashchange`; a real `#stats-teams` fragment would route to an unknown tab → bounce to Home — the key gotcha here). Scrollspy is **position-based** (rAF-throttled `scroll` listener reading `getBoundingClientRect`), **not** an IntersectionObserver band: the band left a short final section unlit at the page bottom, so the position approach + an explicit "at page bottom → last section" rule is used (robust on short pages). `setActiveChip` keeps the active chip visible via the nav's own `scrollLeft` (no page jump).
|
||||
- **`--header-h` CSS var** kept live by `trackHeaderHeight()` (`app.js`, `ResizeObserver` on the variable-height sticky header — one row ≥1100px, two bands below). The sub-nav sticks at `top: var(--header-h)` and sections use `scroll-margin-top: calc(var(--header-h) + 3.75rem)`, correct at every breakpoint (verified 137px wide / 98px at 375px).
|
||||
- **Media fallback (§0.3):** `flagImg(team,w,h)` emits the flag `<img>` with `data-monogram="<id>"`; a one-time capture-phase `error` listener (`installImageFallback`) replaces a broken flag with a `<span.flag-fallback>` of the 3-letter code — never a broken-image icon. Existing stats flag usages (leaders, team table) converted to `flagImg`.
|
||||
- **New i18n keys** (EN+PT): `stats.sectionsNav` + `stats.navOverview/navTeams/navPlayers/navRecords/navComparator/navArchive`. **New CSS** in `stats.css`: `.stats-subnav`/`.stats-subnav-chip`, `.stats-section` (scroll-margin + inter-section spacing + first-heading margin reset), `.flag-fallback`. **No `index.html` change** — the sub-nav is JS-rendered into the existing `#stats-root`.
|
||||
- **Verified (preview 8126, branch):** console clean (no errors, no 404 warnings); 6 optional layers = empty defaults, core 48/104/104; sub-nav sticky at `--header-h`, only Overview+Teams chips; scrollspy top→Overview / bottom→Teams; chip click leaves hash `#stats`; EN↔PT relabels chips + sections/table survive; flag fallback → "XYZ" span at 22×15; mobile 375px (2-band header, 2×2 tiles, nav follows 98px header); Home hero+dashboard regression clean.
|
||||
- **Next:** Stage B (verdict hero gated on FINAL finished, falling back to the current aggregate hero; + goals-by-round chart) — awaiting approval. Will consume `getBracketTree().champion` + `resolveBracketTeams('FINAL'|'THIRD-PLACE')` from `bracket.js`.
|
||||
|
||||
### How to update real-world data (scores, schedule)
|
||||
Follow `how-refresh-data.md` (project root). In short:
|
||||
1. Edit `data/results.json` (scores/status) or `data/matches.json` (schedule, rare).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue