From 0eb52661e1921c72589ad95ed289eba3aec90df9 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Wed, 6 May 2026 13:24:06 +0200 Subject: [PATCH] feat(web client): sidebar menu icons --- clients/web/assets/style.css | 9 ++- clients/web/locales/en.json | 3 +- clients/web/locales/fr.json | 3 +- clients/web/src/app.rs | 63 +++++++++++-------- .../web/src/game/components/game_screen.rs | 22 ++++--- 5 files changed, 65 insertions(+), 35 deletions(-) diff --git a/clients/web/assets/style.css b/clients/web/assets/style.css index 35d4eee..001076e 100644 --- a/clients/web/assets/style.css +++ b/clients/web/assets/style.css @@ -47,6 +47,13 @@ body { .hidden { display: none !important; } +/* -- svg icons -- */ +.icon { + width: 1.2em; + height: 1.2em; + color: var(--ui-parchment); +} + /* ── Site navigation ─────────────────────────────────────────────── */ .site-nav { background: var(--board-rail); @@ -1999,7 +2006,7 @@ a:hover { text-decoration: underline; } padding: 0.9rem 1rem; border-bottom: 1px solid rgba(200,164,72,0.12); display: flex; - flex-direction: column; + flex-direction: row; gap: 0.55rem; } diff --git a/clients/web/locales/en.json b/clients/web/locales/en.json index 4e41d9a..6899303 100644 --- a/clients/web/locales/en.json +++ b/clients/web/locales/en.json @@ -128,5 +128,6 @@ "nickname_modal_or": "or", "nickname_modal_sign_in": "Sign in", "nickname_modal_register": "Create account", - "new_game": "New game" + "new_game": "New game", + "language": "Language" } diff --git a/clients/web/locales/fr.json b/clients/web/locales/fr.json index 1d2a8d0..b22a69a 100644 --- a/clients/web/locales/fr.json +++ b/clients/web/locales/fr.json @@ -128,5 +128,6 @@ "nickname_modal_or": "ou", "nickname_modal_sign_in": "Se connecter", "nickname_modal_register": "Créer un compte", - "new_game": "Nouvelle partie" + "new_game": "Nouvelle partie", + "language": "Langue" } diff --git a/clients/web/src/app.rs b/clients/web/src/app.rs index 85ee622..521a0c1 100644 --- a/clients/web/src/app.rs +++ b/clients/web/src/app.rs @@ -467,11 +467,7 @@ fn SiteHamburger() -> impl IntoView {
"Trictrac" -
- // Language switcher -
- "Language"
+ // Language switcher + //
+ // + // + // + // {t!(i18n, language)} + //
+ // + // + //
+ //
+ +
+ + + + {move || { + let tx = cmd_tx_newgame.clone(); + Some(view! { + + {t!(i18n, new_game)} + + }) + }} +
+ // Auth
+ + + + {move || match auth_username.get() { Some(u) => { let href = format!("/profile/{u}"); view! { - {u} + {u}
- - // 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 - } - }} } } diff --git a/clients/web/src/game/components/game_screen.rs b/clients/web/src/game/components/game_screen.rs index 108208a..181ad78 100644 --- a/clients/web/src/game/components/game_screen.rs +++ b/clients/web/src/game/components/game_screen.rs @@ -250,9 +250,17 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView { let opp_name_end = opp_score.name.clone(); let opp_holes_end = opp_score.holes; - 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() }; + let share_url_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 ──────────────────────────────────────────────────── @@ -278,14 +286,14 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView { let _ = wasm_bindgen_futures::JsFuture::from( cb.write_text(&u), ).await; - sidebar_copied.set(true); + share_url_copied.set(true); gloo_timers::future::TimeoutFuture::new(2000).await; - sidebar_copied.set(false); + share_url_copied.set(false); } }); } }> - {move || if sidebar_copied.get() { + {move || if share_url_copied.get() { t_string!(i18n, link_copied) } else { t_string!(i18n, copy_link) @@ -298,7 +306,7 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView { } })} - // ── Merged scoreboard + scoring panels (above board) ───────────── + // ── Merged scoreboard + scoring panels ───────────── // score-area is position:relative so the scoring-panels-container // can be absolute-positioned at the right of the hole counter.