Files
vibetorrent/frontend/src/components/context_menu.rs
spinline d8ce07001f
Some checks failed
Build MIPS Binary / build (push) Failing after 43s
chore: major cleanup of compiler warnings, unused imports and dead code across all UI components
2026-02-12 23:46:41 +03:00

39 lines
1.3 KiB
Rust

use leptos::prelude::*;
use crate::components::ui::context_menu::{
ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger,
};
#[component]
pub fn TorrentContextMenu(
children: Children,
torrent_hash: String,
on_action: Callback<(String, String)>,
) -> impl IntoView {
let hash = torrent_hash.clone();
let on_click = move |action: &str| {
on_action.run((action.to_string(), hash.clone()));
};
view! {
<ContextMenu>
<ContextMenuTrigger>
{children()}
</ContextMenuTrigger>
<ContextMenuContent class="w-48">
<ContextMenuItem on:click=move |_| on_click("start")>
"Başlat"
</ContextMenuItem>
<ContextMenuItem on:click=move |_| on_click("stop")>
"Durdur"
</ContextMenuItem>
<ContextMenuItem class="text-destructive" on:click=move |_| on_click("delete")>
"Sil"
</ContextMenuItem>
<ContextMenuItem class="text-destructive font-bold" on:click=move |_| on_click("delete_with_data")>
"Verilerle Birlikte Sil"
</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
}
}