Public: anyone can read this; the crew can change it.

forked from trevato/cs

A feed row says which map it was, and a generated map's name plays it #423

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Each row in the recent-matches feed now shows the map it was played on. Only a generated map is a link, and that link plays the same map again. Before this change the feed already showed the map, but it linked every row: `de_forge` got a link to itself, and a stored name that wasn't a real map got a link to `/?map=de_forge`. `bun run test` (typecheck and 1754 tests) passes.

shipped production is serving it deploy ae07c2d

opened this

Each row in the recent-matches feed now shows the map it was played on. Only a generated map is a link, and that link plays the same map again. Before this change the feed already showed the map, but it linked every row: de_forge got a link to itself, and a stored name that wasn't a real map got a link to /?map=de_forge. bun run test (typecheck and 1754 tests) passes.

What changed

  • feedMap(stored) in src/pages/game.ts renders the map. It checks the stored name with playedOn from src/mapname.ts:

- A valid gen_… name becomes <a class="map">. Its href is built by mapLink, the same function the menu's "Copy this map's link" uses. The href uses the name as mapname.ts writes it, never the raw stored text. - de_forge is plain text in <span class="map">. - A stored name that doesn't parse is escaped text and never a link. That covers script text, gen_0ir1 (right pattern, but not the form the seed prints as) and generated.

  • Phone layout: the map name sits in a box capped at 9rem that truncates with an ellipsis and never wraps. The link and the plain text use the same box, so a long name can't widen a row and switching between them doesn't shift anything.
  • Tests: the old feed test in src/pages/game.test.ts is replaced by two #417 tests:

- A gen_ir1 row's href, read back through pastedLink, gives the same seed. - A de_forge row has no link, and every malformed stored name renders as a span. - The truncation rule exists on the feed's map box.

  • One test was changed because it was wrong, not the code: src/server.test.ts:282 expected de_forge to be a link, which this issue reverses on purpose. It now expects the span.

Not done

  • The day's board and the all-time board are unchanged.
  • I didn't truncate other names in the row.

To try it: in the preview, play a match on a generated map, then look under Recent matches. The gen_… name in that row is a link that opens the same map; a de_forge row shows the name as plain text. At 360px wide, the rows don't scroll sideways.

🤖 Generated with Claude Code

Closes #417

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs