From 93e853977ac0d1b54b2edbb07823438deb93d7d6 Mon Sep 17 00:00:00 2001 From: spinline Date: Wed, 11 Feb 2026 01:31:30 +0300 Subject: [PATCH] feat: simplify theme toggle and improve sidebar layout - frontend/src/components/layout/sidebar.rs: Replaced theme selector with simple dark/light toggle button. - Cleaned up profile section layout and added safe-area padding. --- frontend/src/components/layout/sidebar.rs | 75 ++++++++--------------- 1 file changed, 25 insertions(+), 50 deletions(-) diff --git a/frontend/src/components/layout/sidebar.rs b/frontend/src/components/layout/sidebar.rs index 87fd4a4..9857398 100644 --- a/frontend/src/components/layout/sidebar.rs +++ b/frontend/src/components/layout/sidebar.rs @@ -3,7 +3,7 @@ use leptos::task::spawn_local; use leptos_shadcn_button::{Button, ButtonVariant, ButtonSize}; use leptos_shadcn_avatar::{Avatar, AvatarFallback}; use leptos_shadcn_separator::Separator; -use leptos::html; + use leptos_use::storage::use_local_storage; use ::codee::string::FromToStringCodec; @@ -93,11 +93,11 @@ pub fn Sidebar() -> impl IntoView { } }); - let theme_details_ref = NodeRef::::new(); - let close_details = move |node_ref: NodeRef| { - if let Some(el) = node_ref.get_untracked() { - el.set_open(false); - } + + + let toggle_theme = move |_| { + let new_theme = if current_theme.get() == "dark" { "light" } else { "dark" }; + set_current_theme.set(new_theme.to_string()); }; // --- THEME LOGIC END --- @@ -192,7 +192,7 @@ pub fn Sidebar() -> impl IntoView { -
+
@@ -205,50 +205,25 @@ pub fn Sidebar() -> impl IntoView {
// --- THEME BUTTON --- -
- - - + - - - -
+ }> + + + + +