From a08fd9698fb3da69e49d58ad2b82a7d2d2d576d4 Mon Sep 17 00:00:00 2001 From: spinline Date: Sun, 8 Feb 2026 20:16:05 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20a=C3=A7=C4=B1l=C4=B1r=20men=C3=BCle?= =?UTF-8?q?r=20leptos-use::on=5Fclick=5Foutside=20ile=20modernize=20edildi?= =?UTF-8?q?,=20=C5=9Feffaf=20backdrop=20katmanlar=C4=B1=20kald=C4=B1r?= =?UTF-8?q?=C4=B1ld=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/context_menu.rs | 15 ++++++------- frontend/src/components/layout/statusbar.rs | 24 +++++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/context_menu.rs b/frontend/src/components/context_menu.rs index 6934db4..9abf309 100644 --- a/frontend/src/components/context_menu.rs +++ b/frontend/src/components/context_menu.rs @@ -1,4 +1,5 @@ use leptos::*; +use leptos_use::on_click_outside; #[component] pub fn ContextMenu( @@ -8,6 +9,10 @@ pub fn ContextMenu( on_close: Callback<()>, on_action: Callback<(String, String)>, // (Action, Hash) ) -> impl IntoView { + let container_ref = create_node_ref::(); + + let _ = on_click_outside(container_ref, move |_| on_close.call(())); + let handle_action = move |action: &str| { let hash = torrent_hash.clone(); let action_str = action.to_string(); @@ -22,16 +27,8 @@ pub fn ContextMenu( } view! { - // Backdrop to catch clicks outside -
-
impl IntoView { set_active_dropdown.set(0); }; - view! { - // Transparent overlay to close dropdowns when clicking outside - -
-
+ // Refs for click outside detection + let down_ref = create_node_ref::(); + let up_ref = create_node_ref::(); + let theme_ref = create_node_ref::(); + let _ = on_click_outside(down_ref, move |_| if active_dropdown.get_untracked() == 1 { close_all() }); + let _ = on_click_outside(up_ref, move |_| if active_dropdown.get_untracked() == 2 { close_all() }); + let _ = on_click_outside(theme_ref, move |_| if active_dropdown.get_untracked() == 3 { close_all() }); + + view! {
// --- DOWNLOAD SPEED DROPDOWN --- -
+
impl IntoView {
// --- UPLOAD SPEED DROPDOWN --- -
+
impl IntoView {
-
+