Move PB Kepuh's score board from Svelte 4 to Svelte 5 runes, both versions running side by side. 14 levels, played right in the browser with nothing to install.
What the levels ask
Mbak Laila’s Papan Kok has run every Friday night since 2023, on the old tablet hanging on the wall of the PB Kepuh hall. Tonight the new TV beside it is on too, and the first piece moves to Svelte 5: the counter of shuttles used. Fill the two holes in the new board’s App.svelte. Pak Tono will tap +1 kok three times, and both boards must reach Terpakai: 3 kok. The new board must really use runes, with no warning from the compiler.
Before the matches, players sign up on the board. Tonight Pak Tono and then Bu Sari arrive. Mbak Laila wants to tidy the old code first, because one line on the old board looks useless to her, and then move the list to the new board. Fill the holes on both boards so that after each sign-up they write the same count and the same list, up to 3 pemain malam ini.
The table works out a team’s points from wins and draws (a win 3, a draw 1). On the old board the points are written with $:. Bang Jaya will record a win, a draw, then another win. Fill the hole on the new board so the points always follow, up to 4 menang, 2 seri: 14 poin.
Last year Mbak Laila moved the points formula into a function, hitungPoin(). Since then Pak Tono has said the points on the old tablet "only come right after the page reloads". Tonight the old and the new board stand side by side. Fill the holes on both boards so the points on each go up whenever the team wins or draws, up to 6 menang, 3 seri: 21 poin.
Every time the score changes, Papan Kok sends it to PB Kepuh’s WhatsApp group (the console writes kirim skor). The group does not want messages that carry no new score. Bagas will tap a home point, a change of serve, a visitors’ point, then another home point. Fill the hole on the new board so the score is sent exactly as often as on the old board: when it opens and at every point, never when the serve changes.
The board keeps the history of the score through a game. On the old board, one $: line adds the score to the history every time the score changes. Dina will win three points. Fill the holes on the new board so its history matches the old board’s, up to Riwayat: 0, 1, 2, 3.
Each player has a card that writes how many shuttles they have taken from the tube. Bagas has taken none yet, Dina two. Tonight Pemain.svelte moves. Fill the holes on the new board: how the card takes its data in, and how App sends one player to its card. Bagas will take two shuttles, and both boards must write Bagas: 2 kok and Dina: 2 kok.
Before a match, one of the umpires is tapped to take charge, and the board counts how many times the umpire changed. On the old board, Calon.svelte sends a pilih event with createEventDispatcher. On the new board, Calon already takes onpilih from its props. Fill the holes in Calon and in App so Bu Sari, Pak Tono, then Bu Sari again are picked on both boards, up to Wasit: Bu Sari (3x ganti).
The +1 Rumah button is a TombolPoin component that passes its click on to the parent with a bare on:click. The +1 Tamu and Nol buttons are plain buttons. Bang Jaya will tap Rumah, Tamu, Rumah, then Nol. Fill the three holes on the new board so both boards match until the score is back at 0 - 0, with no error and no compiler warning.
The match card has a title and content its parent decides. On the old board, the title goes to a slot named judul and the content to the default slot. On the new board, KartuLaga already takes judul and children from its props. Fill the holes in the card and in App so the title Final Ganda shows above the rising score, on both boards.
The shuttle kitty is kept in a kok store in kas.js, read by the kitty board and added to by the buy buttons. Tonight Kas.svelte and Beli.svelte move to runes, while kas.js stays as it is. Pak Tono will buy one shuttle, a tube of twelve, then one more. Fill the holes on the new board so both write Kok dibeli: 14 and Kas keluar: Rp 56000.
The other kitty is kept in three stores: the shuttle count, the price per shuttle, and the bill derived from both. On the new board, the three are replaced by one shared state object in a module, read by App and Tagihan. Bu Sari will buy two shuttles, then the warung puts the price up. Fill in the module’s name, its contents, and the bill in Tagihan.svelte so both boards write 2 kok, Rp 10000.