+
+ // New game — only shown while a game is in progress
+ {move || {
+ if matches!(screen.get(), Screen::Playing(_) | Screen::Connecting) {
+ let tx = cmd_tx_newgame.clone();
+ Some(view! {
+
+
+
+ })
+ } else {
+ None
+ }
+ }}
+
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/clients/web/src/game/components/game_screen.rs b/clients/web/src/game/components/game_screen.rs
index 011f962..d55284f 100644
--- a/clients/web/src/game/components/game_screen.rs
+++ b/clients/web/src/game/components/game_screen.rs
@@ -19,8 +19,6 @@ use super::scoring::ScoringPanel;
pub fn GameScreen(state: GameUiState) -> impl IntoView {
let i18n = use_i18n();
- let auth_username =
- use_context::>>().unwrap_or_else(|| RwSignal::new(None));
let vs = state.view_state.clone();
let player_id = state.player_id;
let is_my_turn = vs.active_mp_player == Some(player_id);
@@ -100,7 +98,6 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
// ── Button senders ─────────────────────────────────────────────────────────
let cmd_tx_go = cmd_tx.clone();
- let cmd_tx_quit = cmd_tx.clone();
let cmd_tx_end_quit = cmd_tx.clone();
let cmd_tx_end_replay = cmd_tx.clone();
// Only show the fallback Go button when there is no ScoringPanel showing it.
@@ -246,62 +243,23 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
let opp_name_end = opp_score.name.clone();
let opp_holes_end = opp_score.holes;
- // Open by default for the room creator while waiting for an opponent.
- // When the opponent joins the stage becomes PreGameRoll, so the next
- // re-mount will initialise this to false — auto-closing the popover.
- let share_open = RwSignal::new(!is_bot_game && player_id == 0 && stage == SerStage::PreGame);
- let share_copied = 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 sidebar_copied = 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() };
view! {
+ // ── Game container ────────────────────────────────────────────────────
- // ── Top bar ──────────────────────────────────────────────────────
-
-
- // ── Share popover ─────────────────────────────────────────────────
- {move || share_open.get().then(|| {
- let url = share_url.clone();
- let url_copy = share_url.clone();
+ // ── Share popover (while waiting for opponent) ───────────────────
+ {(!is_bot_game && stage == SerStage::PreGame).then(|| {
+ let url_label = share_url.clone();
+ let url_copy = share_url.clone();
+ let svg = share_svg.clone();
view! {
{t!(i18n, share_link)}
- {url}
+ {url_label}
-
- {t!(i18n, scan_qr)}
-
-
+
{t!(i18n, scan_qr)}
+
}
})}
diff --git a/clients/web/src/main.rs b/clients/web/src/main.rs
index 5d5fbb4..f4bc597 100644
--- a/clients/web/src/main.rs
+++ b/clients/web/src/main.rs
@@ -3,7 +3,6 @@ leptos_i18n::load_locales!();
mod api;
mod app;
mod game;
-mod nav;
mod portal;
use app::App;