From 7383b7d5e864d9ff09ee13b0a639f1cd43136a5c Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Tue, 31 Mar 2026 21:55:39 +0200 Subject: [PATCH] fix(web_client): dice jans display when dice not rolled --- client_web/locales/fr.json | 20 ++++++++++---------- client_web/src/components/game_screen.rs | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/client_web/locales/fr.json b/client_web/locales/fr.json index c760968..df6a2b5 100644 --- a/client_web/locales/fr.json +++ b/client_web/locales/fr.json @@ -5,16 +5,16 @@ "connecting": "Connexion en cours…", "game_over": "Partie terminée", "waiting_for_opponent": "En attente de l'adversaire…", - "your_turn_roll": "Votre tour — lancez les dés", - "hold_or_go": "Tenir ou aller ?", + "your_turn_roll": "À votre tour — lancez les dés", + "hold_or_go": "Tenir ou s'en aller ?", "select_move": "Sélectionner le coup {{ n }} sur 2", "your_turn": "Votre tour", "opponent_turn": "Tour de l'adversaire", "room_label": "Salle : {{ id }}", "quit": "Quitter", "roll_dice": "Lancer les dés", - "go": "Aller", - "empty_move": "Coup vide", + "go": "S'en aller", + "empty_move": "Mouvement impossible", "you_suffix": " (vous)", "points_label": "Points", "holes_label": "Trous", @@ -26,17 +26,17 @@ "jan_true_hit_big": "Battage à vrai (grand jan)", "jan_true_hit_corner": "Battage coin adverse", "jan_first_exit": "Premier sorti", - "jan_six_tables": "Six tables", - "jan_two_tables": "Deux tables", - "jan_mezeas": "Mezeas", + "jan_six_tables": "Jan de six tables", + "jan_two_tables": "Jan de deux tables", + "jan_mezeas": "Jan de mézéas", "jan_false_hit_small": "Battage à faux (petit jan)", "jan_false_hit_big": "Battage à faux (grand jan)", - "jan_contre_two": "Contre deux tables", - "jan_contre_mezeas": "Contre mezeas", + "jan_contre_two": "Contre jan de deux tables", + "jan_contre_mezeas": "Contre jan de mezeas", "jan_helpless_man": "Dame impuissante", "play_vs_bot": "Jouer contre le bot", "vs_bot_label": "contre le bot", - "you_win": "Vous gagnez !", + "you_win": "Vous avez gagné !", "opp_wins": "{{ name }} gagne !", "play_again": "Rejouer" } diff --git a/client_web/src/components/game_screen.rs b/client_web/src/components/game_screen.rs index 1477d19..6c3edec 100644 --- a/client_web/src/components/game_screen.rs +++ b/client_web/src/components/game_screen.rs @@ -35,10 +35,7 @@ fn matched_dice_used(staged: &[(u8, u8)], dice: (u8, u8)) -> (bool, bool) { } /// Split `dice_jans` into (viewer_jans, opponent_jans). -fn split_jans( - dice_jans: &[JanEntry], - viewer_is_active: bool, -) -> (Vec, Vec) { +fn split_jans(dice_jans: &[JanEntry], viewer_is_active: bool) -> (Vec, Vec) { let mut mine = Vec::new(); let mut theirs = Vec::new(); for e in dice_jans { @@ -46,12 +43,20 @@ fn split_jans( if e.total >= 0 { mine.push(e.clone()); } else { - theirs.push(JanEntry { total: -e.total, points_per: -e.points_per, ..e.clone() }); + theirs.push(JanEntry { + total: -e.total, + points_per: -e.points_per, + ..e.clone() + }); } } else if e.total >= 0 { theirs.push(e.clone()); } else { - mine.push(JanEntry { total: -e.total, points_per: -e.points_per, ..e.clone() }); + mine.push(JanEntry { + total: -e.total, + points_per: -e.points_per, + ..e.clone() + }); } } (mine, theirs) @@ -107,7 +112,7 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView { let show_hold_go = is_my_turn && vs.turn_stage == SerTurnStage::HoldOrGoChoice; // ── Jan split: viewer_jans / opponent_jans ───────────────────────────────── - let (my_jans, opp_jans) = split_jans(&vs.dice_jans, is_my_turn); + let (my_jans, opp_jans) = split_jans(&vs.dice_jans, is_my_turn && !show_roll); // ── Scores ───────────────────────────────────────────────────────────────── let my_score = vs.scores[player_id as usize].clone();