Compare commits

...

17 Commits

Author SHA1 Message Date
spinline
c0bb920409 fix: resolve AddTorrent component import and type inference issues
All checks were successful
Build MIPS Binary / build (push) Successful in 1m53s
2026-02-14 01:35:57 +03:00
spinline
1a5f22d302 fix: resolve persistent type inference error in Toolbar component
Some checks failed
Build MIPS Binary / build (push) Failing after 36s
2026-02-14 01:34:39 +03:00
spinline
2988641162 fix: resolve type inference in toolbar and cleanup unused imports in sidenav
Some checks failed
Build MIPS Binary / build (push) Failing after 42s
2026-02-14 01:33:22 +03:00
spinline
bc46999975 fix: resolve type inference errors in app.rs and silence unused variable warnings in context menu
Some checks failed
Build MIPS Binary / build (push) Failing after 31s
2026-02-14 01:32:05 +03:00
spinline
ee87ded509 feat: implement collapsible desktop sidebar and fix all compilation errors across the project
Some checks failed
Build MIPS Binary / build (push) Failing after 31s
2026-02-14 01:30:52 +03:00
spinline
d11c9d5f58 chore: silence unused Icon variant warning in SidenavCollapsible
All checks were successful
Build MIPS Binary / build (push) Successful in 1m52s
2026-02-14 01:27:50 +03:00
spinline
3ce980239c fix: ensure context menu closes after triggering start or stop actions
All checks were successful
Build MIPS Binary / build (push) Successful in 1m51s
2026-02-14 01:25:47 +03:00
spinline
d00fc41010 style: update CSS configuration and theme variables
All checks were successful
Build MIPS Binary / build (push) Successful in 1m55s
2026-02-13 20:11:02 +03:00
spinline
0636020a86 chore: re-add Leptos metadata to Cargo.toml for ui-cli compatibility
All checks were successful
Build MIPS Binary / build (push) Successful in 1m52s
2026-02-13 20:03:01 +03:00
spinline
322e0ab4a3 fix: make torrent status bar visible on mobile
All checks were successful
Build MIPS Binary / build (push) Successful in 1m52s
2026-02-13 14:05:07 +03:00
spinline
89f0a5423d style: make footer even more minimal and elegant
Some checks failed
Build MIPS Binary / build (push) Has been cancelled
2026-02-13 14:03:54 +03:00
spinline
80f9e5cda2 fix: resolve race condition in ButtonAction using a generation counter for safety
All checks were successful
Build MIPS Binary / build (push) Successful in 1m52s
2026-02-13 13:50:47 +03:00
spinline
a12265573c fix: resolve type mismatch between Mouse and Touch events in ButtonAction
All checks were successful
Build MIPS Binary / build (push) Successful in 1m51s
2026-02-13 13:44:15 +03:00
spinline
e45ec46793 feat: replace legacy hold-to-delete logic with modern ButtonAction component
Some checks failed
Build MIPS Binary / build (push) Failing after 34s
2026-02-13 13:41:46 +03:00
spinline
0e075d6092 feat: implement high-performance CSS-based ButtonAction component
Some checks failed
Build MIPS Binary / build (push) Failing after 34s
2026-02-13 13:39:53 +03:00
spinline
dbbc722f50 perf: refactor hold-to-action animation using CSS for silky-smooth performance
Some checks failed
Build MIPS Binary / build (push) Failing after 35s
2026-02-13 13:32:40 +03:00
spinline
dd3b3f3504 fix: resolve all compilation errors in push notification logic and stabilize UI components
All checks were successful
Build MIPS Binary / build (push) Successful in 1m51s
2026-02-13 13:26:22 +03:00
21 changed files with 797 additions and 531 deletions

3
Cargo.lock generated
View File

