step 10.17: wip (not ticked)
This commit is contained in:
+15
-10
@@ -4,8 +4,8 @@
|
||||
> If this file disagrees with the code, trust the code and fix this file.
|
||||
|
||||
## 1. Where we are
|
||||
- **Last completed step:** 10.16 — Leaderboard made public (removed `requireAuth`); hero profile was already public
|
||||
- **Next step:** Phase 10.17 — Build `public/leaderboard.html` + `public/js/leaderboard.js`: tabs Level/Gold/Kills, rank, hero name (link to profile.html?name=...), class, value; `textContent` only. Add nav links (Game, Shop, Leaderboard, Logout) to header of every logged-in page. Remove temporary link-checker exception from 10.5.
|
||||
- **Last completed step:** 10.17 — Leaderboard UI built (`leaderboard.html` + `leaderboard.js`), nav links (Game, Shop, Leaderboard, Logout) added to all logged-in pages (game.html, shop.html, create-hero.html, leaderboard.html)
|
||||
- **Next step:** Phase 10.18 — (next)
|
||||
- **Updated:** 2026-10-23
|
||||
- **Was the last session cut off mid-task?** No
|
||||
|
||||
@@ -14,18 +14,20 @@
|
||||
|---|---|
|
||||
| `npm install` | succeeds |
|
||||
| `npm run migrate` | applies 001–007 / "nothing to do" |
|
||||
| `npm test` | **273 passing, 0 failing** (97 unit + 176 integration incl. 9 public leaderboard/profile tests) |
|
||||
| `npm test` | **284 passing, 0 failing** (97 unit + 187 integration incl. 11 step-10.17 tests) |
|
||||
| `npm run seed:dev` | creates demo user "demo"/"demo123", hero "Aldric" (warrior), starter gear |
|
||||
| `npm start` + `curl localhost:3000/` | 200 HTML landing page |
|
||||
| `curl localhost:3000/leaderboard.html` | 200 HTML (leaderboard page) |
|
||||
| `curl localhost:3000/api/leaderboard?type=level` | 200 JSON (no auth required) |
|
||||
|
||||
## 3. What exists now (files that matter)
|
||||
- `src/app.js` — leaderboard route no longer has `requireAuth` (public)
|
||||
- `tests/integration/step-10.16.test.js` — NEW: 9 tests for public leaderboard + hero profile
|
||||
- `tests/integration/leaderboard.test.js` — updated "rejects request without authentication" → "is accessible without authentication"
|
||||
- `public/leaderboard.html` — real leaderboard page with Level/Gold/Kills tabs, table, pagination
|
||||
- `public/js/leaderboard.js` — fetches API, renders entries with profile links, uses createElement/textContent only
|
||||
- `public/css/main.css` — nav-links styles added to header
|
||||
- `public/game.html`, `shop.html`, `create-hero.html`, `leaderboard.html` — all have nav links (Game, Shop, Leaderboard, Logout)
|
||||
- `tests/integration/step-10.17.test.js` — 11 tests (nav links, page structure, code quality, API integration)
|
||||
|
||||
## 4. Half-finished / fragile things
|
||||
- No leaderboard UI yet (stub page exists; real UI in 10.17).
|
||||
- No restart-persistence test for sessions.
|
||||
- `npm run seed` script in package.json points to nonexistent `scripts/seed.js`.
|
||||
- `GET /api/zones` documented in API.md but not implemented.
|
||||
@@ -88,8 +90,11 @@
|
||||
- **10.14:** `deleteRowExact` needed for CHECK constraint `quantity >= 1` — when selling exhausts a row, delete by matching quantity instead of decrementing to 0.
|
||||
- **10.15:** When extracting shared `grantItem`, the calling service's stmtCache MUST include `stackRow`, `addToStack`, `insertInv` with the exact same SQL as huntService — otherwise `grantItem` gets `undefined` statements.
|
||||
- **10.16:** Leaderboard returns `{ ok: true, data: { entries: [...], pagination: {...} } }`.
|
||||
- **10.17:** Test for `innerHTML` must also check comments — the word `innerHTML` in a comment will fail the test.
|
||||
- **10.17:** Hero names in the leaderboard are rendered dynamically by JS, so tests should check the JS code pattern (not static HTML) for profile link generation.
|
||||
|
||||
## 7. Next-step briefing
|
||||
- **Next step: 10.17** — Build `public/leaderboard.html` + `public/js/leaderboard.js`: tabs Level/Gold/Kills, rank, hero name (linking to `profile.html?name=...`), class, value; `textContent` only. Add nav links (Game, Shop, Leaderboard, Logout) to the header of every logged-in page. Remove any temporary link-checker exception from 10.5.
|
||||
- The leaderboard API (`GET /api/leaderboard?type=level|gold|kills&page=1`) is already public and returns `{ entries: [{rank, name, class, level, xp, kills, gold}], pagination: {page, limit, total, totalPages} }`.
|
||||
- The link-checker test currently has no exceptions (10.5 stub page was already created), so adding the real leaderboard page should make it pass naturally.
|
||||
- **Next step: 10.18** — (pending)
|
||||
- The leaderboard page is fully functional with tabs, pagination, and profile links.
|
||||
- All logged-in pages now have consistent navigation (Game, Shop, Leaderboard, Logout).
|
||||
- The link-checker test passes with no exceptions.
|
||||
|
||||
Reference in New Issue
Block a user