feat: use constant dashboard skeleton for all loading states (Standard 1)
All checks were successful
Build MIPS Binary / build (push) Successful in 12m58s

This commit is contained in:
spinline
2026-02-12 23:02:36 +03:00
parent bec804131b
commit 89ad42f24d

View File

@@ -131,51 +131,25 @@ fn InnerApp() -> impl IntoView {
view! { <Setup /> } view! { <Setup /> }
} /> } />
<Route path=leptos_router::path!("/") view=move || { <Route path=leptos_router::path!("/") view=move || {
let navigate = use_navigate(); let navigate = use_navigate();
Effect::new(move |_| { Effect::new(move |_| {
if !is_loading.0.get() { if !is_loading.0.get() {
if needs_setup.0.get() { if needs_setup.0.get() {
log::info!("Setup not completed, redirecting to setup"); log::info!("Setup not completed, redirecting to setup");
navigate("/setup", Default::default()); navigate("/setup", Default::default());
} else if !is_authenticated.0.get() { } else if !is_authenticated.0.get() {
log::info!("Not authenticated, redirecting to login"); log::info!("Not authenticated, redirecting to login");
navigate("/login", Default::default()); navigate("/login", Default::default());
}
} }
} });
});
view! {
view! { <Show when=move || !is_loading.0.get() fallback=|| {
<Show when=move || !is_loading.0.get() fallback=move || { // Standard 1: Always show Dashboard Skeleton
let path = loc.pathname.get();
if path == "/login" {
// Login Skeleton
view! { view! {
<div class="flex items-center justify-center min-h-screen bg-muted/40 px-4"> <div class="flex h-screen bg-background text-foreground overflow-hidden">
<Card class="w-full max-w-sm shadow-lg border-none">
<CardHeader class="pb-2 items-center space-y-4">
<Skeleton class="w-12 h-12 rounded-xl" />
<Skeleton class="h-8 w-32" />
<Skeleton class="h-4 w-48" />
</CardHeader>
<CardContent class="pt-4 space-y-6">
<div class="space-y-2">
<Skeleton class="h-4 w-24" />
<Skeleton class="h-10 w-full" />
</div>
<div class="space-y-2">
<Skeleton class="h-4 w-24" />
<Skeleton class="h-10 w-full" />
</div>
<Skeleton class="h-10 w-full rounded-md mt-4" />
</CardContent>
</Card>
</div>
}.into_any()
} else {
// Dashboard Skeleton
view! {
<div class="flex h-screen bg-background">
// Sidebar skeleton // Sidebar skeleton
<div class="w-56 border-r border-border p-4 space-y-4"> <div class="w-56 border-r border-border p-4 space-y-4">
<Skeleton class="h-8 w-3/4" /> <Skeleton class="h-8 w-3/4" />
@@ -189,7 +163,7 @@ fn InnerApp() -> impl IntoView {
</div> </div>
</div> </div>
// Main content skeleton // Main content skeleton
<div class="flex-1 flex flex-col"> <div class="flex-1 flex flex-col min-w-0">
<div class="border-b border-border p-4 flex items-center gap-4"> <div class="border-b border-border p-4 flex items-center gap-4">
<Skeleton class="h-8 w-48" /> <Skeleton class="h-8 w-48" />
<Skeleton class="h-8 w-64" /> <Skeleton class="h-8 w-64" />
@@ -209,20 +183,19 @@ fn InnerApp() -> impl IntoView {
</div> </div>
</div> </div>
}.into_any() }.into_any()
} }>
}> <Show when=move || is_authenticated.0.get() fallback=|| ()>
<Show when=move || is_authenticated.0.get() fallback=|| ()> <Protected>
<Protected> <div class="flex flex-col h-full overflow-hidden">
<div class="flex flex-col h-full overflow-hidden"> <div class="flex-1 overflow-hidden">
<div class="flex-1 overflow-hidden"> <TorrentTable />
<TorrentTable /> </div>
</div> </div>
</div> </Protected>
</Protected> </Show>
</Show> </Show>
</Show> }.into_any()
}.into_any() }/>
}/>
<Route path=leptos_router::path!("/settings") view=move || { <Route path=leptos_router::path!("/settings") view=move || {
let authenticated = is_authenticated.0.get(); let authenticated = is_authenticated.0.get();