diff --git a/frontend/src/components/torrent/table.rs b/frontend/src/components/torrent/table.rs index fecf2e6..1e986e9 100644 --- a/frontend/src/components/torrent/table.rs +++ b/frontend/src/components/torrent/table.rs @@ -9,6 +9,7 @@ use crate::components::context_menu::TorrentContextMenu; use crate::components::ui::card::{Card, CardHeader, CardTitle, CardContent as CardBody}; use crate::components::ui::data_table::*; use crate::components::ui::checkbox::Checkbox; +use crate::components::ui::button::{Button, ButtonVariant}; fn format_bytes(bytes: i64) -> String { const UNITS: [&str; 6] = ["B", "KB", "MB", "GB", "TB", "PB"]; @@ -134,6 +135,18 @@ pub fn TorrentTable() -> impl IntoView { } }; + let sort_icon = move |col: SortColumn| { + let is_active = sort_col.0.get() == col; + let class = if is_active { + "size-3 opacity-100 text-primary" + } else { + "size-3 opacity-30 group-hover:opacity-100 transition-opacity" + }; + view! { + + } + }; + let on_action = Callback::new(move |(action, hash): (String, String)| { let (success_msg_str, error_msg_str): (&'static str, &'static str) = get_action_messages(&action); let success_msg = success_msg_str.to_string(); @@ -171,19 +184,39 @@ pub fn TorrentTable() -> impl IntoView { on_checked_change=handle_select_all /> + + // Column Headers with Sorting - - "Name" - - + "Name" {move || sort_icon(SortColumn::Name)} + + + + "Size" {move || sort_icon(SortColumn::Size)} + + + + "Progress" {move || sort_icon(SortColumn::Progress)} + + + + "Status" {move || sort_icon(SortColumn::Status)} + + + + "DL Speed" {move || sort_icon(SortColumn::DownSpeed)} + + + + "UP Speed" {move || sort_icon(SortColumn::UpSpeed)} + + + + "ETA" {move || sort_icon(SortColumn::ETA)} + + + + "Date" {move || sort_icon(SortColumn::AddedDate)} - "Size" - "Progress" - "Status" - "DL Speed" - "UP Speed" - "ETA" - "Date" @@ -391,4 +424,4 @@ fn TorrentCard( } }.into_any() -} \ No newline at end of file +}