From d09ecd21b7a2bbaa7df1664b34745ca7446bd58e Mon Sep 17 00:00:00 2001 From: spinline Date: Thu, 12 Feb 2026 00:08:35 +0300 Subject: [PATCH] feat: refactor torrent table to use DataTable components and fix context menu bugs --- frontend/src/components/torrent/table.rs | 161 ++++++++++++--------- frontend/src/components/ui/context_menu.rs | 8 +- frontend/src/components/ui/table.rs | 19 +++ 3 files changed, 114 insertions(+), 74 deletions(-) create mode 100644 frontend/src/components/ui/table.rs diff --git a/frontend/src/components/torrent/table.rs b/frontend/src/components/torrent/table.rs index 5ccb701..56f68a2 100644 --- a/frontend/src/components/torrent/table.rs +++ b/frontend/src/components/torrent/table.rs @@ -4,7 +4,8 @@ use crate::store::{get_action_messages, show_toast}; use crate::api; use shared::NotificationLevel; use crate::components::context_menu::TorrentContextMenu; -use crate::components::ui::card::{Card, CardHeader, CardTitle, CardContent}; +use crate::components::ui::card::{Card, CardHeader, CardTitle, CardContent as CardBody}; +use crate::components::ui::table::*; fn format_bytes(bytes: i64) -> String { const UNITS: [&str; 6] = ["B", "KB", "MB", "GB", "TB", "PB"]; @@ -106,10 +107,10 @@ pub fn TorrentTable() -> impl IntoView { let sort_arrow = move |col: SortColumn| { if sort_col.0.get() == col { match sort_dir.0.get() { - SortDirection::Ascending => view! { "▲" }.into_any(), - SortDirection::Descending => view! { "▼" }.into_any(), + SortDirection::Ascending => view! { "▲" }.into_any(), + SortDirection::Descending => view! { "▼" }.into_any(), } - } else { view! { "▲" }.into_any() } + } else { view! { "▲" }.into_any() } }; let on_action = Callback::new(move |(action, hash): (String, String)| { @@ -132,51 +133,56 @@ pub fn TorrentTable() -> impl IntoView { }); view! { -
+
// --- DESKTOP VIEW ---