From 6bc74ab3e01927735468c7b8f34754235919699d Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Fri, 20 Feb 2026 18:25:44 +0100 Subject: [PATCH] fix(striscia): mostra lo zero iniziale solo per la squadra che serve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - All'inizio del set lo 0 compare solo nella riga della squadra che batte; la squadra non servente mostra uno spazio per mantenere l'allineamento dei nomi - cambiaPalla aggiorna la striscia dopo il flip del servizio (a 0-0) - resetta inizializza la striscia in base al servente corrente anziché mostrare 0 per entrambe - Corretto il guard dell'undo: usa storicoServizio.length > 0 invece di striscia.home.length > 1, che avrebbe bloccato l'annulla quando la riga della squadra non servente contiene un solo elemento --- src/gameState.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gameState.js b/src/gameState.js index ee8bc79..2065620 100644 --- a/src/gameState.js +++ b/src/gameState.js @@ -10,7 +10,7 @@ export function createInitialState() { visuStriscia: true, modalitaPartita: "3/5", sp: { - striscia: { home: [0], guest: [0] }, + striscia: { home: [0], guest: [" "] }, servHome: true, punt: { home: 0, guest: 0 }, set: { home: 0, guest: 0 }, @@ -84,7 +84,7 @@ export function applyAction(state, action) { } case "decPunt": { - if (s.sp.striscia.home.length > 1 && s.sp.storicoServizio.length > 0) { + if (s.sp.storicoServizio.length > 0) { const tmpHome = s.sp.striscia.home.pop() s.sp.striscia.guest.pop() const statoServizio = s.sp.storicoServizio.pop() @@ -118,6 +118,9 @@ export function applyAction(state, action) { case "cambiaPalla": { if (s.sp.punt.home === 0 && s.sp.punt.guest === 0) { s.sp.servHome = !s.sp.servHome + s.sp.striscia = s.sp.servHome + ? { home: [0], guest: [" "] } + : { home: [" "], guest: [0] } } break } @@ -132,7 +135,9 @@ export function applyAction(state, action) { home: ["1", "2", "3", "4", "5", "6"], guest: ["1", "2", "3", "4", "5", "6"], } - s.sp.striscia = { home: [0], guest: [0] } + s.sp.striscia = s.sp.servHome + ? { home: [0], guest: [" "] } + : { home: [" "], guest: [0] } s.sp.storicoServizio = [] break }