diff --git a/frontend/src/components/torrent/table.rs b/frontend/src/components/torrent/table.rs index 0f9c451..a9f7a7b 100644 --- a/frontend/src/components/torrent/table.rs +++ b/frontend/src/components/torrent/table.rs @@ -171,11 +171,8 @@ pub fn TorrentTable() -> impl IntoView { - - + } } } /> @@ -191,12 +188,9 @@ pub fn TorrentTable() -> impl IntoView { - - - + } } @@ -210,6 +204,7 @@ pub fn TorrentTable() -> impl IntoView { #[component] fn TorrentRow( hash: String, + on_action: Callback<(String, String)>, ) -> impl IntoView { let store = use_context::().expect("store not provided"); let h = hash.clone(); @@ -220,6 +215,7 @@ fn TorrentRow( view! { { + let on_action = on_action.clone(); move || { let t = torrent.get().unwrap(); let t_name = t.name.clone(); @@ -232,53 +228,57 @@ fn TorrentRow( let t_name_for_title = t_name.clone(); let t_name_for_content = t_name.clone(); + let h_for_menu = stored_hash.get_value(); view! { - - - {t_name_for_content} - - - {format_bytes(t.size)} - - -
-
-
+ + + + {t_name_for_content} + + + {format_bytes(t.size)} + + +
+
+
+
+ {format!("{:.1}%", t.percent_complete)}
- {format!("{:.1}%", t.percent_complete)} -
- - - {format!("{:?}", t.status)} - - - {format_speed(t.down_rate)} - - - {format_speed(t.up_rate)} - - - {format_duration(t.eta)} - - - {format_date(t.added_date)} - - + + + {format!("{:?}", t.status)} + + + {format_speed(t.down_rate)} + + + {format_speed(t.up_rate)} + + + {format_duration(t.eta)} + + + {format_date(t.added_date)} + + + }.into_any() } } - } + }.into_any() } #[component] fn TorrentCard( hash: String, + on_action: Callback<(String, String)>, ) -> impl IntoView { let store = use_context::().expect("store not provided"); let h = hash.clone(); @@ -289,53 +289,57 @@ fn TorrentCard( view! { { + let on_action = on_action.clone(); move || { let t = torrent.get().unwrap(); let t_name = t.name.clone(); let status_badge_class = match t.status { shared::TorrentStatus::Seeding => "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-800", shared::TorrentStatus::Downloading => "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 border-blue-200 dark:border-blue-800", shared::TorrentStatus::Paused => "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800", shared::TorrentStatus::Error => "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400 border-red-200 dark:border-red-800", _ => "bg-muted text-muted-foreground" }; + let h_for_menu = stored_hash.get_value(); view! { -
+
- - -
- {t_name.clone()} -
{format!("{:?}", t.status)}
-
-
- -
-
- {format_bytes(t.size)} - {format!("{:.1}%", t.percent_complete)} + on:click=move |_| store.selected_torrent.set(Some(stored_hash.get_value())) + > + + +
+ {t_name.clone()} +
{format!("{:?}", t.status)}
-
-
+ + +
+
+ {format_bytes(t.size)} + {format!("{:.1}%", t.percent_complete)} +
+
+
+
-
-
-
"DL"{format_speed(t.down_rate)}
-
"UP"{format_speed(t.up_rate)}
-
"ETA"{format_duration(t.eta)}
-
"DATE"{format_date(t.added_date)}
-
- -
-
- } +
+
"DL"{format_speed(t.down_rate)}
+
"UP"{format_speed(t.up_rate)}
+
"ETA"{format_duration(t.eta)}
+
"DATE"{format_date(t.added_date)}
+
+ + +
+ + }.into_any() } } - } -} \ No newline at end of file + }.into_any() +} diff --git a/frontend/src/components/ui/context_menu.rs b/frontend/src/components/ui/context_menu.rs index ab0dfed..16dbcca 100644 --- a/frontend/src/components/ui/context_menu.rs +++ b/frontend/src/components/ui/context_menu.rs @@ -202,14 +202,14 @@ pub fn ContextMenuTrigger( #[prop(optional)] on_open: Option>, ) -> impl IntoView { let ctx = expect_context::(); - let trigger_class = tw_merge!("contents", class); + let trigger_class = tw_merge!("block w-full h-full", class); view! {
impl IntoView { let ctx = expect_context::(); - let base_classes = "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md transition-all duration-200 data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data-[state=open]:opacity-100 data-[state=open]:scale-100"; + let base_classes = "fixed z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md transition-all duration-200 data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data-[state=open]:opacity-100 data-[state=open]:scale-100"; let class = tw_merge!(base_classes, class);