4.3 KiB
4.3 KiB
id, title, status, type, team, supporting_teams, roadmap_item, priority
| id | title | status | type | team | supporting_teams | roadmap_item | priority |
|---|---|---|---|---|---|---|---|
| TASK-165 | Add stats frontend page | done | frontend | Frontend Senior | foundation | medium |
TASK-165 - Add stats frontend page
Goal
Implement the first frontend version of the new Stats section using existing backend endpoints.
Context
TASK-163 added backend support for player search and personal stats payloads under /api/stats.
GET /api/stats/players/search?q=<query>GET /api/stats/players/{player_id}
This task only covers frontend consumption and does not modify backend code.
Steps
- Read all files listed in
Files to Read Firstbefore creating files. - Create
frontend/stats.htmlwith the V1 section layout. - Create
frontend/assets/js/stats.jswith vanilla JS state and API handlers:- search call
- result rendering
- player selection
- profile request
- Add Stats navigation entry in the shared shell used by landing/history without breaking existing sections.
- Wire the following state blocks:
- loading
- error
- sin resultados
- jugador sin estadisticas
- backend no disponible
- Add reserved annual ranking top 20 block (UI placeholder only, no backend call).
- Update CSS only if required to support the new page.
- Validate manually (and with integration tests when available) and record results in task outcome.
Files to Read First
AGENTS.mdai/repo-context.mdai/architecture-index.mddocs/stats-section-functional-plan.mddocs/stats-frontend-integration-plan.mdfrontend/index.htmlfrontend/historico.htmlfrontend/assets/css/styles.cssfrontend/assets/js/main.jsbackend/app/routes.pybackend/app/payloads.py
Expected Files to Modify
frontend/stats.htmlfrontend/assets/js/stats.jsfrontend/index.htmlfrontend/historico.htmlfrontend/assets/css/styles.css(only if necessary)
Constraints
- No backend changes.
- No migrations.
- No annual ranking real endpoint consumption in V1.
- No changes to historical workers.
- No Elo/MMR reactivation.
- Do not touch
frontend/assets/js/partida-actual.js. - Do not touch
frontend/assets/img/clans/bxb.png. - Do not reintroduce Comunidad Hispana #03.
- Keep HTML/CSS/JS vanilla (no frameworks).
- Preserve existing HLL Vietnam identity (military, Vietnam, tactical, sober).
- Keep scope small and reviewable.
Validation
Before task completion:
- Validate
frontend/stats.htmlloads and executes without visible JS runtime errors. - Validate search flow against local backend (if running):
- query -> backend search
- select player -> personal profile
- Validate empty/error/unsupported states, including backend unreachable.
- Validate annual placeholder is rendered without backend call.
- Run
scripts/run-integration-tests.ps1when applicable. - Run
git diff --name-onlyand confirm only expected files changed for this task. - Confirm
frontend/assets/js/partida-actual.jsandfrontend/assets/img/clans/bxb.pngwere not touched.
Outcome
- Archivos modificados:
frontend/stats.htmlfrontend/assets/js/stats.jsfrontend/index.htmlfrontend/historico.htmlfrontend/assets/css/styles.css
- Endpoints consumidos:
GET /api/stats/players/search?q=<query>GET /api/stats/players/{player_id}
- Validaciones realizadas:
- Validación de carga estática:
- se sirvió
frontend/stats.htmldesdepython -m http.server(status 200), - se sirvió
frontend/assets/js/stats.js(status 200).
- se sirvió
- Validación del flujo con backend local:
GET /healthenhttp://127.0.0.1:8000no respondió (backend sin servicio en este momento),- se dejó implementada la ruta de error
Backend no disponible, - no fue posible validar query corta, query normal y no-resultados contra backend en esta pasada.
- Validación de tests:
scripts/run-integration-tests.ps1ejecutado y finalizó con éxito.
- Validación de carga estática:
- Limitaciones conocidas:
- backend local no estaba levantado al momento de validación de integración,
- no se validó ranking anual real ni endpoint de ese dominio por restricción de alcance V1.
- Siguiente task recomendada:
TASK-166diseño/implementación BDD de ranking anual top 20 (snapshot).
Change Budget
- Prefer fewer than 5 modified files (allowing one extra if CSS adjustments are needed).
- Keep changes concise and aligned with V1 scope.