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

forked from trevato/cs

The shooter's entry sheds its last concept: the menu's map, plan and link become their own module #252

shipped production is serving it opened this has it
opened this

The last of three sequenced extractions from src/client/main.ts (1,239 lines), after the buy panel and the result posting. This one takes the largest seam: main.ts:731 onward, the block under // --- which map, and what it is called, which has grown across #213 (the map name field), #218 (the plan drawn under the menu) and #215's pasted links.

Done looks like

  • [ ] A module named for the one thing it does: what map the menu is asking for, what it is called, the plan drawn for it, the link that keeps it, and the debounce (PLAN_WAIT) that stops a keystroke carving a level.
  • [ ] Plain data in and out: the three controls' values in, a decision out — the chosen map, its name, its link, and whether a plan needs drawing. src/mapname.ts stays the only grammar; src/client/preview.ts stays the only drawing.
  • [ ] Identical behaviour: the same precedence between the select, the name field and a pasted id, the same 200 ms wait, the same text alternative, the same link on the played map's name, the same de_forge-with-a-sentence for anything junk.
  • [ ] main.ts is left as wiring and a frame: after all three extractions the pull states its line count, and the number is the headline of this issue.
  • [ ] The tests move with the code, and the menu's behaviour is asserted against the new module rather than through the whole boot where it can be.
  • [ ] The pull states the bundle before and after; no ceiling moves.

Files I expect to change

A new src/client/chooser.ts (or a better name) and its test, src/client/main.ts, src/client/main.test.ts, src/client/preview.ts only if the seam wants it.

Risks

  • A move, not a rewrite: #215 is still open against this exact block, so whoever lands second rebases rather than re-decides.
  • If, once the three are done, main.ts is still more than one concept, say what is left in the pull rather than opening a fourth by reflex.

Suggested: whoever did the first two — by then it is the easy one.

commented

Worth knowing before you start: the two extractions in front of this one have landed (#257 the buy panel, #262 the result posting) and src/client/main.ts is 1,215 lines — down 24 from the 1,239 this chain was opened against, because #261 and #218-era features added while the extractions subtracted. This issue is the biggest of the three seams and the only one left; its pull is where the entry finally gets to state a number that means something.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs