From daa24dd7ec3f6652fa0f10dd274032036c5f7f1a Mon Sep 17 00:00:00 2001 From: spinline Date: Sat, 21 Feb 2026 01:13:57 +0300 Subject: [PATCH] fix(ui): refactor FileContextMenu to auticlose and match homepage --- frontend/src/components/torrent/files.rs | 88 ++++++++++++++++-------- 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/frontend/src/components/torrent/files.rs b/frontend/src/components/torrent/files.rs index 7110f64..2102165 100644 --- a/frontend/src/components/torrent/files.rs +++ b/frontend/src/components/torrent/files.rs @@ -104,42 +104,68 @@ fn FileRow(file: TorrentFile, hash: String, refresh_action: Action + + {file.index} + + {file.path.clone()} + + + {format_bytes(file.size)} + + + {format_bytes(file.completed_chunks)} + + + { + let (variant, label) = match file.priority { + 0 => (BadgeVariant::Destructive, "İndirme"), + 2 => (BadgeVariant::Success, "Yüksek"), + _ => (BadgeVariant::Secondary, "Normal"), + }; + view! { {label} } + } + + + + } +} + +#[component] +fn FileContextMenu( + children: Children, + torrent_hash: String, + file_index: u32, + refresh_action: Action>, + set_priority: Action<(String, u32, u8), Result<(), ServerFnError>>, +) -> impl IntoView { + let hash_c1 = torrent_hash.clone(); + let hash_c2 = torrent_hash.clone(); + let hash_c3 = torrent_hash.clone(); + view! { - - - {file.index} - - {file.path.clone()} - - - {format_bytes(file.size)} - - - {format_bytes(file.completed_chunks)} - - - { - let (variant, label) = match file.priority { - 0 => (BadgeVariant::Destructive, "İndirme"), - 2 => (BadgeVariant::Success, "Yüksek"), - _ => (BadgeVariant::Secondary, "Normal"), - }; - view! { {label} } - } - - + + {children()} "Dosya Önceliği" @@ -147,11 +173,13 @@ fn FileRow(file: TorrentFile, hash: String, refresh_action: Action @@ -159,11 +187,13 @@ fn FileRow(file: TorrentFile, hash: String, refresh_action: Action