39 lines
1.3 KiB
Rust
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>
|
|
}
|
|
}
|