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

forked from trevato/cs

A first visit is one click from a round: Play first, and the seven controls fold behind a summary that says what they are #410

Merged opened this

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

Merged

The menu now opens on four things: the name, one sentence saying what Play gives you, the plan of the map, and Play. Every other control is still on the page, folded into one `<details id="options">` under Play. Its summary line names what is inside: length, side, map, map name, sensitivity, motion, match id, today's match and rooms. The controls inside keep their markup; they only moved.

shipped production is serving it deploy ae07c2d

opened this

The menu now opens on four things: the name, one sentence saying what Play gives you, the plan of the map, and Play. Every other control is still on the page, folded into one <details id="options"> under Play. Its summary line names what is inside: length, side, map, map name, sensitivity, motion, match id, today's match and rooms. The controls inside keep their markup; they only moved.

  • The sentence comes from offerSaid in src/client/offer.ts, for example "A short match — first to 5 — as the Counter-Terrorists on de_forge." The server renders it from the values it renders the controls with. src/client/main.ts writes it again whenever Length, Side, Map, Map name or Match id changes, after "Pick today's match", and after the stored side and length are restored at boot. A returning player therefore reads their own settings, not the defaults. The number comes from the match rules, not typed in.
  • The fold is plain <details>/<summary>: it works without JavaScript, the keyboard reaches it, and the summary is 44px tall. It is rendered open whenever the link asked for anything (?match=, ?map=, including generated, ?room=, or a bad value), so a pasted link shows what it filled in. It stays open across matches in the same visit, because the menu is hidden and shown again rather than re-rendered.
  • The map plan (#218) and its copy link stay beside Play, outside the fold.
  • Page size: src/pages/shell.ts styleFor now strips CSS comments before the style block is sent and hashed for the CSP. The source keeps them. That takes / from 9,562 to about 8,620 bytes gzipped, fold included. A test holds it under the old figure.
  • No layout shift: the sentence has a fixed minimum height, so rewriting it at boot does not move anything.

Not done: opening the fold is not remembered across page loads. Opening it from a script after the first paint would shift the layout, which the issue rules out. #73 (stored settings) and #245 (crosshair) should add their controls inside this fold rather than beside Play, and the README now says so.

Tests: bun run test (typecheck plus 1,700 tests) passes. The new tests cover:

  • The sentence for two different sets of values, both server-rendered and after controls change in the client.
  • Stored settings showing up in the sentence.
  • The fold open for each kind of link and closed for a bare /.
  • No tabindex in the menu, and the only hidden controls are the room link and the support copy button, both hidden before this change.
  • The shipped style block has no comments.

To try it on the preview: open / and check the sentence, then change Side and Length inside the fold and watch it change. Open /?map=gen_14u5j6g and the fold is already open with that map named.

🤖 Generated with Claude Code

Closes #255

commented

This pull makes Play the first thing a new visitor sees on the menu. A sentence beside it says what pressing it will give: length, side, map, and whether it replays a match. The other controls are folded into one <details id="options">. The folded controls stay reachable from the shared link, and the server renders the same sentence as the page (src/client/offer.ts).

Since the last push, main has been merged in. There were two conflicts:

  • src/client/main.ts: main moved the map-choosing logic into src/client/chooser.ts. nameNextMap now uses that module's nameMap and then updates the sentence beside Play (nextName and sayOffer). The comment from the old version is gone, and matchFrom is now imported from ../matchid.ts.
  • src/client/stage.test-helper.ts: PAGE_IDS now has the element ids from both sides — willgive and options from here, and main's sound, psens, ptouchsens, pmotion and psound.

Bundle size limit raised: after the merge, the app bundle was 3 gzipped bytes over its size limit, and two tests in scripts/build.test.ts failed. The tests were right: each side fit on its own, but the two together don't. Following the rule written in src/games.ts, the limit goes from 140,500 raw / 54,500 gzipped to 147,000 / 57,000. That is the measured 139,969 / 54,503 plus about five per cent, and the reason is noted next to the number. scripts/build.test.ts has the same new numbers. I raised the limit rather than cutting code, as earlier merges have done.

bun run test passes: 1,745 tests, 0 failures. On a local start, / served the Play sentence and the options fold next to main's sound and pause-menu settings.

To try it, open the preview (https://cs-engine--410--forge-trevato-apps.open-platform.sh) in a fresh browser. Play and its sentence come first. Open "options" to change length, side or map and the sentence updates; pause during a round to see main's settings, which still work.

🤖 Generated with Claude Code

commented

This pull makes Play the first thing a new visitor sees on the menu. A sentence beside it says what pressing it will give: length, side, map, and whether it replays a match. The other controls are folded into one <details id="options">. The folded controls stay reachable from the shared link, and the server renders the same sentence as the page (src/client/offer.ts). main.ts picks the map through main's src/client/chooser.ts and updates the sentence whenever the map, length, side or match id changes.

The latest merge of main had three conflicts:

  • src/client/stage.test-helper.ts: PAGE_IDS has this branch's willgive and options plus main's new buycursor, the buy-panel pointer.
  • src/games.ts and scripts/build.test.ts: this branch had raised the app bundle's size limit after an earlier merge. main's #355 then raised it further, to 147,600 raw / 57,500 gzipped. main's number and note are kept and this branch's are dropped, since its raise never landed. The merged bundle is 141,059 raw and 54,966 gzipped, under the limit.

bun run test passes: 1,750 tests, 0 failures, and the typecheck is clean. On a local start, / served willgive, options and buycursor together.

To try it, open the preview (https://cs-engine--410--forge-trevato-apps.open-platform.sh) in a fresh browser. Play and its sentence come first. Open "options" to change length, side or map and the sentence updates. The buy panel's pointer and the pause-menu settings from main still work in a round.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs