feat: implement collapsible desktop sidebar and fix all compilation errors across the project
Some checks failed
Build MIPS Binary / build (push) Failing after 31s

This commit is contained in:
spinline
2026-02-14 01:30:52 +03:00
parent d11c9d5f58
commit ee87ded509
4 changed files with 124 additions and 263 deletions

View File

@@ -1,4 +1,4 @@
use crate::components::layout::protected::Protected;
use crate::components::layout::protected::ProtectedLayout;
use crate::components::ui::skeleton::Skeleton;
use crate::components::torrent::table::TorrentTable;
use crate::components::auth::login::Login;
@@ -50,13 +50,11 @@ fn InnerApp() -> impl IntoView {
Effect::new(move |_| {
spawn_local(async move {
log::info!("App initialization started...");
gloo_console::log!("APP INIT: Checking setup status...");
// Check if setup is needed via Server Function
match shared::server_fns::auth::get_setup_status().await {
Ok(status) => {
if !status.completed {
log::info!("Setup not completed");
needs_setup.1.set(true);
is_loading.1.set(false);
return;
@@ -68,7 +66,6 @@ fn InnerApp() -> impl IntoView {
// Check authentication via GetUser Server Function
match shared::server_fns::auth::get_user().await {
Ok(Some(user_info)) => {
log::info!("Authenticated as {}", user_info.username);
if let Some(s) = store {
s.user.set(Some(user_info.username));
}
@@ -83,7 +80,6 @@ fn InnerApp() -> impl IntoView {
}
is_loading.1.set(false);
crate::store::toast_success("VibeTorrent'e Hoşgeldiniz");
});
});
@@ -99,11 +95,14 @@ fn InnerApp() -> impl IntoView {
}
});
let is_loading_val = move || is_loading.0.get();
let authenticated_val = move || is_authenticated.0.get();
view! {
<div class="relative w-full h-screen" style="height: 100dvh;">
<Routes fallback=|| view! { <div class="p-4">"404 Not Found"</div> }>
<Route path=leptos_router::path!("/login") view=move || {
let authenticated = is_authenticated.0.get();
let authenticated = authenticated_val();
let setup_needed = needs_setup.0.get();
Effect::new(move |_| {
@@ -111,7 +110,6 @@ fn InnerApp() -> impl IntoView {
let navigate = use_navigate();
navigate("/setup", Default::default());
} else if authenticated {
log::info!("Already authenticated, redirecting to home");
let navigate = use_navigate();
navigate("/", Default::default());
}
@@ -121,7 +119,7 @@ fn InnerApp() -> impl IntoView {
} />
<Route path=leptos_router::path!("/setup") view=move || {
Effect::new(move |_| {
if is_authenticated.0.get() {
if authenticated_val() {
let navigate = use_navigate();
navigate("/", Default::default());
}
@@ -133,71 +131,54 @@ fn InnerApp() -> impl IntoView {
<Route path=leptos_router::path!("/") view=move || {
let navigate = use_navigate();
Effect::new(move |_| {
if !is_loading.0.get() {
if !is_loading_val() {
if needs_setup.0.get() {
log::info!("Setup not completed, redirecting to setup");
navigate("/setup", Default::default());
} else if !is_authenticated.0.get() {
log::info!("Not authenticated, redirecting to login");
} else if !authenticated_val() {
navigate("/login", Default::default());
}
}
});
view! {
<Show when=move || !is_loading.0.get() fallback=|| {
// Standard 1: Always show Dashboard Skeleton
<Show when=move || !is_loading_val() fallback=|| {
view! {
<div class="flex h-screen bg-background text-foreground overflow-hidden">
// Sidebar skeleton
<div class="w-56 border-r border-border p-4 space-y-4">
<Skeleton class="h-8 w-3/4" />
<div class="space-y-2">
<Skeleton class="h-6 w-full" />
<Skeleton class="h-6 w-full" />
<Skeleton class="h-6 w-4/5" />
<Skeleton class="h-6 w-full" />
<Skeleton class="h-6 w-3/5" />
<Skeleton class="h-6 w-full" />
</div>
</div>
// Main content skeleton
<div class="flex-1 flex flex-col min-w-0">
<div class="border-b border-border p-4 flex items-center gap-4">
<Skeleton class="h-8 w-48" />
<Skeleton class="h-8 w-64" />
<div class="ml-auto"><Skeleton class="h-8 w-24" /></div>
</div>
<div class="flex-1 p-4 space-y-3">
<Skeleton class="h-10 w-full" />
<Skeleton class="h-10 w-full" />
<Skeleton class="h-10 w-full" />
<Skeleton class="h-10 w-full" />
<Skeleton class="h-10 w-full" />
<Skeleton class="h-10 w-3/4" />
</div>
<div class="border-t border-border p-3">
<Skeleton class="h-5 w-96" />
</div>
</div>
</div>
}.into_any()
}
}>
<Show when=move || is_authenticated.0.get() fallback=|| ()>
<Protected>
<Show when=move || authenticated_val() fallback=|| ()>
<ProtectedLayout>
<div class="flex flex-col h-full overflow-hidden">
<div class="flex-1 overflow-hidden">
<TorrentTable />
</div>
</div>
</Protected>
</ProtectedLayout>
</Show>
</Show>
}.into_any()
}
}/>
<Route path=leptos_router::path!("/settings") view=move || {
let authenticated = is_authenticated.0.get();
let authenticated = authenticated_val();
Effect::new(move |_| {
if !authenticated {
let navigate = use_navigate();
@@ -206,11 +187,11 @@ fn InnerApp() -> impl IntoView {
});
view! {
<Show when=move || !is_loading.0.get() fallback=|| ()>
<Show when=move || authenticated fallback=|| ()>
<Protected>
<Show when=move || !is_loading_val() fallback=|| ()>
<Show when=move || authenticated_val() fallback=|| ()>
<ProtectedLayout>
<div class="p-4">"Settings Page (Coming Soon)"</div>
</Protected>
</ProtectedLayout>
</Show>
</Show>
}