fix(web client): show toss winner
This commit is contained in:
parent
8705cc418b
commit
7395d140cc
5 changed files with 43 additions and 5 deletions
|
|
@ -1859,6 +1859,14 @@ a:hover { text-decoration: underline; }
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
.ceremony-result {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.15rem;
|
||||
font-weight: 600;
|
||||
color: var(--ui-gold-dark);
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
/* ── Nickname modal (anonymous player name chooser) ─────────────────── */
|
||||
.nickname-backdrop {
|
||||
position: fixed;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
"roll_dice": "Roll dice",
|
||||
"go": "Go",
|
||||
"empty_move": "Empty move",
|
||||
"cancel_move": "Cancel move",
|
||||
"you_suffix": " (you)",
|
||||
"points_label": "Points",
|
||||
"holes_label": "Holes",
|
||||
|
|
@ -46,6 +47,8 @@
|
|||
"pre_game_roll_title": "Who goes first?",
|
||||
"pre_game_roll_btn": "Roll",
|
||||
"pre_game_roll_tie": "Tie! Roll again",
|
||||
"toss_you_first": "You go first!",
|
||||
"toss_opp_first": "{{ name }} goes first!",
|
||||
"pre_game_roll_your_die": "Your die",
|
||||
"pre_game_roll_opp_die": "Opponent's die",
|
||||
"continue_btn": "Continue",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"room_name_placeholder": "Nom de la salle",
|
||||
"create_room": "Créer une salle",
|
||||
"create_room": "Inviter un adversaire",
|
||||
"join_room": "Rejoindre",
|
||||
"connecting": "Connexion en cours…",
|
||||
"game_over": "Partie terminée",
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
"roll_dice": "Lancer les dés",
|
||||
"go": "S'en aller",
|
||||
"empty_move": "Mouvement impossible",
|
||||
"cancel_move": "Annuler le déplacement",
|
||||
"you_suffix": " (vous)",
|
||||
"points_label": "Points",
|
||||
"holes_label": "Trous",
|
||||
|
|
@ -36,8 +37,8 @@
|
|||
"jan_helpless_man": "Dame impuissante",
|
||||
"play_vs_bot": "Jouer contre le bot",
|
||||
"vs_bot_label": "contre le bot",
|
||||
"you_win": "Vous avez gagné !",
|
||||
"opp_wins": "{{ name }} gagne !",
|
||||
"you_win": "Vous avez gagné !",
|
||||
"opp_wins": "{{ name }} a gagné !",
|
||||
"play_again": "Rejouer",
|
||||
"after_opponent_roll": "L'adversaire a lancé les dés",
|
||||
"after_opponent_go": "L'adversaire s'en va",
|
||||
|
|
@ -46,6 +47,8 @@
|
|||
"pre_game_roll_title": "Qui joue en premier ?",
|
||||
"pre_game_roll_btn": "Lancer",
|
||||
"pre_game_roll_tie": "Égalité ! Relancez",
|
||||
"toss_you_first": "Vous commencez !",
|
||||
"toss_opp_first": "{{ name }} commence !",
|
||||
"pre_game_roll_your_die": "Votre dé",
|
||||
"pre_game_roll_opp_die": "Dé adverse",
|
||||
"continue_btn": "Continuer",
|
||||
|
|
@ -119,7 +122,7 @@
|
|||
"copy_link": "Copier le lien",
|
||||
"link_copied": "Copié !",
|
||||
"scan_qr": "ou scannez le QR code",
|
||||
"join_code_label": "Rejoindre par code",
|
||||
"join_code_label": "Rejoindre avec un code",
|
||||
"join_code_placeholder": "Code de la salle",
|
||||
"share_btn": "Partager",
|
||||
"nickname_modal_title": "Choisissez votre pseudo",
|
||||
|
|
|
|||
|
|
@ -424,6 +424,17 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
|
|||
>{t!(i18n, empty_move)}</button>
|
||||
})
|
||||
}}
|
||||
{move || {
|
||||
(is_move_stage && staged_moves.get().len() == 1).then(|| view! {
|
||||
<button
|
||||
class="btn btn-secondary"
|
||||
on:click=move |_| {
|
||||
staged_moves.set(vec![]);
|
||||
selected_origin.set(None);
|
||||
}
|
||||
>{t!(i18n, cancel_move)}</button>
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -442,6 +453,11 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
|
|||
let opp_die = if player_id == 0 { pgr.guest_die } else { pgr.host_die };
|
||||
let can_roll = my_die.is_none() && !waiting_for_confirm;
|
||||
let show_tie = pgr.tie_count > 0;
|
||||
let toss_result: Option<bool> = match (my_die, opp_die) {
|
||||
(Some(m), Some(o)) if m != o => Some(m > o),
|
||||
_ => None,
|
||||
};
|
||||
let opp_name_toss = opp_name_ceremony.clone();
|
||||
view! {
|
||||
<div class="ceremony-overlay">
|
||||
<div class="ceremony-box">
|
||||
|
|
@ -459,6 +475,14 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
|
|||
<Die value=opp_die.unwrap_or(0) used=false />
|
||||
</div>
|
||||
</div>
|
||||
{toss_result.map(|i_win| {
|
||||
let text = move || if i_win {
|
||||
t_string!(i18n, toss_you_first).to_owned()
|
||||
} else {
|
||||
t_string!(i18n, toss_opp_first, name = opp_name_toss.as_str()).to_owned()
|
||||
};
|
||||
view! { <p class="ceremony-result">{text}</p> }
|
||||
})}
|
||||
{waiting_for_confirm.then(|| {
|
||||
let pending_c = pending;
|
||||
view! {
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ fn IdleCard(
|
|||
view! {
|
||||
<div class="login-actions">
|
||||
<button
|
||||
class="login-btn login-btn-bot"
|
||||
class="login-btn login-btn-secondary"
|
||||
on:click=move |_| { cmd_bot.unbounded_send(NetCommand::PlayVsBot).ok(); }
|
||||
>
|
||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue