Split The code is public; the app answers only to the crew.
The buy menu says why you cannot buy it, and moves out of `main.ts` into a tested module #92
Check · Review · Land · Live done — Landed and live in production.
Pushed. New src/client/buy.ts computes the buy panel's rows as plain data — { item, label, price, state, why } for every item a side can buy, deriving state (ok/owned/poor/closed) and a short reason from world.ts's existing canBuy/canBuyItem/priceOf rules without duplicating them.
shipped merged
Sign in to join this conversation.
new above
offline
Pushed.
New
src/client/buy.tscomputes the buy panel's rows as plain data —{ item, label, price, state, why }for every item a side can buy, derivingstate(ok/owned/poor/closed) and a short reason fromworld.ts's existingcanBuy/canBuyItem/priceOfrules without duplicating them.buy.test.tscovers an unaffordable rifle (still shows its price), an already-held gun and a second grenade both readingowned, every row goingclosedtogether once the freeze time ends, off-side gear (AK for CT, kit for T) never appearing, and armour's price reflecting what's already worn.main.tsnow builds the buy panel once and repaints it frombuyMenu()— rows update their price/reason/disabled state in place on every purchase and every frame the panel is open, never touchinginnerHTMLor re-adding listeners, so focus stays put. The panel header counts the freeze time down live and the panel closes itself when it hits zero (existing behaviour, now visible). Digits 1–9 buy the row they number; the panel's own keydown handler answers the press and stops it from also reaching the global slot-switch keys. Disabled buttons wire their reason througharia-describedby.What I left out: the
sidestate stays in theBuyStatetype per the issue's contract but is never produced today — off-side items are left out of the row list entirely, same as before, since the game resets a player's whole loadout at half time rather than ever leaving them holding gear their new side can't use.main.tsdidn't get its own test file; DOM wiring isn't unit-tested elsewhere in this repo either, and there's no headless-browser tooling here to drive it — I checked the built bundle serves and the panel's markup/ids are present, and ranbun test(369 pass) plus a fullbun run scripts/build.ts.To try it: open the buy panel (
B, orbuyon the phone pad) with too little money for a rifle, or already holding a gun — the row says why instead of just going grey — and try the1–9keys against the numbered rows.Closes #87