refactor(frontend): partial fix for Leptos 0.8 migration (imports, view types)
Some checks failed
Build MIPS Binary / build (push) Failing after 1m23s

This commit is contained in:
spinline
2026-02-09 20:18:50 +03:00
parent e6d00e9d55
commit 9a3aae3f37
18 changed files with 71 additions and 31 deletions

0
backend_log.txt Normal file
View File

View File

@@ -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! {
<div class="relative w-full h-screen" style="height: 100dvh;">
<Router>
<Routes>
<Routes fallback=|| view! { "404 Not Found" }>
<Route path="/login" view=move || view! { <Login /> } />
<Route path="/setup" view=move || view! { <Setup /> } />

View File

@@ -1,4 +1,7 @@
use leptos::*;
use leptos::prelude::*;
use leptos::logging;
use leptos::html;
use leptos::task::spawn_local;
use crate::api;
#[component]

View File

@@ -1,4 +1,7 @@
use leptos::*;
use leptos::prelude::*;
use leptos::logging;
use leptos::html;
use leptos::task::spawn_local;
use crate::api;
#[component]

View File

@@ -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]

View File

@@ -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;

View File

@@ -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]

View File

@@ -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;

View File

@@ -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 {

View File

@@ -1,4 +1,7 @@
use leptos::*;
use leptos::prelude::*;
use leptos::logging;
use leptos::html;
use leptos::task::spawn_local;
#[component]
pub fn Modal(

View File

@@ -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(
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
}.into_view(),
}.into_any(),
NotificationLevel::Success => view! {
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
}.into_view(),
}.into_any(),
NotificationLevel::Warning => view! {
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
</svg>
}.into_view(),
}.into_any(),
NotificationLevel::Error => view! {
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
}.into_view(),
}.into_any(),
};
view! {

View File

@@ -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(
<button class="btn" on:click=handle_close disabled=is_loading>"Cancel"</button>
<button class="btn btn-primary" on:click=handle_submit disabled=is_loading>
{move || if is_loading.get() {
view! { <span class="loading loading-spinner"></span> "Adding..." }.into_view()
leptos::either::Either::Left(view! { <span class="loading loading-spinner"></span> "Adding..." })
} else {
view! { "Add" }.into_view()
leptos::either::Either::Right(view! { "Add" })
}}
</button>
</div>

View File

@@ -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! { <span class="ml-1 text-xs">""</span> }.into_view()
view! { <span class="ml-1 text-xs">""</span> }.into_any()
}
SortDirection::Descending => {
view! { <span class="ml-1 text-xs">""</span> }.into_view()
view! { <span class="ml-1 text-xs">""</span> }.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))
/>
</Show>
</div>
@@ -391,7 +395,7 @@ fn TorrentRow(
hash: String,
selected_hash: ReadSignal<Option<String>>,
set_selected_hash: WriteSignal<Option<String>>,
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::<crate::store::TorrentStore>().expect("store not provided");
@@ -474,7 +478,7 @@ fn TorrentCard(
set_selected_hash: WriteSignal<Option<String>>,
set_menu_position: WriteSignal<(i32, i32)>,
set_menu_visible: WriteSignal<bool>,
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::<crate::store::TorrentStore>().expect("store not provided");

View File

@@ -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;

View File

@@ -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)]

BIN
vibetorrent.db Normal file

Binary file not shown.

BIN
vibetorrent.db-shm Normal file

Binary file not shown.

BIN
vibetorrent.db-wal Normal file

Binary file not shown.