@@ -320,9 +320,11 @@ dependencies = [
"dotenvy", "dotenvy",
"futures", "futures",
"governor", "governor",
"icons",
"jsonwebtoken", "jsonwebtoken",
"leptos", "leptos",
"leptos_axum", "leptos_axum",
"leptos_ui",
"mime_guess", "mime_guess",
"openssl", "openssl",
"quick-xml", "quick-xml",
@@ -343,6 +345,7 @@ dependencies = [
"tower_governor", "tower_governor",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"tw_merge",
"utoipa", "utoipa",
"utoipa-swagger-ui", "utoipa-swagger-ui",
"web-push", "web-push",

View File

@@ -2,6 +2,9 @@
members = ["backend", "frontend", "shared"] members = ["backend", "frontend", "shared"]
resolver = "2" resolver = "2"
[[workspace.metadata.leptos]]
tailwind-input-file = "frontend/input.css"
[profile.release] [profile.release]
# En küçük binary boyutu # En küçük binary boyutu
opt-level = "z" opt-level = "z"

View File

@@ -46,4 +46,7 @@ governor = "0.10.4"
# Leptos # Leptos
leptos = { version = "0.8.15", features = ["nightly"] } leptos = { version = "0.8.15", features = ["nightly"] }
leptos_axum = { version = "0.8.7" } leptos_axum = { version = "0.8.7" }
jsonwebtoken = "9" jsonwebtoken = "9"
tw_merge = { version = "0.1.17", features = ["variant"] }
icons = { version = "0.18.0", features = ["leptos"] }
leptos_ui = "0.3.20"

View File

@@ -3,70 +3,69 @@
:root { :root {
--background: 0 0% 100%; --radius: 0.625rem;
--foreground: 240 10% 3.9%; --background: oklch(1 0 0);
--card: 0 0% 100%; --foreground: oklch(0.145 0 0);
--card-foreground: 240 10% 3.9%; --card: oklch(1 0 0);
--popover: 0 0% 100%; --card-foreground: oklch(0.145 0 0);
--popover-foreground: 240 10% 3.9%; --popover: oklch(1 0 0);
--primary: 240 5.9% 10%; --popover-foreground: oklch(0.145 0 0);
--primary-foreground: 0 0% 98%; --primary: oklch(0.205 0 0);
--secondary: 240 4.8% 95.9%; --primary-foreground: oklch(0.985 0 0);
--secondary-foreground: 240 5.9% 10%; --secondary: oklch(0.97 0 0);
--muted: 240 4.8% 95.9%; --secondary-foreground: oklch(0.205 0 0);
--muted-foreground: 240 3.8% 46.1%; --muted: oklch(0.97 0 0);
--accent: 240 4.8% 95.9%; --muted-foreground: oklch(0.556 0 0);
--accent-foreground: 240 5.9% 10%; --accent: oklch(0.97 0 0);
--destructive: 0 84.2% 60.2%; --accent-foreground: oklch(0.205 0 0);
--destructive-foreground: 0 0% 98%; --destructive: oklch(0.577 0.245 27.325);
--border: 240 5.9% 90%; --border: oklch(0.922 0 0);
--input: 240 5.9% 90%; --input: oklch(0.922 0 0);
--ring: 240 5.9% 10%; --ring: oklch(0.708 0 0);
--radius: 0.5rem;
} }
.dark { .dark {
--background: 240 10% 3.9%; --background: oklch(0.145 0 0);
--foreground: 0 0% 98%; --foreground: oklch(0.985 0 0);
--card: 240 10% 3.9%; --card: oklch(0.205 0 0);
--card-foreground: 0 0% 98%; --card-foreground: oklch(0.985 0 0);
--popover: 240 10% 3.9%; --popover: oklch(0.205 0 0);
--popover-foreground: 0 0% 98%; --popover-foreground: oklch(0.985 0 0);
--primary: 0 0% 98%; --primary: oklch(0.922 0 0);
--primary-foreground: 240 5.9% 10%; --primary-foreground: oklch(0.205 0 0);
--secondary: 240 3.7% 15.9%; --secondary: oklch(0.269 0 0);
--secondary-foreground: 0 0% 98%; --secondary-foreground: oklch(0.985 0 0);
--muted: 240 3.7% 15.9%; --muted: oklch(0.269 0 0);
--muted-foreground: 240 5% 64.9%; --muted-foreground: oklch(0.708 0 0);
--accent: 240 3.7% 15.9%; --accent: oklch(0.269 0 0);
--accent-foreground: 0 0% 98%; --accent-foreground: oklch(0.985 0 0);
--destructive: 0 62.8% 30.6%; --destructive: oklch(0.704 0.191 22.216);
--destructive-foreground: 0 0% 98%; --border: oklch(1 0 0 / 10%);
--border: 240 3.7% 15.9%; --input: oklch(1 0 0 / 15%);
--input: 240 3.7% 15.9%; --ring: oklch(0.556 0 0);
--ring: 240 4.9% 83.9%;
} }
@theme inline { @theme inline {
--color-background: hsl(var(--background)); --color-background: var(--background);
--color-foreground: hsl(var(--foreground)); --color-foreground: var(--foreground);
--color-card: hsl(var(--card)); --color-card: var(--card);
--color-card-foreground: hsl(var(--card-foreground)); --color-card-foreground: var(--card-foreground);
--color-popover: hsl(var(--popover)); --color-popover: var(--popover);
--color-popover-foreground: hsl(var(--popover-foreground)); --color-popover-foreground: var(--popover-foreground);
--color-primary: hsl(var(--primary)); --color-primary: var(--primary);
--color-primary-foreground: hsl(var(--primary-foreground)); --color-primary-foreground: var(--primary-foreground);
--color-secondary: hsl(var(--secondary)); --color-secondary: var(--secondary);
--color-secondary-foreground: hsl(var(--secondary-foreground)); --color-secondary-foreground: var(--secondary-foreground);
--color-muted: hsl(var(--muted)); --color-muted: var(--muted);
--color-muted-foreground: hsl(var(--muted-foreground)); --color-muted-foreground: var(--muted-foreground);
--color-accent: hsl(var(--accent)); --color-accent: var(--accent);
--color-accent-foreground: hsl(var(--accent-foreground)); --color-accent-foreground: var(--accent-foreground);
--color-destructive: hsl(var(--destructive)); --color-destructive: var(--destructive);
--color-destructive-foreground: hsl(var(--destructive-foreground)); --color-destructive-foreground: var(--destructive-foreground);
--color-border: hsl(var(--border)); --color-border: var(--border);
--color-input: hsl(var(--input)); --color-input: var(--input);
--color-ring: hsl(var(--ring)); --color-ring: var(--ring);
--radius-sm: calc(var(--radius) - 4px); --radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px); --radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius); --radius-lg: var(--radius);

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

View File

@@ -1,5 +1,9 @@
use leptos::prelude::*; use leptos::prelude::*;
use crate::components::ui::context_menu::*; use crate::components::ui::context_menu::{
ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger,
};
use crate::components::ui::button_action::ButtonAction;
use crate::components::ui::button::ButtonVariant;
#[component] #[component]
pub fn TorrentContextMenu( pub fn TorrentContextMenu(
@@ -7,72 +11,61 @@ pub fn TorrentContextMenu(
torrent_hash: String, torrent_hash: String,
on_action: Callback<(String, String)>, on_action: Callback<(String, String)>,
) -> impl IntoView { ) -> impl IntoView {
let hash = StoredValue::new(torrent_hash); let hash_c1 = torrent_hash.clone();
let hash_c2 = torrent_hash.clone();
let hash_c3 = torrent_hash.clone();
let hash_c4 = torrent_hash.clone();
let menu_action = move |action: &'static str| { let on_action_stored = StoredValue::new(on_action);
on_action.run((action.to_string(), hash.get_value()));
};
view! { view! {
<ContextMenu> <ContextMenu>
<ContextMenuTrigger> <ContextMenuTrigger>
{children()} {children()}
</ContextMenuTrigger> </ContextMenuTrigger>
<ContextMenuContent class="w-56 p-1.5">
<ContextMenuContent class="w-56"> <ContextMenuItem on:click={let h = hash_c1; move |_| {
<ContextMenuAction on_action_stored.get_value().run(("start".to_string(), h.clone()));
class="px-2 py-1.5 hover:bg-accent hover:text-accent-foreground rounded-sm" crate::components::ui::context_menu::close_context_menu();
on:click=move |_| menu_action("start") }}>
> "Başlat"
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 h-4 w-4 opacity-70"> </ContextMenuItem>
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" /> <ContextMenuItem on:click={let h = hash_c2; move |_| {
</svg> on_action_stored.get_value().run(("stop".to_string(), h.clone()));
"Start" crate::components::ui::context_menu::close_context_menu();
</ContextMenuAction> }}>
"Durdur"
</ContextMenuItem>
<div class="my-1.5 h-px bg-border/50" />
// --- Modern Hold-to-Action Buttons ---
<div class="space-y-1">
<ButtonAction
variant=ButtonVariant::Ghost
class="w-full justify-start h-8 px-2 text-xs text-destructive hover:bg-destructive/10 hover:text-destructive transition-none"
hold_duration=800
on_action={let h = hash_c3; move || {
on_action_stored.get_value().run(("delete".to_string(), h.clone()));
crate::components::ui::context_menu::close_context_menu();
}}
>
"Sil (Basılı Tut)"
</ButtonAction>
<ContextMenuAction <ButtonAction
class="px-2 py-1.5 hover:bg-accent hover:text-accent-foreground rounded-sm" variant=ButtonVariant::Destructive
on:click=move |_| menu_action("stop") class="w-full justify-start h-8 px-2 text-xs font-bold"
> hold_duration=1200
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 h-4 w-4 opacity-70"> on_action={let h = hash_c4; move || {
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25v13.5m-7.5-13.5v13.5" /> on_action_stored.get_value().run(("delete_with_data".to_string(), h.clone()));
</svg> crate::components::ui::context_menu::close_context_menu();
"Stop" }}
</ContextMenuAction> >
"Verilerle Sil (Basılı Tut)"
<ContextMenuAction </ButtonAction>
class="px-2 py-1.5 hover:bg-accent hover:text-accent-foreground rounded-sm" </div>
on:click=move |_| menu_action("recheck")
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 h-4 w-4 opacity-70">
<path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99" />
</svg>
"Recheck"
</ContextMenuAction>
<div class="-mx-1 my-1 h-px bg-border" />
<ContextMenuAction
class="px-2 py-1.5 text-destructive hover:bg-destructive/10 hover:text-destructive rounded-sm"
on:click=move |_| menu_action("delete")
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 h-4 w-4 opacity-70">
<path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.164h-2.34c-1.18 0-2.09.984-2.09 2.164v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
</svg>
"Remove"
</ContextMenuAction>
<ContextMenuHoldAction
class="text-destructive hover:bg-destructive/10 hover:text-destructive"
on_hold_complete=move |_| menu_action("delete_with_data")
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 h-4 w-4 opacity-70">
<path stroke-linecap="round" stroke-linejoin="round" d="M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5m6 4.125l2.25 2.25m0 0l2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25-2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z" />
</svg>
"Remove with Data"
<span class="ml-auto text-[10px] opacity-50">"Hold"</span>
</ContextMenuHoldAction>
</ContextMenuContent> </ContextMenuContent>
</ContextMenu> </ContextMenu>
} }
} }

View File

