use leptos::*; #[component] pub fn ContextMenu( position: (i32, i32), visible: bool, torrent_hash: String, on_close: Callback<()>, on_action: Callback<(String, String)>, // (Action, Hash) ) -> impl IntoView { let handle_action = move |action: &str| { let hash = torrent_hash.clone(); let action_str = action.to_string(); logging::log!("ContextMenu: Action '{}' for hash '{}'", action_str, hash); on_action.call((action_str, hash)); // Delegate FIRST on_close.call(()); // Close menu AFTER }; if !visible { return view! {}.into_view(); } view! { // Backdrop to catch clicks outside