fix: remove language switcher from game panel
This commit is contained in:
parent
04369ea28e
commit
c69891605e
3 changed files with 38 additions and 31 deletions
|
|
@ -12,17 +12,17 @@ use backbone_lib::session::{ConnectError, GameSession, RoomConfig, RoomRole, Ses
|
|||
use backbone_lib::traits::ViewStateUpdate;
|
||||
|
||||
use crate::api;
|
||||
use crate::i18n::*;
|
||||
use crate::game::components::{ConnectingScreen, GameScreen};
|
||||
use crate::game::session::{
|
||||
compute_last_moves, patch_player_name, push_or_show, run_local_bot_game,
|
||||
};
|
||||
use crate::game::trictrac::backend::TrictracBackend;
|
||||
use crate::game::trictrac::types::{
|
||||
GameDelta, PlayerAction, ScoredEvent, SerStage, ViewState,
|
||||
};
|
||||
use crate::game::trictrac::types::{GameDelta, PlayerAction, ScoredEvent, SerStage, ViewState};
|
||||
use crate::i18n::*;
|
||||
use crate::nav::SiteNav;
|
||||
use crate::portal::{account::AccountPage, game_detail::GameDetailPage, lobby::LobbyPage, profile::ProfilePage};
|
||||
use crate::portal::{
|
||||
account::AccountPage, game_detail::GameDetailPage, lobby::LobbyPage, profile::ProfilePage,
|
||||
};
|
||||
use trictrac_store::CheckerMove;
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
|
@ -65,8 +65,12 @@ pub enum Screen {
|
|||
|
||||
/// Commands sent from UI event handlers into the network task.
|
||||
pub enum NetCommand {
|
||||
CreateRoom { room: String },
|
||||
JoinRoom { room: String },
|
||||
CreateRoom {
|
||||
room: String,
|
||||
},
|
||||
JoinRoom {
|
||||
room: String,
|
||||
},
|
||||
Reconnect {
|
||||
relay_url: String,
|
||||
game_id: String,
|
||||
|
|
@ -227,10 +231,12 @@ pub fn App() -> impl IntoView {
|
|||
};
|
||||
|
||||
if remote_config.is_none() {
|
||||
let player_name = auth_username.get_untracked()
|
||||
.unwrap_or_else(|| t_string!(i18n, anonymous_name).to_string());
|
||||
let player_name = auth_username
|
||||
.get_untracked()
|
||||
.unwrap_or_else(|| untrack(|| t_string!(i18n, anonymous_name).to_string()));
|
||||
loop {
|
||||
let restart = run_local_bot_game(screen, &mut cmd_rx, pending, player_name.clone()).await;
|
||||
let restart =
|
||||
run_local_bot_game(screen, &mut cmd_rx, pending, player_name.clone()).await;
|
||||
if !restart {
|
||||
break;
|
||||
}
|
||||
|
|
@ -270,7 +276,8 @@ pub fn App() -> impl IntoView {
|
|||
let is_host = session.is_host;
|
||||
let player_id = session.player_id;
|
||||
let reconnect_token = session.reconnect_token;
|
||||
let my_name = auth_username.get_untracked()
|
||||
let my_name = auth_username
|
||||
.get_untracked()
|
||||
.unwrap_or_else(|| t_string!(i18n, anonymous_name).to_string());
|
||||
let mut vs = ViewState::default_with_names("", "");
|
||||
let mut result_submitted = false;
|
||||
|
|
@ -385,15 +392,18 @@ fn GameOverlay(
|
|||
if let Some(state) = front {
|
||||
return view! {
|
||||
<div class="game-overlay"><GameScreen state /></div>
|
||||
}.into_any();
|
||||
}
|
||||
.into_any();
|
||||
}
|
||||
match screen.get() {
|
||||
Screen::Playing(state) => view! {
|
||||
<div class="game-overlay"><GameScreen state /></div>
|
||||
}.into_any(),
|
||||
}
|
||||
.into_any(),
|
||||
Screen::Connecting => view! {
|
||||
<div class="game-overlay"><ConnectingScreen /></div>
|
||||
}.into_any(),
|
||||
}
|
||||
.into_any(),
|
||||
_ => view! {}.into_any(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ use trictrac_store::{Board as StoreBoard, CheckerMove, Color, Dice as StoreDice,
|
|||
|
||||
use super::die::Die;
|
||||
use crate::app::{GameUiState, NetCommand, PauseReason};
|
||||
use crate::game::trictrac::types::{PlayerAction, PreGameRollState, SerStage, SerTurnStage};
|
||||
use crate::i18n::*;
|
||||
use crate::portal::lobby::{qr_svg, room_url};
|
||||
use crate::game::trictrac::types::{PlayerAction, PreGameRollState, SerStage, SerTurnStage};
|
||||
|
||||
use super::board::Board;
|
||||
use super::score_panel::PlayerScorePanel;
|
||||
|
|
@ -225,8 +225,16 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
|
|||
let opp_holes_end = opp_score.holes;
|
||||
|
||||
let share_open = RwSignal::new(false);
|
||||
let share_url = if !is_bot_game { room_url(&room_id) } else { String::new() };
|
||||
let share_svg = if !is_bot_game { qr_svg(&share_url) } else { String::new() };
|
||||
let share_url = if !is_bot_game {
|
||||
room_url(&room_id)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
let share_svg = if !is_bot_game {
|
||||
qr_svg(&share_url)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
view! {
|
||||
<div class="game-container">
|
||||
|
|
@ -249,17 +257,6 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
|
|||
</button>
|
||||
})}
|
||||
|
||||
<div class="lang-switcher">
|
||||
<button
|
||||
class:lang-active=move || i18n.get_locale() == Locale::en
|
||||
on:click=move |_| i18n.set_locale(Locale::en)
|
||||
>"EN"</button>
|
||||
<button
|
||||
class:lang-active=move || i18n.get_locale() == Locale::fr
|
||||
on:click=move |_| i18n.set_locale(Locale::fr)
|
||||
>"FR"</button>
|
||||
</div>
|
||||
|
||||
{move || auth_username.get().map(|u| view! {
|
||||
<span class="playing-as">"▶ " <strong>{u}</strong></span>
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ fn IdleCard(
|
|||
<div style="margin-top:0.75rem;display:flex;gap:0.5rem">
|
||||
<input
|
||||
class="login-input"
|
||||
style="flex:1;margin:0"
|
||||
style="margin:0"
|
||||
type="text"
|
||||
placeholder=move || t_string!(i18n, join_code_placeholder)
|
||||
prop:value=move || join_code.get()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue