fix: restore table alignment by ensuring proper HTML structure and integrating multi-select DataTable
All checks were successful
Build MIPS Binary / build (push) Successful in 5m27s

This commit is contained in:
spinline
2026-02-12 00:48:35 +03:00
parent bfb152f0d8
commit f1c75c468a
2 changed files with 5 additions and 6 deletions

View File

@@ -9,7 +9,6 @@ use crate::components::context_menu::TorrentContextMenu;
use crate::components::ui::card::{Card, CardHeader, CardTitle, CardContent as CardBody}; use crate::components::ui::card::{Card, CardHeader, CardTitle, CardContent as CardBody};
use crate::components::ui::data_table::*; use crate::components::ui::data_table::*;
use crate::components::ui::checkbox::Checkbox; use crate::components::ui::checkbox::Checkbox;
use crate::components::ui::button::{Button, ButtonVariant};
fn format_bytes(bytes: i64) -> String { fn format_bytes(bytes: i64) -> String {
const UNITS: [&str; 6] = ["B", "KB", "MB", "GB", "TB", "PB"]; const UNITS: [&str; 6] = ["B", "KB", "MB", "GB", "TB", "PB"];
@@ -163,7 +162,7 @@ pub fn TorrentTable() -> impl IntoView {
<DataTable> <DataTable>
<DataTableHeader class="sticky top-0 bg-muted/80 backdrop-blur-sm z-10"> <DataTableHeader class="sticky top-0 bg-muted/80 backdrop-blur-sm z-10">
<DataTableRow class="hover:bg-transparent"> <DataTableRow class="hover:bg-transparent">
<DataTableHead class="w-12 px-4"> <DataTableHead class="w-12">
<Checkbox <Checkbox
checked=Signal::derive(move || { checked=Signal::derive(move || {
let hashes = filtered_hashes.get(); let hashes = filtered_hashes.get();
@@ -281,7 +280,7 @@ fn TorrentRow(
attr:data-state=move || if is_selected.get() || is_active_selection.get() { "selected" } else { "" } attr:data-state=move || if is_selected.get() || is_active_selection.get() { "selected" } else { "" }
on:click=move |_| store.selected_torrent.set(Some(stored_hash.get_value())) on:click=move |_| store.selected_torrent.set(Some(stored_hash.get_value()))
> >
<DataTableCell class="w-12 px-4"> <DataTableCell class="w-12">
<Checkbox <Checkbox
checked=is_selected checked=is_selected
on_checked_change=on_select on_checked_change=on_select
@@ -295,7 +294,7 @@ fn TorrentRow(
</DataTableCell> </DataTableCell>
<DataTableCell> <DataTableCell>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<div class="h-1.5 w-full bg-secondary rounded-full overflow-hidden"> <div class="h-1.5 w-full bg-secondary rounded-full overflow-hidden min-w-[80px]">
<div class="h-full bg-primary transition-all duration-500" style=format!("width: {}%", t.percent_complete)></div> <div class="h-full bg-primary transition-all duration-500" style=format!("width: {}%", t.percent_complete)></div>
</div> </div>
<span class="text-[10px] text-muted-foreground w-10 text-right">{format!("{:.1}%", t.percent_complete)}</span> <span class="text-[10px] text-muted-foreground w-10 text-right">{format!("{:.1}%", t.percent_complete)}</span>
@@ -392,4 +391,4 @@ fn TorrentCard(
} }
</Show> </Show>
}.into_any() }.into_any()
} }

View File

@@ -202,7 +202,7 @@ pub fn ContextMenuTrigger(
#[prop(optional)] on_open: Option<Callback<()>>, #[prop(optional)] on_open: Option<Callback<()>>,
) -> impl IntoView { ) -> impl IntoView {
let ctx = expect_context::<ContextMenuContext>(); let ctx = expect_context::<ContextMenuContext>();
let trigger_class = tw_merge!("block w-full h-full", class); let trigger_class = tw_merge!("contents", class);
view! { view! {
<div <div