use leptos::prelude::*; use leptos::html; use leptos_use::on_click_outside; fn handle_action( hash: String, action: &str, on_action: Callback<(String, String)>, on_close: Callback<()>, ) { log::info!("ContextMenu: Action '{}' for hash '{}'", action, hash); on_action.run((action.to_string(), hash)); on_close.run(()); } #[component] pub fn ContextMenu( position: (i32, i32), torrent_hash: String, on_close: Callback<()>, on_action: Callback<(String, String)>, ) -> impl IntoView { let container_ref = NodeRef::::new(); let _ = on_click_outside(container_ref, move |_| on_close.run(())); let (x, y) = position; let hash1 = torrent_hash.clone(); let hash2 = torrent_hash.clone(); let hash3 = torrent_hash.clone(); let hash4 = torrent_hash.clone(); let hash5 = torrent_hash; view! {
} }