@@ -6,24 +6,12 @@ pub fn Footer() -> impl IntoView {
let year = chrono::Local::now().format("%Y").to_string(); let year = chrono::Local::now().format("%Y").to_string();
view! { view! {
<footer class="mt-auto px-4 py-6 md:px-8"> <footer class="mt-auto pb-6 px-4">
<Separator class="mb-6 opacity-50" /> <Separator class="mb-4 opacity-30" />
<div class="flex flex-col items-center justify-between gap-4 md:flex-row"> <div class="flex items-center justify-center gap-2 text-[10px] uppercase tracking-widest text-muted-foreground/60 font-medium">
<p class="text-center text-sm leading-loose text-muted-foreground md:text-left"> <span>{format!("© {} VibeTorrent", year)}</span>
{format!("© {} VibeTorrent. Tüm hakları saklıdır.", year)} <span class="size-1 rounded-full bg-muted-foreground/30" />
</p> <span>"v3.0.0-beta"</span>
<div class="flex items-center gap-4 text-sm font-medium text-muted-foreground">
<a
href="https://git.karatatar.com/admin/vibetorrent"
target="_blank"
rel="noreferrer"
class="underline underline-offset-4 hover:text-foreground transition-colors"
>
"Gitea"
</a>
<span class="size-1 rounded-full bg-muted-foreground/30" />
<span class="text-[10px] tracking-widest uppercase opacity-70">"v3.0.0-beta"</span>
</div>
</div> </div>
</footer> </footer>
} }

View File

@@ -1,29 +1,22 @@
use leptos::prelude::*; use leptos::prelude::*;
use crate::components::layout::sidebar::Sidebar; use crate::components::layout::sidebar::Sidebar;
use crate::components::layout::toolbar::Toolbar; use crate::components::layout::toolbar::Toolbar;
use crate::components::layout::footer::Footer; use crate::components::ui::sidenav::{SidenavWrapper, Sidenav, SidenavInset, SidenavState};
use crate::components::ui::sidenav::{SidenavWrapper, Sidenav, SidenavInset};
#[component] #[component]
pub fn Protected(children: Children) -> impl IntoView { pub fn ProtectedLayout(children: Children) -> impl IntoView {
let sidenav_state = RwSignal::new(SidenavState::Expanded);
view! { view! {
<SidenavWrapper attr:style="--sidenav-width:16rem; --sidenav-width-icon:3rem;"> <SidenavWrapper attr:style="--sidenav-width:16rem; --sidenav-width-icon:3rem;">
// Masaüstü Sidenav <Sidenav data_state=Signal::from(sidenav_state)>
<Sidenav>
<Sidebar /> <Sidebar />
</Sidenav> </Sidenav>
// İçerik Alanı
<SidenavInset class="flex flex-col h-screen overflow-hidden"> <SidenavInset class="flex flex-col h-screen overflow-hidden">
// Toolbar (Üst Bar) <Toolbar sidenav_state=sidenav_state />
<Toolbar /> <main class="flex-1 overflow-auto bg-muted/30">
{children()}
// Ana İçerik
<main class="flex-1 overflow-y-auto relative bg-background flex flex-col">
<div class="flex-1">
{children()}
</div>
<Footer />
</main> </main>
</SidenavInset> </SidenavInset>
</SidenavWrapper> </SidenavWrapper>

View File

@@ -146,48 +146,50 @@ pub fn Sidebar() -> impl IntoView {
</SidenavGroup> </SidenavGroup>
</SidenavContent> </SidenavContent>
<SidenavFooter class="p-4 space-y-4"> <SidenavFooter>
// Push Notification Toggle <div class="flex flex-col gap-4 p-4">
<div class="flex items-center justify-between px-2 py-1 bg-muted/20 rounded-md border border-border/50"> // Push Notification Toggle
<div class="flex flex-col gap-0.5"> <div class="flex items-center justify-between px-2 py-1 bg-muted/20 rounded-md border border-border/50">
<span class="text-[10px] font-bold uppercase tracking-wider text-foreground/70">"Bildirimler"</span> <div class="flex flex-col gap-0.5">
<span class="text-[9px] text-muted-foreground">"Web Push"</span> <span class="text-[10px] font-bold uppercase tracking-wider text-foreground/70">"Bildirimler"</span>
<span class="text-[9px] text-muted-foreground">"Web Push"</span>
</div>
<Switch
checked=Signal::from(store.push_enabled)
on_checked_change=Callback::new(on_push_toggle)
/>
</div> </div>
<Switch
checked=store.push_enabled.into()
on_checked_change=Callback::new(on_push_toggle)
/>
</div>
<div class="flex items-center gap-3 p-2 rounded-lg border bg-muted/30 shadow-xs overflow-hidden"> <div class="flex items-center gap-3 p-2 rounded-lg border bg-muted/30 shadow-xs overflow-hidden">
<div class="h-8 w-8 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-medium shrink-0 border border-primary-foreground/10"> <div class="h-8 w-8 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-medium shrink-0 border border-primary-foreground/10">
{first_letter} {first_letter}
</div> </div>
<div class="flex-1 overflow-hidden"> <div class="flex-1 overflow-hidden">
<div class="font-medium text-[11px] truncate text-foreground leading-tight">{username}</div> <div class="font-medium text-[11px] truncate text-foreground leading-tight">{username}</div>
<div class="text-[9px] text-muted-foreground truncate opacity-70">"Yönetici"</div> <div class="text-[9px] text-muted-foreground truncate opacity-70">"Yönetici"</div>
</div> </div>
<div class="flex items-center gap-1">
<ThemeToggle />
<Button <div class="flex items-center gap-1">
variant=ButtonVariant::Ghost <ThemeToggle />
size=ButtonSize::Icon
class="size-7 text-destructive hover:bg-destructive/10" <Button
on:click=move |_| { variant=ButtonVariant::Ghost
spawn_local(async move { size=ButtonSize::Icon
if shared::server_fns::auth::logout().await.is_ok() { class="size-7 text-destructive hover:bg-destructive/10"
let window = web_sys::window().expect("window should exist"); on:click=move |_| {
let _ = window.location().set_href("/login"); spawn_local(async move {
} if shared::server_fns::auth::logout().await.is_ok() {
}); let window = web_sys::window().expect("window should exist");
} let _ = window.location().set_href("/login");
> }
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4"> });
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75" /> }
</svg> >
</Button> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75" />
</svg>
</Button>
</div>
</div> </div>
</div> </div>
</SidenavFooter> </SidenavFooter>

View File

@@ -1,55 +1,24 @@
use leptos::prelude::*; use leptos::prelude::*;
use icons::{PanelLeft, Plus}; use crate::components::ui::sidenav::{SidenavTrigger, SidenavState};
use crate::components::torrent::add_torrent::AddTorrentDialogContent; use crate::components::torrent::add_torrent::AddTorrent;
use crate::components::ui::button::{ButtonVariant, ButtonSize};
use crate::components::ui::sheet::{Sheet, SheetContent, SheetTrigger, SheetDirection};
use crate::components::ui::dialog::{Dialog, DialogContent, DialogTrigger};
use crate::components::layout::sidebar::Sidebar;
#[component] #[component]
pub fn Toolbar() -> impl IntoView { pub fn Toolbar(
view! { sidenav_state: RwSignal<SidenavState>
<div class="flex min-h-14 h-auto items-center border-b border-border bg-background px-4" style="padding-top: env(safe-area-inset-top);"> ) -> impl IntoView {
// Sol kısım: Menü butonu (Mobil) + Add Torrent let header_view = view! {
<div class="flex items-center gap-3"> <header class="h-14 border-b bg-background/95 backdrop-blur-sm flex items-center justify-between px-4 sticky top-0 z-30">
<div class="flex items-center gap-4">
// --- MOBILE SHEET (SIDEBAR) --- <SidenavTrigger data_state=sidenav_state />
<div class="lg:hidden"> <div class="h-4 w-px bg-border hidden md:block"></div>
<Sheet> <h2 class="text-sm font-semibold tracking-tight">"Torrents"</h2>
<SheetTrigger variant=ButtonVariant::Ghost size=ButtonSize::Icon class="size-9">
<PanelLeft class="size-5" />
<span class="hidden">"Menüyü Aç"</span>
</SheetTrigger>
<SheetContent
direction=SheetDirection::Left
class="p-0 w-[18rem] bg-card border-r border-border"
hide_close_button=true
>
<div class="flex flex-col h-full overflow-hidden">
<Sidebar />
</div>
</SheetContent>
</Sheet>
</div>
<Dialog>
<DialogTrigger
variant=ButtonVariant::Default
class="gap-2"
>
<Plus class="w-4 h-4 md:w-5 md:h-5" />
<span class="hidden sm:inline">"Add Torrent"</span>
<span class="sm:hidden">"Add"</span>
</DialogTrigger>
<DialogContent id="add-torrent-dialog" class="sm:max-w-[425px]">
<AddTorrentDialogContent />
</DialogContent>
</Dialog>
</div> </div>
// Sağ kısım boş <div class="flex items-center gap-2">
<div class="flex flex-1 items-center justify-end gap-2"> <AddTorrent />
</div> </div>
</div> </header>
} };
header_view
} }

View File

@@ -3,10 +3,26 @@ use leptos::task::spawn_local;
use wasm_bindgen::JsCast; use wasm_bindgen::JsCast;
use crate::components::ui::input::{Input, InputType}; use crate::components::ui::input::{Input, InputType};
use crate::api; use crate::api;
use crate::components::ui::button::Button; use crate::components::ui::button::{Button, ButtonVariant};
use crate::components::ui::dialog::{ use crate::components::ui::dialog::{
DialogBody, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose Dialog, DialogTrigger, DialogContent, DialogBody, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose
}; };
use icons::Play;
#[component]
pub fn AddTorrent() -> impl IntoView {
view! {
<Dialog>
<DialogTrigger variant=ButtonVariant::Default class="gap-2">
<Play class="size-4" />
<span class="hidden sm:inline">"Add Torrent"</span>
</DialogTrigger>
<DialogContent id="add-torrent-dialog">
<AddTorrentDialogContent />
</DialogContent>
</Dialog>
}
}
#[component] #[component]
pub fn AddTorrentDialogContent() -> impl IntoView { pub fn AddTorrentDialogContent() -> impl IntoView {

View File

@@ -544,14 +544,14 @@ pub fn TorrentTable() -> impl IntoView {
</div> </div>
</div> </div>
<div class="hidden md:flex items-center justify-between px-2 py-1 text-[11px] text-muted-foreground bg-muted/20 border rounded-md"> <div class="flex items-center justify-between px-2 py-1.5 text-[10px] md:text-[11px] text-muted-foreground bg-muted/20 border rounded-md">
<div class="flex gap-4"> <div class="flex gap-3 md:gap-4">
<span>{move || format!("Toplam: {} torrent", filtered_hashes.get().len())}</span> <span>{move || format!("Toplam: {} torrent", filtered_hashes.get().len())}</span>
<Show when=move || has_selection.get()> <Show when=move || has_selection.get()>
<span class="text-primary font-medium">{move || format!("{} torrent seçili", selected_count.get())}</span> <span class="text-primary font-bold">{move || format!("{} seçili", selected_count.get())}</span>
</Show> </Show>
</div> </div>
<div>"VibeTorrent v3"</div> <div class="opacity-50">"VibeTorrent v3"</div>
</div> </div>
</div> </div>
}.into_any() }.into_any()

View File

@@ -0,0 +1,72 @@
use leptos::prelude::*;
use tailwind_fuse::tw_merge;
use crate::components::ui::button::{Button, ButtonVariant};
#[component]
pub fn ButtonAction(
children: Children,
#[prop(into)] on_action: Callback<()>,
#[prop(optional, into)] class: String,
#[prop(default = 1000)] hold_duration: u64,
#[prop(default = ButtonVariant::Default)] variant: ButtonVariant,
) -> impl IntoView {
let is_holding = RwSignal::new(false);
let generation = StoredValue::new(0u64);
let on_down = move |_| {
generation.update_value(|g| *g += 1);
is_holding.set(true);
};
let on_up = move |_| is_holding.set(false);
Effect::new(move |_| {
if is_holding.get() {
let current_gen = generation.get_value();
leptos::task::spawn_local(async move {
gloo_timers::future::TimeoutFuture::new(hold_duration as u32).await;
// Double validation: Is user still holding AND is it the SAME hold attempt?
if is_holding.get_untracked() && generation.get_value() == current_gen {
on_action.run(());
is_holding.set(false);
}
});
}
});
let merged_class = move || tw_merge!(
"relative overflow-hidden transition-all active:scale-[0.98]",
class.clone()
);
view! {
<style>
"@keyframes button-hold-progress {
from { width: 0%; }
to { width: 100%; }
}
.animate-button-hold {
animation: button-hold-progress var(--button-hold-duration) linear forwards;
}"
</style>
<Button
variant=variant
class=merged_class()
attr:style=format!("--button-hold-duration: {}ms", hold_duration)
on:mousedown=on_down
on:mouseup=on_up
on:mouseleave=on_up
on:touchstart=move |_| is_holding.set(true)
on:touchend=move |_| is_holding.set(false)
>
// Progress Overlay
<Show when=move || is_holding.get()>
<div class="absolute inset-0 bg-white/20 dark:bg-black/20 pointer-events-none animate-button-hold" />
</Show>
<span class="relative z-10 flex items-center justify-center gap-2">
{children()}
</span>
</Button>
}
}

View File

@@ -78,76 +78,6 @@ pub fn ContextMenuAction(
} }
} }
#[component]
pub fn ContextMenuHoldAction(
children: Children,
#[prop(into)] on_hold_complete: Callback<()>,
#[prop(optional, into)] class: String,
#[prop(default = 1000)] hold_duration: u64,
) -> impl IntoView {
let is_holding = RwSignal::new(false);
let progress = RwSignal::new(0.0);
let on_mousedown = move |_| {
is_holding.set(true);
progress.set(0.0);
};
let on_mouseup = move |_| {
is_holding.set(false);
progress.set(0.0);
};
Effect::new(move |_| {
if is_holding.get() {
let start_time = js_sys::Date::now();
let duration = hold_duration as f64;
leptos::task::spawn_local(async move {
while is_holding.get_untracked() {
let now = js_sys::Date::now();
let elapsed = now - start_time;
let p = (elapsed / duration).min(1.0);
progress.set(p * 100.0);
if p >= 1.0 {
on_hold_complete.run(());
is_holding.set(false);
close_context_menu();
break;
}
gloo_timers::future::TimeoutFuture::new(16).await; // ~60fps
}
});
}
});
let class = tw_merge!(
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors overflow-hidden",
class
);
view! {
<div
class=class
on:mousedown=on_mousedown
on:mouseup=on_mouseup
on:mouseleave=on_mouseup
on:touchstart=move |_| on_mousedown(web_sys::MouseEvent::new("mousedown").unwrap())
on:touchend=move |_| on_mouseup(web_sys::MouseEvent::new("mouseup").unwrap())
>
// Progress background
<div
class="absolute inset-y-0 left-0 bg-destructive/20 transition-all duration-75 ease-linear pointer-events-none"
style=move || format!("width: {}%;", progress.get())
/>
<span class="relative z-10 flex items-center gap-2 w-full">
{children()}
</span>
</div>
}.into_any()
}
#[derive(Clone)] #[derive(Clone)]
struct ContextMenuContext { struct ContextMenuContext {
target_id: String, target_id: String,
@@ -209,7 +139,7 @@ pub fn ContextMenuTrigger(
class=trigger_class class=trigger_class
data-name="ContextMenuTrigger" data-name="ContextMenuTrigger"
data-context-trigger=ctx.target_id data-context-trigger=ctx.target_id
on:contextmenu=move |e: web_sys::MouseEvent| { on:contextmenu=move |_e: web_sys::MouseEvent| {
if let Some(cb) = on_open { if let Some(cb) = on_open {
cb.run(()); cb.run(());
} }
@@ -397,7 +327,7 @@ pub fn ContextMenuContent(
target_id_for_script, target_id_for_script,
)} )}
</script> </script>
}.into_any() }
} }
#[component] #[component]

View File

@@ -2,6 +2,7 @@ pub mod accordion;
pub mod alert_dialog; pub mod alert_dialog;
pub mod badge; pub mod badge;
pub mod button; pub mod button;
pub mod button_action;
pub mod card; pub mod card;
pub mod checkbox; pub mod checkbox;
pub mod context_menu; pub mod context_menu;

View File

@@ -1,13 +1,10 @@
use leptos::prelude::*; use leptos::prelude::*;
use leptos_router::hooks::use_location;
use leptos_ui::{clx, variants, void}; use leptos_ui::{clx, variants, void};
mod components { mod components {
use super::*; use super::*;
clx! {SidenavWrapper, div, "group/sidenav-wrapper has-data-[variant=Inset]:bg-sidenav flex h-full w-full"} clx! {SidenavWrapper, div, "group/sidenav-wrapper has-data-[variant=Inset]:bg-sidenav flex h-full w-full"}
// clx! {SidenavInset, div, "bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=Inset]:m-2 md:peer-data-[variant=Inset]:ml-0 md:peer-data-[variant=Inset]:rounded-xl md:peer-data-[variant=Inset]:shadow-sm md:peer-data-[variant=Inset]:peer-data-[state=Collapsed]:ml-2"}
clx! {SidenavInset, div, "bg-background relative flex w-full flex-1 flex-col data-[variant=Inset]:rounded-lg data-[variant=Inset]:border data-[variant=Inset]:border-sidenav-border data-[variant=Inset]:shadow-sm data-[variant=Inset]:m-2"} clx! {SidenavInset, div, "bg-background relative flex w-full flex-1 flex-col data-[variant=Inset]:rounded-lg data-[variant=Inset]:border data-[variant=Inset]:border-sidenav-border data-[variant=Inset]:shadow-sm data-[variant=Inset]:m-2"}
// * data-[], not group-data-[]
clx! {SidenavInner, div, "flex flex-col w-full h-full bg-sidenav data-[variant=Floating]:rounded-lg data-[variant=Floating]:border data-[variant=Floating]:border-sidenav-border data-[variant=Floating]:shadow-sm"} clx! {SidenavInner, div, "flex flex-col w-full h-full bg-sidenav data-[variant=Floating]:rounded-lg data-[variant=Floating]:border data-[variant=Floating]:border-sidenav-border data-[variant=Floating]:shadow-sm"}
clx! {SidenavHeader, div, "flex flex-col gap-2 p-2"} clx! {SidenavHeader, div, "flex flex-col gap-2 p-2"}
clx! {SidenavMenu, ul, "flex flex-col gap-1 w-full min-w-0"} clx! {SidenavMenu, ul, "flex flex-col gap-1 w-full min-w-0"}
@@ -18,82 +15,20 @@ mod components {
clx! {SidenavGroupContent, div, "w-full text-sm"} clx! {SidenavGroupContent, div, "w-full text-sm"}
clx! {SidenavGroupLabel, div, "text-sidenav-foreground/70 ring-sidenav-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=Icon]:-mt-8 group-data-[collapsible=Icon]:opacity-0"} clx! {SidenavGroupLabel, div, "text-sidenav-foreground/70 ring-sidenav-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=Icon]:-mt-8 group-data-[collapsible=Icon]:opacity-0"}
clx! {SidenavFooter, footer, "flex flex-col gap-2 p-2"} clx! {SidenavFooter, footer, "flex flex-col gap-2 p-2"}
// Button "More"
clx! {DropdownMenuTriggerEllipsis, button, "text-sidenav-foreground ring-sidenav-ring hover:bg-sidenav-accent hover:text-sidenav-accent-foreground peer-hover/menu-button:text-sidenav-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden peer-data-[size=sm]/menu-button:top-1 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 group-data-[collapsible=Icon]:hidden peer-data-[active=true]/menu-button:text-sidenav-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0"} clx! {DropdownMenuTriggerEllipsis, button, "text-sidenav-foreground ring-sidenav-ring hover:bg-sidenav-accent hover:text-sidenav-accent-foreground peer-hover/menu-button:text-sidenav-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden peer-data-[size=sm]/menu-button:top-1 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 group-data-[collapsible=Icon]:hidden peer-data-[active=true]/menu-button:text-sidenav-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0"}
void! {SidenavInput, input, void! {SidenavInput, input,
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"focus-visible:border-ring focus-visible:ring-ring/50", "focus-visible:border-ring focus-visible:ring-ring/50",
"focus-visible:ring-2", // TODO. Port tw_merge to Tailwind V4. "focus-visible:ring-2",
// "focus-visible:ring-[3px]", // TODO. Port tw_merge to Tailwind V4.
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
"read-only:bg-muted", "read-only:bg-muted",
// Specific to Sidenav
"w-full h-8 shadow-none bg-background" "w-full h-8 shadow-none bg-background"
} }
} }
pub use components::*; pub use components::*;
/* ========================================================== */
/* ✨ FUNCTIONS ✨ */
/* ========================================================== */
#[component]
pub fn SidenavLink(
children: Children,
#[prop(into)] href: String,
#[prop(optional, into)] class: String,
) -> impl IntoView {
let merged_class = tw_merge!(
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left outline-hidden ring-sidenav-ring transition-[width,height,padding] focus-visible:ring-2 active:bg-sidenav-accent active:text-sidenav-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidenav=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:bg-sidenav-accent aria-[current=page]:font-semibold aria-[current=page]:text-sidenav-accent-foreground data-[state=open]:hover:bg-sidenav-accent data-[state=open]:hover:text-sidenav-accent-foreground group-data-[collapsible=Icon]:size-8! group-data-[collapsible=Icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 hover:bg-sidenav-accent hover:text-sidenav-accent-foreground h-8 text-sm",
class
);
let location = use_location();
// Check if the link is active based on current path
let href_clone = href.clone();
let is_active = move || {
let path = location.pathname.get();
path == href_clone || path.starts_with(&format!("{}/", href_clone))
};
let aria_current = move || if is_active() { "page" } else { "false" };
view! {
<a data-name="SidenavLink" class=merged_class href=href aria-current=aria_current>
{children()}
</a>
}
}
variants! {
SidenavMenuButton {
base: "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidenav-ring transition-[width,height,padding] hover:bg-sidenav-accent hover:text-sidenav-accent-foreground focus-visible:ring-2 active:bg-sidenav-accent active:text-sidenav-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidenav=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:bg-sidenav-accent aria-[current=page]:font-medium aria-[current=page]:text-sidenav-accent-foreground data-[state=open]:hover:bg-sidenav-accent data-[state=open]:hover:text-sidenav-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=Icon]:size-8! group-data-[collapsible=Icon]:p-0! [&>svg]:stroke-2 aria-[current=page]:[&>svg]:stroke-[2.7]",
variants: {
variant: {
Default: "hover:bg-sidenav-accent hover:text-sidenav-accent-foreground", // Already in base
Outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidenav-border))] hover:bg-sidenav-accent hover:text-sidenav-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidenav-accent))]",
},
size: {
Default: "h-8 text-sm",
Sm: "h-7 text-xs",
Lg: "h-12",
}
},
component: {
element: button,
support_href: true,
support_aria_current: true
}
}
}
/* ========================================================== */
/* ✨ FUNCTIONS ✨ */
/* ========================================================== */
#[derive(Clone, Copy, PartialEq, Eq, Default, strum::Display, strum::IntoStaticStr)] #[derive(Clone, Copy, PartialEq, Eq, Default, strum::Display, strum::IntoStaticStr)]
pub enum SidenavVariant { pub enum SidenavVariant {
#[default] #[default]
@@ -117,83 +52,6 @@ pub enum SidenavCollapsible {
Icon, Icon,
} }
#[component]
pub fn Sidenav(
#[prop(into, optional)] class: String,
#[prop(default = SidenavVariant::default())] variant: SidenavVariant,
#[prop(default = SidenavState::default())] data_state: SidenavState,
#[prop(default = SidenavSide::default())] data_side: SidenavSide,
#[prop(default = SidenavCollapsible::default())] data_collapsible: SidenavCollapsible,
children: Children,
) -> impl IntoView {
view! {
{if data_collapsible == SidenavCollapsible::None {
view! {
<aside
data-name="Sidenav"
class=tw_merge!(
"flex flex-col h-full bg-sidenav text-sidenav-foreground w-(--sidenav-width)", class.clone()
)
>
{children()}
</aside>
}
.into_any()
} else {
view! {
<aside
data-name="Sidenav"
data-sidenav=data_state.to_string()
data-side=data_side.to_string()
class="hidden md:block group peer text-sidenav-foreground data-[state=Collapsed]:hidden"
>
// * SidenavGap: This is what handles the sidenav gap on desktop
<div
data-name="SidenavGap"
class=tw_merge!(
"relative w-(--sidenav-width) bg-transparent transition-[width] duration-200 ease-linear",
"group-data-[collapsible=Offcanvas]:w-0",
"group-data-[side=Right]:rotate-180",
match variant {
SidenavVariant::Sidenav => "group-data-[collapsible=Icon]:w-(--sidenav-width-icon)",
SidenavVariant::Floating | SidenavVariant::Inset =>
"group-data-[collapsible=Icon]:w-[calc(var(--sidenav-width-icon)+(--spacing(4)))]",
}
)
/>
<div
data-name="SidenavContainer"
class=tw_merge!(
"fixed inset-y-0 z-10 hidden h-svh w-(--sidenav-width) transition-[left,right,width] duration-200 ease-linear md:flex",
class,
match data_side {
SidenavSide::Left => "left-0 group-data-[collapsible=Offcanvas]:left-[calc(var(--sidenav-width)*-1)]",
SidenavSide::Right => "right-0 group-data-[collapsible=Offcanvas]:right-[calc(var(--sidenav-width)*-1)]"
},
match variant {
SidenavVariant::Sidenav => "group-data-[collapsible=Icon]:w-(--sidenav-width-icon) group-data-[side=Left]:border-r group-data-[side=Right]:border-l",
SidenavVariant::Floating | SidenavVariant::Inset =>
"p-2 group-data-[collapsible=Icon]:w-[calc(var(--sidenav-width-icon)+(--spacing(4))+2px)]",
},
)
>
// * Act as a Sidenav for the onclick trigger to work with nested Sidenavs.
<SidenavInner attr:data-sidenav="Sidenav" attr:data-variant=variant.to_string()>
{children()}
<SidenavToggleRail />
</SidenavInner>
</div>
</aside>
}
.into_any()
}}
}
}
/* ========================================================== */
/* ✨ FUNCTIONS ✨ */
/* ========================================================== */
#[derive(Clone, Copy, PartialEq, Eq, Default, strum::Display)] #[derive(Clone, Copy, PartialEq, Eq, Default, strum::Display)]
pub enum SidenavState { pub enum SidenavState {
#[default] #[default]
@@ -201,32 +59,94 @@ pub enum SidenavState {
Collapsed, Collapsed,
} }
const ONCLICK_TRIGGER: &str = "document.querySelector('[data-name=\"Sidenav\"]').setAttribute('data-state', document.querySelector('[data-name=\"Sidenav\"]').getAttribute('data-state') === 'Collapsed' ? 'Expanded' : 'Collapsed')";
#[component] #[component]
pub fn SidenavTrigger(children: Children) -> impl IntoView { pub fn Sidenav(
#[prop(into, optional)] class: String,
#[prop(default = SidenavVariant::default())] variant: SidenavVariant,
#[prop(into)] data_state: Signal<SidenavState>,
#[prop(default = SidenavSide::default())] data_side: SidenavSide,
#[prop(default = SidenavCollapsible::default())] data_collapsible: SidenavCollapsible,
children: Children,
) -> impl IntoView {
view! { view! {
// TODO. Use Button. <aside
data-name="Sidenav"
<button data-state=move || data_state.get().to_string()
onclick=ONCLICK_TRIGGER data-side=data_side.to_string()
data-name="SidenavTrigger" data-collapsible=data_collapsible.to_string()
class="inline-flex gap-2 justify-center items-center -ml-1 text-sm font-medium whitespace-nowrap rounded-md transition-all outline-none disabled:opacity-50 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 aria-invalid:ring-destructive/20 aria-invalid:border-destructive size-7 dark:aria-invalid:ring-destructive/40 dark:hover:bg-accent/50 hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]" class="hidden md:block group peer text-sidenav-foreground h-full"
> >
{children()} <div
</button> data-name="SidenavGap"
class=tw_merge!(
"relative w-(--sidenav-width) bg-transparent transition-[width] duration-200 ease-linear",
"group-data-[collapsible=Offcanvas]:w-0",
"group-data-[state=Collapsed]:w-(--sidenav-width-icon)",
match variant {
SidenavVariant::Sidenav => "group-data-[collapsible=Icon]:w-(--sidenav-width-icon)",
SidenavVariant::Floating | SidenavVariant::Inset =>
"group-data-[collapsible=Icon]:w-[calc(var(--sidenav-width-icon)+(--spacing(4)))]",
}
)
/>
<div
data-name="SidenavContainer"
class=tw_merge!(
"fixed inset-y-0 z-10 hidden h-svh w-(--sidenav-width) transition-[left,right,width] duration-200 ease-linear md:flex",
class,
match data_side {
SidenavSide::Left => "left-0 group-data-[collapsible=Offcanvas]:left-[calc(var(--sidenav-width)*-1)]",
SidenavSide::Right => "right-0 group-data-[collapsible=Offcanvas]:right-[calc(var(--sidenav-width)*-1)]"
},
"group-data-[state=Collapsed]:w-(--sidenav-width-icon)",
match variant {
SidenavVariant::Sidenav => "group-data-[side=Left]:border-r group-data-[side=Right]:border-l",
SidenavVariant::Floating | SidenavVariant::Inset => "p-2",
},
)
>
<SidenavInner attr:data-sidenav="Sidenav" attr:data-variant=variant.to_string()>
{children()}
</SidenavInner>
</div>
</aside>
}
}
variants! {
SidenavMenuButton {
base: "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidenav-ring transition-[width,height,padding] hover:bg-sidenav-accent hover:text-sidenav-accent-foreground focus-visible:ring-2 active:bg-sidenav-accent active:text-sidenav-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidenav=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-[current=page]:bg-sidenav-accent aria-[current=page]:font-medium aria-[current=page]:text-sidenav-accent-foreground data-[state=open]:hover:bg-sidenav-accent data-[state=open]:hover:text-sidenav-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[state=Collapsed]:size-8! group-data-[state=Collapsed]:p-0! [&>svg]:stroke-2 aria-[current=page]:[&>svg]:stroke-[2.7]",
variants: {
variant: {
Default: "hover:bg-sidenav-accent hover:text-sidenav-accent-foreground",
Outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidenav-border))] hover:bg-sidenav-accent hover:text-sidenav-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidenav-accent))]",
},
size: {
Default: "h-8 text-sm",
Sm: "h-7 text-xs",
Lg: "h-12",
}
},
component: {
element: button,
support_href: true,
support_aria_current: true
}
} }
} }
#[component] #[component]
fn SidenavToggleRail() -> impl IntoView { pub fn SidenavTrigger(
#[prop(into)] data_state: RwSignal<SidenavState>,
#[prop(optional, into)] class: String,
) -> impl IntoView {
view! { view! {
<button <button
data-name="SidenavToggleRail" on:click=move |_| data_state.update(|s| *s = match s { SidenavState::Expanded => SidenavState::Collapsed, SidenavState::Collapsed => SidenavState::Expanded })
aria-label="Toggle Sidenav" data-name="SidenavTrigger"
tabindex="-1" class=tw_merge!("inline-flex gap-2 justify-center items-center text-sm font-medium whitespace-nowrap rounded-md transition-all outline-none size-7 hover:bg-accent hover:text-accent-foreground focus-visible:ring-2", class)
onclick=ONCLICK_TRIGGER >
class="hidden absolute inset-y-0 z-20 w-4 transition-all ease-linear -translate-x-1/2 sm:flex group-data-[side=Left]:-right-4 group-data-[side=Right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] in-data-[side=Left]:cursor-w-resize in-data-[side=Right]:cursor-e-resize [[data-side=Left][data-state=Collapsed]_&]:cursor-e-resize [[data-side=Right][data-state=Collapsed]_&]:cursor-w-resize group-data-[collapsible=Offcanvas]:translate-x-0 group-data-[collapsible=Offcanvas]:after:left-full [[data-side=Left][data-collapsible=Offcanvas]_&]:-right-2 [[data-side=Right][data-collapsible=Offcanvas]_&]:-left-0eft-2 hover:after:bg-sidenav-border hover:group-data-[collapsible=Offcanvas]:bg-sidenav" <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-panel-left"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/></svg>
/> </button>
} }
} }

View File

@@ -162,7 +162,7 @@ pub async fn is_push_subscribed() -> Result<bool, String> {
.dyn_into::<web_sys::ServiceWorkerRegistration>() .dyn_into::<web_sys::ServiceWorkerRegistration>()
.map_err(|_| "not a registration")?; .map_err(|_| "not a registration")?;
let push_manager = registration.push_manager(); let push_manager = registration.push_manager().map_err(|e| format!("{:?}", e))?;
let subscription = wasm_bindgen_futures::JsFuture::from(push_manager.get_subscription().map_err(|e| format!("{:?}", e))?) let subscription = wasm_bindgen_futures::JsFuture::from(push_manager.get_subscription().map_err(|e| format!("{:?}", e))?)
.await .await
.map_err(|e| format!("{:?}", e))?; .map_err(|e| format!("{:?}", e))?;
@@ -181,7 +181,8 @@ pub async fn subscribe_to_push_notifications() {
}; };
// 1. Get Public Key from Backend // 1. Get Public Key from Backend
let public_key = match shared::server_fns::push::get_push_public_key().await { let public_key_res: Result<String, _> = shared::server_fns::push::get_public_key().await;
let public_key = match public_key_res {
Ok(key) => key, Ok(key) => key,
Err(e) => { log::error!("Failed to get public key: {:?}", e); return; } Err(e) => { log::error!("Failed to get public key: {:?}", e); return; }
}; };
@@ -192,25 +193,25 @@ pub async fn subscribe_to_push_notifications() {
// 3. Prepare Options // 3. Prepare Options
let mut options = web_sys::PushSubscriptionOptionsInit::new(); let mut options = web_sys::PushSubscriptionOptionsInit::new();
options.user_visible_only(true); options.set_user_visible_only(true);
options.application_server_key(Some(&key_array.into())); options.set_application_server_key(&key_array.into());
// 4. Subscribe // 4. Subscribe
let push_manager = registration.push_manager(); let push_manager = registration.push_manager().expect("no push manager");
match wasm_bindgen_futures::JsFuture::from(push_manager.subscribe_with_options(&options).expect("subscribe failed")).await { match wasm_bindgen_futures::JsFuture::from(push_manager.subscribe_with_options(&options).expect("subscribe failed")).await {
Ok(subscription) => { Ok(subscription) => {
let sub = subscription.dyn_into::<web_sys::PushSubscription>().expect("not a sub"); let sub_js = subscription.clone();
let json = sub.to_json().expect("sub to json failed");
// Extract keys from JSON // Use JS to extract JSON string representation
let sub_obj: serde_json::Value = serde_wasm_bindgen::from_value(json).expect("serde from value failed"); let json_str = js_sys::JSON::stringify(&sub_js).expect("stringify failed").as_string().expect("not a string");
let sub_obj: serde_json::Value = serde_json::from_str(&json_str).expect("serde from str failed");
let endpoint = sub_obj["endpoint"].as_str().expect("no endpoint").to_string(); let endpoint = sub_obj["endpoint"].as_str().expect("no endpoint").to_string();
let p256dh = sub_obj["keys"]["p256dh"].as_str().expect("no p256dh").to_string(); let p256dh = sub_obj["keys"]["p256dh"].as_str().expect("no p256dh").to_string();
let auth = sub_obj["keys"]["auth"].as_str().expect("no auth").to_string(); let auth = sub_obj["keys"]["auth"].as_str().expect("no auth").to_string();
// 5. Save to Backend // 5. Save to Backend
match shared::server_fns::push::save_push_subscription(endpoint, p256dh, auth).await { match shared::server_fns::push::subscribe_push(endpoint, p256dh, auth).await {
Ok(_) => { Ok(_) => {
log::info!("Push subscription saved successfully"); log::info!("Push subscription saved successfully");
toast_success("Bildirimler aktif edildi"); toast_success("Bildirimler aktif edildi");
@@ -229,7 +230,7 @@ pub async fn unsubscribe_from_push_notifications() {
let registration = wasm_bindgen_futures::JsFuture::from(sw_container.ready().expect("sw not ready")).await let registration = wasm_bindgen_futures::JsFuture::from(sw_container.ready().expect("sw not ready")).await
.unwrap().dyn_into::<web_sys::ServiceWorkerRegistration>().unwrap(); .unwrap().dyn_into::<web_sys::ServiceWorkerRegistration>().unwrap();
let push_manager = registration.push_manager(); let push_manager = registration.push_manager().unwrap();
if let Ok(sub_future) = push_manager.get_subscription() { if let Ok(sub_future) = push_manager.get_subscription() {
if let Ok(subscription) = wasm_bindgen_futures::JsFuture::from(sub_future).await { if let Ok(subscription) = wasm_bindgen_futures::JsFuture::from(sub_future).await {
if !subscription.is_null() { if !subscription.is_null() {
@@ -240,7 +241,7 @@ pub async fn unsubscribe_from_push_notifications() {
let _ = wasm_bindgen_futures::JsFuture::from(sub.unsubscribe().unwrap()).await; let _ = wasm_bindgen_futures::JsFuture::from(sub.unsubscribe().unwrap()).await;
// 2. Remove from Backend // 2. Remove from Backend
let _ = shared::server_fns::push::remove_push_subscription(endpoint).await; let _ = shared::server_fns::push::unsubscribe_push(endpoint).await;
log::info!("Push subscription removed"); log::info!("Push subscription removed");
show_toast(NotificationLevel::Info, "Bildirimler kapatıldı"); show_toast(NotificationLevel::Info, "Bildirimler kapatıldı");
} }

372
package-lock.json generated Normal file
View File

@@ -0,0 +1,372 @@
{
"name": "vibetorrent-v3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@tailwindcss/cli": "^4.1.18",
"tailwindcss": "^4.1.18",
"tw-animate-css": "^1.4.0"
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.0",
"@jridgewell/trace-mapping": "^0.3.24"
}
},
"node_modules/@jridgewell/remapping": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
"integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.24"
}
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"license": "MIT",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
"license": "MIT"
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.31",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
"license": "MIT",
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@parcel/watcher": {
"version": "2.5.6",
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz",
"integrity": "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"detect-libc": "^2.0.3",
"is-glob": "^4.0.3",
"node-addon-api": "^7.0.0",
"picomatch": "^4.0.3"
},
"engines": {
"node": ">= 10.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"optionalDependencies": {
"@parcel/watcher-android-arm64": "2.5.6",
"@parcel/watcher-darwin-arm64": "2.5.6",
"@parcel/watcher-darwin-x64": "2.5.6",
"@parcel/watcher-freebsd-x64": "2.5.6",
"@parcel/watcher-linux-arm-glibc": "2.5.6",
"@parcel/watcher-linux-arm-musl": "2.5.6",
"@parcel/watcher-linux-arm64-glibc": "2.5.6",
"@parcel/watcher-linux-arm64-musl": "2.5.6",
"@parcel/watcher-linux-x64-glibc": "2.5.6",
"@parcel/watcher-linux-x64-musl": "2.5.6",
"@parcel/watcher-win32-arm64": "2.5.6",
"@parcel/watcher-win32-ia32": "2.5.6",
"@parcel/watcher-win32-x64": "2.5.6"
}
},
"node_modules/@parcel/watcher-darwin-arm64": {
"version": "2.5.6",
"resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.6.tgz",
"integrity": "sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/@tailwindcss/cli": {
"version": "4.1.18",
"resolved": "https://registry.npmjs.org/@tailwindcss/cli/-/cli-4.1.18.tgz",
"integrity": "sha512-sMZ+lZbDyxwjD2E0L7oRUjJ01Ffjtme5OtjvvnC+cV4CEDcbqzbp25TCpxHj6kWLU9+DlqJOiNgSOgctC2aZmg==",
"license": "MIT",
"dependencies": {
"@parcel/watcher": "^2.5.1",
"@tailwindcss/node": "4.1.18",
"@tailwindcss/oxide": "4.1.18",
"enhanced-resolve": "^5.18.3",
"mri": "^1.2.0",
"picocolors": "^1.1.1",
"tailwindcss": "4.1.18"
},
"bin": {
"tailwindcss": "dist/index.mjs"
}
},
"node_modules/@tailwindcss/node": {
"version": "4.1.18",
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.18.tgz",
"integrity": "sha512-DoR7U1P7iYhw16qJ49fgXUlry1t4CpXeErJHnQ44JgTSKMaZUdf17cfn5mHchfJ4KRBZRFA/Coo+MUF5+gOaCQ==",
"license": "MIT",
"dependencies": {
"@jridgewell/remapping": "^2.3.4",
"enhanced-resolve": "^5.18.3",
"jiti": "^2.6.1",
"lightningcss": "1.30.2",
"magic-string": "^0.30.21",
"source-map-js": "^1.2.1",
"tailwindcss": "4.1.18"
}
},
"node_modules/@tailwindcss/oxide": {
"version": "4.1.18",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.18.tgz",
"integrity": "sha512-EgCR5tTS5bUSKQgzeMClT6iCY3ToqE1y+ZB0AKldj809QXk1Y+3jB0upOYZrn9aGIzPtUsP7sX4QQ4XtjBB95A==",
"license": "MIT",
"engines": {
"node": ">= 10"
},
"optionalDependencies": {
"@tailwindcss/oxide-android-arm64": "4.1.18",
"@tailwindcss/oxide-darwin-arm64": "4.1.18",
"@tailwindcss/oxide-darwin-x64": "4.1.18",
"@tailwindcss/oxide-freebsd-x64": "4.1.18",
"@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.18",
"@tailwindcss/oxide-linux-arm64-gnu": "4.1.18",
"@tailwindcss/oxide-linux-arm64-musl": "4.1.18",
"@tailwindcss/oxide-linux-x64-gnu": "4.1.18",
"@tailwindcss/oxide-linux-x64-musl": "4.1.18",
"@tailwindcss/oxide-wasm32-wasi": "4.1.18",
"@tailwindcss/oxide-win32-arm64-msvc": "4.1.18",
"@tailwindcss/oxide-win32-x64-msvc": "4.1.18"
}
},
"node_modules/@tailwindcss/oxide-darwin-arm64": {
"version": "4.1.18",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.18.tgz",
"integrity": "sha512-Gc2q4Qhs660bhjyBSKgq6BYvwDz4G+BuyJ5H1xfhmDR3D8HnHCmT/BSkvSL0vQLy/nkMLY20PQ2OoYMO15Jd0A==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/detect-libc": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"license": "Apache-2.0",
"engines": {
"node": ">=8"
}
},
"node_modules/enhanced-resolve": {
"version": "5.19.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz",
"integrity": "sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==",
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.4",
"tapable": "^2.3.0"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"license": "ISC"
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/jiti": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz",
"integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==",
"license": "MIT",
"bin": {
"jiti": "lib/jiti-cli.mjs"
}
},
"node_modules/lightningcss": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz",
"integrity": "sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==",
"license": "MPL-2.0",
"dependencies": {
"detect-libc": "^2.0.3"
},
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"optionalDependencies": {
"lightningcss-android-arm64": "1.30.2",
"lightningcss-darwin-arm64": "1.30.2",
"lightningcss-darwin-x64": "1.30.2",
"lightningcss-freebsd-x64": "1.30.2",
"lightningcss-linux-arm-gnueabihf": "1.30.2",
"lightningcss-linux-arm64-gnu": "1.30.2",
"lightningcss-linux-arm64-musl": "1.30.2",
"lightningcss-linux-x64-gnu": "1.30.2",
"lightningcss-linux-x64-musl": "1.30.2",
"lightningcss-win32-arm64-msvc": "1.30.2",
"lightningcss-win32-x64-msvc": "1.30.2"
}
},
"node_modules/lightningcss-darwin-arm64": {
"version": "1.30.2",
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.2.tgz",
"integrity": "sha512-ylTcDJBN3Hp21TdhRT5zBOIi73P6/W0qwvlFEk22fkdXchtNTOU4Qc37SkzV+EKYxLouZ6M4LG9NfZ1qkhhBWA==",
"cpu": [
"arm64"
],
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/magic-string": {
"version": "0.30.21",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/mri": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/node-addon-api": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
"license": "MIT"
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/tailwindcss": {
"version": "4.1.18",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.18.tgz",
"integrity": "sha512-4+Z+0yiYyEtUVCScyfHCxOYP06L5Ne+JiHhY2IjR2KWMIWhJOYZKLSGZaP5HkZ8+bY0cxfzwDE5uOmzFXyIwxw==",
"license": "MIT"
},
"node_modules/tapable": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz",
"integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==",
"license": "MIT",
"engines": {
"node": ">=6"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
},
"node_modules/tw-animate-css": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/tw-animate-css/-/tw-animate-css-1.4.0.tgz",
"integrity": "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/Wombosvideo"
}
}
}
}

8
package.json Normal file
View File

@@ -0,0 +1,8 @@
{
"type": "module",
"dependencies": {
"@tailwindcss/cli": "^4.1.18",
"tailwindcss": "^4.1.18",
"tw-animate-css": "^1.4.0"
}
}

View File

@@ -20,3 +20,13 @@ pub async fn subscribe_push(
.await .await
.map_err(|e| ServerFnError::new(format!("Failed to save subscription: {}", e))) .map_err(|e| ServerFnError::new(format!("Failed to save subscription: {}", e)))
} }
#[server(UnsubscribePush, "/api/server_fns")]
pub async fn unsubscribe_push(endpoint: String) -> Result<(), ServerFnError> {
let db_ctx = expect_context::<crate::DbContext>();
db_ctx
.db
.remove_push_subscription(&endpoint)
.await
.map_err(|e| ServerFnError::new(format!("Failed to remove subscription: {}", e)))
}

2
ui_config.toml Normal file
View File

@@ -0,0 +1,2 @@
base_color = "neutral"
base_path_components = "backend/src/components"