From 9a3aae3f37bc84d602bfc033cf2d45b13e04964a Mon Sep 17 00:00:00 2001 From: spinline Date: Mon, 9 Feb 2026 20:18:50 +0300 Subject: [PATCH] refactor(frontend): partial fix for Leptos 0.8 migration (imports, view types) --- backend_log.txt | 0 frontend/src/app.rs | 9 ++++--- frontend/src/components/auth/login.rs | 5 +++- frontend/src/components/auth/setup.rs | 5 +++- frontend/src/components/context_menu.rs | 5 +++- frontend/src/components/layout/protected.rs | 5 +++- frontend/src/components/layout/sidebar.rs | 5 +++- frontend/src/components/layout/statusbar.rs | 7 ++++-- frontend/src/components/layout/toolbar.rs | 5 +++- frontend/src/components/modal.rs | 5 +++- frontend/src/components/toast.rs | 13 +++++++---- .../src/components/torrent/add_torrent.rs | 9 ++++--- frontend/src/components/torrent/table.rs | 22 +++++++++++------- frontend/src/lib.rs | 3 ++- frontend/src/store.rs | 4 +++- vibetorrent.db | Bin 0 -> 28672 bytes vibetorrent.db-shm | Bin 0 -> 32768 bytes vibetorrent.db-wal | Bin 0 -> 78312 bytes 18 files changed, 71 insertions(+), 31 deletions(-) create mode 100644 backend_log.txt create mode 100644 vibetorrent.db create mode 100644 vibetorrent.db-shm create mode 100644 vibetorrent.db-wal diff --git a/backend_log.txt b/backend_log.txt new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app.rs b/frontend/src/app.rs index 252cbd5..f9d8b7e 100644 --- a/frontend/src/app.rs +++ b/frontend/src/app.rs @@ -4,8 +4,11 @@ use crate::components::torrent::table::TorrentTable; use crate::components::auth::login::Login; use crate::components::auth::setup::Setup; use crate::api; -use leptos::*; -use leptos_router::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::task::spawn_local; +use leptos_router::components::{Router, Routes, Route}; +use leptos_router::hooks::use_navigate; #[component] pub fn App() -> impl IntoView { @@ -89,7 +92,7 @@ pub fn App() -> impl IntoView { view! {
- + } /> } /> diff --git a/frontend/src/components/auth/login.rs b/frontend/src/components/auth/login.rs index ce8a900..ec99c18 100644 --- a/frontend/src/components/auth/login.rs +++ b/frontend/src/components/auth/login.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use crate::api; #[component] diff --git a/frontend/src/components/auth/setup.rs b/frontend/src/components/auth/setup.rs index ca6d2e9..8a22835 100644 --- a/frontend/src/components/auth/setup.rs +++ b/frontend/src/components/auth/setup.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use crate::api; #[component] diff --git a/frontend/src/components/context_menu.rs b/frontend/src/components/context_menu.rs index 9abf309..98db3ef 100644 --- a/frontend/src/components/context_menu.rs +++ b/frontend/src/components/context_menu.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use leptos_use::on_click_outside; #[component] diff --git a/frontend/src/components/layout/protected.rs b/frontend/src/components/layout/protected.rs index ef3e4b2..ca9e20a 100644 --- a/frontend/src/components/layout/protected.rs +++ b/frontend/src/components/layout/protected.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use crate::components::layout::sidebar::Sidebar; use crate::components::layout::statusbar::StatusBar; use crate::components::layout::toolbar::Toolbar; diff --git a/frontend/src/components/layout/sidebar.rs b/frontend/src/components/layout/sidebar.rs index cfd73c7..7a078cd 100644 --- a/frontend/src/components/layout/sidebar.rs +++ b/frontend/src/components/layout/sidebar.rs @@ -1,5 +1,8 @@ use leptos::wasm_bindgen::JsCast; -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use crate::api; #[component] diff --git a/frontend/src/components/layout/statusbar.rs b/frontend/src/components/layout/statusbar.rs index cc20541..a59add9 100644 --- a/frontend/src/components/layout/statusbar.rs +++ b/frontend/src/components/layout/statusbar.rs @@ -1,6 +1,9 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use leptos_use::storage::use_local_storage; -use codee::string::FromToStringCodec; +use ::codee::string::FromToStringCodec; use shared::GlobalLimitRequest; use crate::api; diff --git a/frontend/src/components/layout/toolbar.rs b/frontend/src/components/layout/toolbar.rs index 3471dfd..e6753af 100644 --- a/frontend/src/components/layout/toolbar.rs +++ b/frontend/src/components/layout/toolbar.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; #[component] pub fn Toolbar() -> impl IntoView { diff --git a/frontend/src/components/modal.rs b/frontend/src/components/modal.rs index 05f5746..78f1ae8 100644 --- a/frontend/src/components/modal.rs +++ b/frontend/src/components/modal.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; #[component] pub fn Modal( diff --git a/frontend/src/components/toast.rs b/frontend/src/components/toast.rs index dd79064..16e114b 100644 --- a/frontend/src/components/toast.rs +++ b/frontend/src/components/toast.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use shared::NotificationLevel; // ============================================================================ @@ -29,22 +32,22 @@ fn ToastItem( - }.into_view(), + }.into_any(), NotificationLevel::Success => view! { - }.into_view(), + }.into_any(), NotificationLevel::Warning => view! { - }.into_view(), + }.into_any(), NotificationLevel::Error => view! { - }.into_view(), + }.into_any(), }; view! { diff --git a/frontend/src/components/torrent/add_torrent.rs b/frontend/src/components/torrent/add_torrent.rs index 428fbdd..2b2571e 100644 --- a/frontend/src/components/torrent/add_torrent.rs +++ b/frontend/src/components/torrent/add_torrent.rs @@ -1,4 +1,7 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use leptos::html::Dialog; use crate::store::{show_toast_with_signal, TorrentStore}; use crate::api; @@ -85,9 +88,9 @@ pub fn AddTorrentModal(
diff --git a/frontend/src/components/torrent/table.rs b/frontend/src/components/torrent/table.rs index 134f995..d8083c9 100644 --- a/frontend/src/components/torrent/table.rs +++ b/frontend/src/components/torrent/table.rs @@ -1,8 +1,12 @@ -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::html; +use leptos::task::spawn_local; use leptos_use::{on_click_outside, use_timeout_fn}; -use crate::store::{get_action_messages, show_toast_with_signal}; +use crate::store::{get_action_messages, show_toast_with_signal, FilterStatus, TorrentStore}; use crate::api; -use shared::NotificationLevel; +use shared::{NotificationLevel, Torrent}; +use std::collections::HashMap; fn format_bytes(bytes: i64) -> String { const UNITS: [&str; 6] = ["B", "KB", "MB", "GB", "TB", "PB"]; @@ -180,10 +184,10 @@ pub fn TorrentTable() -> impl IntoView { if sort_col.get() == col { match sort_dir.get() { SortDirection::Ascending => { - view! { "▲" }.into_view() + view! { "▲" }.into_any() } SortDirection::Descending => { - view! { "▼" }.into_view() + view! { "▼" }.into_any() } } } else { @@ -378,8 +382,8 @@ pub fn TorrentTable() -> impl IntoView { visible=true position=menu_position.get() torrent_hash=selected_hash.get().unwrap_or_default() - on_close=Callback::from(move |_| set_menu_visible.set(false)) - on_action=Callback::from(on_action) + on_close=Callback::from(move |()| set_menu_visible.set(false)) + on_action=Callback::from(move |args| on_action(args)) /> @@ -391,7 +395,7 @@ fn TorrentRow( hash: String, selected_hash: ReadSignal>, set_selected_hash: WriteSignal>, - on_context_menu: impl Fn(web_sys::MouseEvent, String) + 'static + Clone, + on_context_menu: impl Fn(web_sys::MouseEvent, String) + 'static + Clone + Send + Sync, ) -> impl IntoView { let store = use_context::().expect("store not provided"); @@ -474,7 +478,7 @@ fn TorrentCard( set_selected_hash: WriteSignal>, set_menu_position: WriteSignal<(i32, i32)>, set_menu_visible: WriteSignal, - on_context_menu: impl Fn(web_sys::MouseEvent, String) + 'static + Clone, + on_context_menu: impl Fn(web_sys::MouseEvent, String) + 'static + Clone + Send + Sync, ) -> impl IntoView { let store = use_context::().expect("store not provided"); diff --git a/frontend/src/lib.rs b/frontend/src/lib.rs index 35ddb24..234343d 100644 --- a/frontend/src/lib.rs +++ b/frontend/src/lib.rs @@ -4,7 +4,8 @@ pub mod utils; pub mod store; pub mod api; -use leptos::*; +use leptos::prelude::*; +use leptos::mount::mount_to_body; use wasm_bindgen::prelude::*; use app::App; diff --git a/frontend/src/store.rs b/frontend/src/store.rs index efd8a7d..db30016 100644 --- a/frontend/src/store.rs +++ b/frontend/src/store.rs @@ -1,6 +1,8 @@ use futures::StreamExt; use gloo_net::eventsource::futures::EventSource; -use leptos::*; +use leptos::prelude::*; +use leptos::logging; +use leptos::task::spawn_local; use shared::{AppEvent, GlobalStats, NotificationLevel, SystemNotification, Torrent}; #[derive(Clone, Debug, PartialEq)] diff --git a/vibetorrent.db b/vibetorrent.db new file mode 100644 index 0000000000000000000000000000000000000000..5c4baf596d928d4fe2273dea3283b93314a4f218 GIT binary patch literal 28672 zcmeI&&u`mg7zc3MY2wCd7m%1d2}OD(gcQ?d)Tvf!LugG>w~Cr3ZQ`gaFx)IL#9HEH zu>;YNKnXicLU7|caR4NcDi9!c+ljvbBw%9~#0d`5E^Ip>#OpZe>ZD;8PT_0Gzux!t zYd@d&vD3sYY-bExC$BYH^^#4Nm?s#HV^#=Z7>1*Bh|a^wPd8?UJ9Nz++Mcw@F{iFH z=fe*fL3o=v_FnkL{PkmdbDz)GLl@@sP>2>{f&c^{009U<00I#B9|?2?ffqMqw)?DM zR`iZh>1fTiRn@HaMXTI0nzqp}EloEo&4yvx<5i(lUP-75NoQA;^W-sylU$aJcM%=- zE^P$^;=%&EYnLw8bn9}B{#~qD`sKE6mPdDm!Fkn0GNX`@wo$WG*H6+TrJkSXMOkLw zJ>Bnf{N&>$v!0&E>q%4~bTTS5W>r~N@?!)>%w$M0o8B%eZj)yG^m3)@ZQ$0F+V+v<<(6Ku^@>KnGOSX6HNB~jRb?$v z%%~()%;)LZHK(wkCN{SODK#4qcVw375Ar~Zc1_2W4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