From 9f66ee4f9567abf32f4ba0d274c67290b14abf8f Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 17 Apr 2024 15:52:08 +0200 Subject: [PATCH] fix(web): start with menu closed on mobile --- web/Cargo.toml | 1 + web/src/main.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/Cargo.toml b/web/Cargo.toml index 824e2b69..40d42a02 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -28,3 +28,4 @@ futures = "0.3.30" dissolve = "0.2" # TODO strip html without this crate lazy_static = "1.4" chrono = { version = "0.4", features = ["serde"] } +web-sys = { version = "0.3", features = ["Screen"] } diff --git a/web/src/main.rs b/web/src/main.rs index 15ad5e42..c7fd8c6d 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -17,7 +17,9 @@ fn main() { let home_tl = Timeline::new(format!("{URL_BASE}/users/{}/inbox/page", username.get().unwrap_or_default())); let server_tl = Timeline::new(format!("{URL_BASE}/inbox/page")); - let (menu, set_menu) = create_signal(false); + let screen_width = window().screen().map(|x| x.avail_width().unwrap_or_default()).unwrap_or_default(); + + let (menu, set_menu) = create_signal(screen_width <= 786); spawn_local(async move { if let Err(e) = server_tl.more(token).await {