Skip to content

Modern Docker Management, Designed for Everyone

feat: settings page ui refresh (#518)

Chase Baucom28be354df4ef
diff --git a/frontend/src/app.css b/frontend/src/app.css
index 43b2f64a3..4ce639e0a 100644
--- a/frontend/src/app.css
+++ b/frontend/src/app.css
@@ -165,14 +165,8 @@ main {
overflow-x: hidden;
}
-.settings-header {
- @apply flex flex-col justify-between gap-4;
-}
-
-.settings-title {
- @apply text-foreground text-3xl font-bold tracking-tight;
-}
html {
scrollbar-gutter: stable;
}
+
diff --git a/frontend/src/lib/components/form/text-input-with-label.svelte b/frontend/src/lib/components/form/text-input-with-label.svelte
new file mode 100644
index 000000000..54745e6ad
--- /dev/null
+++ b/frontend/src/lib/components/form/text-input-with-label.svelte
@@ -0,0 +1,53 @@
+<script lang="ts">
+ import { Label } from '$lib/components/ui/label';
+ import { Input } from '$lib/components/ui/input';
+
+ let {
+ id,
+ name,
+ value = $bindable(''),
+ label,
+ placeholder = '',
+ description,
+ helpText,
+ disabled = false,
+ type = 'text',
+ autocomplete = 'off',
+ required = false,
+ onChange
+ }: {
+ id?: string;
+ name?: string;
+ value: string | number;
+ label: string;
+ placeholder?: string;
+ description?: string;
+ helpText?: string;
+ disabled?: boolean;
+ type?: 'text' | 'email' | 'password' | 'number' | 'url';
+ autocomplete?: HTMLInputElement['autocomplete'];
+ required?: boolean;
+ onChange?: (value: string) => void;
+ } = $props();
+
+ function handleInput(e: Event) {
+ const target = e.target as HTMLInputElement;
+ value = target.value;
+ onChange?.(value);
+ }
+</script>
+
+<div class="grid gap-2">
+ <Label for={id} class="text-sm font-medium leading-none">
+ {label}{#if required}<span class="text-destructive ml-0.5">*</span>{/if}
+ </Label>
+
+ <Input {id} {name} bind:value {placeholder} {disabled} {type} {autocomplete} {required} oninput={handleInput} />
+
+ {#if description}
+ <p class="text-muted-foreground text-[0.8rem]">{description}</p>
+ {/if}
+ {#if helpText}
+ <p class="text-muted-foreground text-[0.7rem]">{helpText}</p>
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
index 031807810..10851641d 100644
--- a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
@@ -59,14 +59,18 @@
<Collapsible.Trigger>
{#snippet child({ props })}
{@const Icon = item.icon}
- <Sidebar.MenuButton {...props} tooltipContent={item.title} isActive={item.isActive}>
- {#if item.icon}
- <Icon />
- {/if}
- <span>{item.title}</span>
- <ChevronRightIcon
- class="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
- />
+ <Sidebar.MenuButton tooltipContent={item.title} isActive={item.isActive}>
+ {#snippet child({ props })}
+ <a href={item.url} {...props}>
+ {#if item.icon}
+ <Icon />
+ {/if}
+ <span>{item.title}</span>
+ <ChevronRightIcon
+ class="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
+ />
+ </a>
+ {/snippet}
</Sidebar.MenuButton>
{/snippet}
</Collapsible.Trigger>
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte
index a8ab40ddc..b073d4b79 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte
@@ -20,7 +20,9 @@
preventScroll={false}
{sideOffset}
class={cn(
- 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md outline-none',
+ 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md outline-none',
+ 'max-w-[calc(100vw-2rem)] max-h-(--radix-dropdown-menu-content-available-height)',
+ 'max-[768px]:max-w-[calc(100vw-1rem)]',
className
)}
{...restProps}
diff --git a/frontend/src/lib/components/ui/select/select-content.svelte b/frontend/src/lib/components/ui/select/select-content.svelte
index 0cad80acc..4469f1532 100644
--- a/frontend/src/lib/components/ui/select/select-content.svelte
+++ b/frontend/src/lib/components/ui/select/select-content.svelte
@@ -8,6 +8,7 @@
ref = $bindable(null),
class: className,
sideOffset = 4,
+ align = 'center',
portalProps,
children,
...restProps
@@ -20,9 +21,15 @@
<SelectPrimitive.Content
bind:ref
{sideOffset}
+ {align}
data-slot="select-content"
class={cn(
- 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--bits-select-content-available-height) min-w-[8rem] origin-(--bits-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
+ 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border shadow-md data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
+ 'max-h-(--bits-select-content-available-height) origin-(--bits-select-content-transform-origin)',
+ 'max-w-[calc(100vw-2rem)] w-[var(--radix-popper-anchor-width)] min-w-[var(--radix-popper-anchor-width)]',
+ 'max-[768px]:max-w-[calc(100vw-1rem)]',
+ '[&[data-side="right"]]:!left-auto [&[data-side="right"]]:!right-0',
+ '[&[data-side="bottom"]]:!max-h-[min(var(--bits-select-content-available-height),_calc(100vh-2rem))]',
className
)}
{...restProps}
diff --git a/frontend/src/routes/settings/+layout.svelte b/frontend/src/routes/settings/+layout.svelte
index 1236f581f..b128e74a7 100644
--- a/frontend/src/routes/settings/+layout.svelte
+++ b/frontend/src/routes/settings/+layout.svelte
@@ -1,5 +1,15 @@
<script lang="ts">
import { page } from '$app/state';
+ import { goto } from '$app/navigation';
+ import { setContext } from 'svelte';
+ import { Button } from '$lib/components/ui/button';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
+ import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
+ import SaveIcon from '@lucide/svelte/icons/save';
+ import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
+ import { useSidebar } from '$lib/components/ui/sidebar/context.svelte.js';
+ import { m } from '$lib/paraglide/messages';
interface Props {
children: import('svelte').Snippet;
@@ -7,11 +17,178 @@
let { children }: Props = $props();
+ let currentPath = $derived(page.url.pathname);
+ let isSubPage = $derived(currentPath !== '/settings');
let currentPageName = $derived(page.url.pathname.split('/').pop() || 'settings');
+
+ const sidebar = useSidebar();
+
+ // Calculate left position based on sidebar state to match sidebar spacing system
+ // Uses the same CSS variables and spacing as the sidebar component
+ const leftPosition = $derived(() => {
+ const margin = '1rem'; // Standard spacing-4 equivalent
+
+ if (sidebar.isMobile) {
+ // Mobile sidebar is overlay - uses standard margin
+ return margin;
+ }
+
+ if (sidebar.state === 'expanded') {
+ // Full sidebar width + standard margin
+ return `calc(var(--sidebar-width) + ${margin})`;
+ } else {
+ // For floating variant with icon collapsible:
+ // sidebar-width-icon + spacing(4) + 2px padding + standard margin
+ // This matches the exact calculation from sidebar.svelte line 84
+ return `calc(var(--sidebar-width-icon) + 1rem + 2px + ${margin})`;
+ }
+ });
+
+ let pageTitle = $derived(() => {
+ switch (currentPageName) {
+ case 'general':
+ return m.general_title();
+ case 'docker':
+ return m.docker_title();
+ case 'security':
+ return m.security_title();
+ case 'users':
+ return m.users_title();
+ default:
+ return m.sidebar_settings();
+ }
+ });
+
+ // Create a custom event to communicate with form components
+ let formState = $state({
+ hasChanges: false,
+ isLoading: false,
+ saveFunction: null as (() => Promise<void>) | null,
+ resetFunction: null as (() => void) | null
+ });
+
+ // Set context so forms can update the header state
+ setContext('settingsFormState', formState);
+
+ function goBackToSettings() {
+ goto('/settings');
+ }
+
+ async function handleSave() {
+ if (formState.saveFunction) {
+ await formState.saveFunction();
+ }
+ }
</script>
+{#if isSubPage}
+ <div
+ class="border-border/50 bg-background/80 fixed top-4 z-[5] rounded-lg border shadow-lg backdrop-blur-md transition-all duration-200"
+ style="left: {leftPosition()}; right: 1rem;"
+ >
+ <div class="px-4 py-3">
+ <div class="flex items-center justify-between gap-4">
+ <div class="flex min-w-0 items-center gap-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ onclick={goBackToSettings}
+ class="text-muted-foreground hover:text-foreground shrink-0 gap-2"
+ >
+ <ArrowLeftIcon class="size-4" />
+ <span class="hidden sm:inline">Back</span>
+ </Button>
+
+ <nav class="flex min-w-0 items-center gap-2 text-sm">
+ <Button
+ onclick={goBackToSettings}
+ class="text-muted-foreground hover:text-foreground flex shrink-0 items-center gap-2 transition-colors"
+ >
+ <SettingsIcon class="size-4" />
+ <span>Settings</span>
+ </Button>
+ <ChevronRightIcon class="text-muted-foreground size-4 shrink-0" />
+ <span class="text-foreground truncate font-medium">{pageTitle()}</span>
+ </nav>
+ </div>
+
+ <!-- Save Section - Desktop only -->
+ <div class="hidden shrink-0 items-center gap-3 sm:flex">
+ {#if formState.hasChanges}
+ <span class="text-xs text-orange-600 dark:text-orange-400"> Unsaved changes </span>
+ {:else if !formState.hasChanges && formState.saveFunction}
+ <span class="text-xs text-green-600 dark:text-green-400"> All changes saved </span>
+ {/if}
+
+ {#if formState.hasChanges && formState.resetFunction}
+ <Button
+ variant="outline"
+ size="sm"
+ onclick={() => formState.resetFunction && formState.resetFunction()}
+ disabled={formState.isLoading}
+ class="gap-2"
+ >
+ {m.common_reset()}
+ </Button>
+ {/if}
+
+ <Button
+ onclick={handleSave}
+ disabled={formState.isLoading || !formState.hasChanges || !formState.saveFunction}
+ size="sm"
+ class="min-w-[80px] gap-2"
+ >
+ {#if formState.isLoading}
+ <div class="border-background size-4 animate-spin rounded-full border-2 border-t-transparent"></div>
+ {m.common_saving()}
+ {:else}
+ <SaveIcon class="size-4" />
+ {m.common_save()}
+ {/if}
+ </Button>
+ </div>
+ </div>
+ </div>
+ </div>
+{/if}
+
<div class="settings-container">
- <div class="settings-content w-full px-4 sm:px-6 lg:px-8">
+ <div class="settings-content w-full max-w-none" class:pt-20={isSubPage}>
{@render children()}
</div>
</div>
+
+<!-- Mobile Floating Action Buttons -->
+{#if isSubPage}
+ <div class="fixed bottom-4 right-4 z-50 flex flex-col gap-3 sm:hidden">
+ {#if formState.hasChanges && formState.resetFunction}
+ <Button
+ variant="outline"
+ size="lg"
+ onclick={() => formState.resetFunction && formState.resetFunction()}
+ disabled={formState.isLoading}
+ class="bg-background/80 size-14 rounded-full border-2 shadow-lg backdrop-blur-md"
+ >
+ <RotateCcwIcon class="size-5" />
+ </Button>
+ {/if}
+
+ <Button
+ onclick={handleSave}
+ disabled={formState.isLoading || !formState.hasChanges || !formState.saveFunction}
+ size="lg"
+ class="bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground size-14 rounded-full shadow-lg"
+ >
+ {#if formState.isLoading}
+ <div class="border-background size-5 animate-spin rounded-full border-2 border-t-transparent"></div>
+ {:else}
+ <SaveIcon class="size-5" />
+ {/if}
+ </Button>
+
+ <!-- Status indicator for mobile -->
+ {#if formState.hasChanges}
+ <div class="absolute -left-2 -top-2 size-3 animate-pulse rounded-full bg-orange-500"></div>
+ {/if}
+ </div>
+{/if}
diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte
new file mode 100644
index 000000000..36c2ac50b
--- /dev/null
+++ b/frontend/src/routes/settings/+page.svelte
@@ -0,0 +1,422 @@
+<script lang="ts">
+ import { goto } from '$app/navigation';
+ import { page } from '$app/state';
+ import SearchIcon from '@lucide/svelte/icons/search';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
+ import DatabaseIcon from '@lucide/svelte/icons/database';
+ import UserIcon from '@lucide/svelte/icons/user';
+ import ShieldIcon from '@lucide/svelte/icons/shield';
+ import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
+ import { Button } from '$lib/components/ui/button';
+ import { Card } from '$lib/components/ui/card';
+ import { m } from '$lib/paraglide/messages';
+ import type { Settings } from '$lib/types/settings.type';
+ import settingsStore from '$lib/stores/config-store';
+ import { settingsAPI } from '$lib/services/api';
+
+ interface SettingMeta {
+ key: string;
+ label: string;
+ type: string;
+ keywords?: string[];
+ description?: string;
+ }
+
+ interface SettingsCategory {
+ id: string;
+ title: string;
+ description: string;
+ icon: any;
+ url: string;
+ keywords: string[];
+ settings: SettingMeta[];
+ matchingSettings?: SettingMeta[];
+ relevanceScore?: number;
+ }
+
+ let { data } = $props();
+ let currentSettings = $state(data.settings);
+ let searchQuery = $state('');
+ let showSearchResults = $state(false);
+ let searchResults = $state<SettingsCategory[]>([]);
+
+ // Settings categories with metadata
+ const settingsCategories: SettingsCategory[] = [
+ {
+ id: 'general',
+ title: m.general_title(),
+ description: m.general_description(),
+ icon: SettingsIcon,
+ url: '/settings/general',
+ keywords: ['general', 'core', 'basic', 'main'],
+ settings: [
+ {
+ key: 'projectsDirectory',
+ label: m.general_projects_directory_label(),
+ type: 'text',
+ description: 'Configure where project files are stored',
+ keywords: ['projects', 'directory', 'path', 'folder', 'location', 'storage', 'files', 'compose', 'docker-compose']
+ },
+ {
+ key: 'baseServerUrl',
+ label: m.general_base_url_label(),
+ type: 'text',
+ description: 'Set the base URL for the application',
+ keywords: ['base', 'url', 'server', 'domain', 'host', 'endpoint', 'address', 'link']
+ },
+ {
+ key: 'enableGravatar',
+ label: m.general_enable_gravatar_label(),
+ type: 'boolean',
+ description: 'Enable Gravatar profile pictures for users',
+ keywords: ['gravatar', 'avatar', 'profile', 'picture', 'image', 'user', 'photo']
+ }
+ ]
+ },
+ {
+ id: 'docker',
+ title: m.docker_title(),
+ description: 'Configure Docker settings, polling, and auto-updates',
+ icon: DatabaseIcon,
+ url: '/settings/docker',
+ keywords: ['docker', 'container', 'image'],
+ settings: [
+ {
+ key: 'pollingEnabled',
+ label: m.docker_enable_polling_label(),
+ type: 'boolean',
+ description: 'Enable automatic checking for image updates',
+ keywords: ['polling', 'check', 'monitor', 'watch', 'scan', 'detection', 'automatic']
+ },
+ {
+ key: 'pollingInterval',
+ label: m.docker_polling_interval_label(),
+ type: 'number',
+ description: 'How often to check for image updates',
+ keywords: ['interval', 'frequency', 'schedule', 'time', 'minutes', 'period', 'delay']
+ },
+ {
+ key: 'autoUpdate',
+ label: m.docker_auto_update_label(),
+ type: 'boolean',
+ description: 'Automatically update containers when new images are available',
+ keywords: ['auto', 'update', 'automatic', 'upgrade', 'refresh', 'restart', 'deploy']
+ },
+ {
+ key: 'autoUpdateInterval',
+ label: m.docker_auto_update_interval_label(),
+ type: 'number',
+ description: 'Interval between automatic updates',
+ keywords: ['auto', 'update', 'interval', 'frequency', 'schedule', 'automatic', 'timing']
+ },
+ {
+ key: 'dockerPruneMode',
+ label: m.docker_prune_action_label(),
+ type: 'select',
+ description: 'Configure how unused Docker images are cleaned up',
+ keywords: ['prune', 'cleanup', 'clean', 'remove', 'delete', 'unused', 'dangling', 'space', 'disk']
+ }
+ ]
+ },
+ {
+ id: 'security',
+ title: m.security_title(),
+ description: 'Manage authentication and security settings',
+ icon: ShieldIcon,
+ url: '/settings/security',
+ keywords: ['security', 'safety', 'protection'],
+ settings: [
+ {
+ key: 'authLocalEnabled',
+ label: m.security_local_auth_label(),
+ type: 'boolean',
+ description: 'Enable local username/password authentication',
+ keywords: ['local', 'auth', 'authentication', 'username', 'password', 'login', 'credentials']
+ },
+ {
+ key: 'authOidcEnabled',
+ label: m.security_oidc_auth_label(),
+ type: 'boolean',
+ description: 'Enable OpenID Connect (OIDC) authentication',
+ keywords: ['oidc', 'openid', 'connect', 'sso', 'oauth', 'external', 'provider', 'federation']
+ },
+ {
+ key: 'authSessionTimeout',
+ label: m.security_session_timeout_label(),
+ type: 'number',
+ description: 'How long user sessions remain active',
+ keywords: ['session', 'timeout', 'expire', 'duration', 'lifetime', 'minutes', 'logout']
+ },
+ {
+ key: 'authPasswordPolicy',
+ label: m.security_password_policy_label(),
+ type: 'select',
+ description: 'Set password strength requirements',
+ keywords: ['password', 'policy', 'strength', 'complexity', 'requirements', 'security', 'rules']
+ }
+ ]
+ },
+ {
+ id: 'users',
+ title: m.users_title(),
+ description: m.users_subtitle(),
+ icon: UserIcon,
+ url: '/settings/users',
+ keywords: ['users', 'accounts', 'admin', 'roles', 'management', 'people'],
+ settings: []
+ }
+ ];
+
+ // Search functionality
+ $effect(() => {
+ if (searchQuery.trim()) {
+ showSearchResults = true;
+ performSearch();
+ } else {
+ showSearchResults = false;
+ searchResults = [];
+ }
+ });
+
+ function performSearch() {
+ const query = searchQuery.toLowerCase().trim();
+ const results: SettingsCategory[] = [];
+
+ settingsCategories.forEach((category) => {
+ // Check if category matches
+ const categoryMatch =
+ category.title.toLowerCase().includes(query) ||
+ category.description.toLowerCase().includes(query) ||
+ category.keywords.some((keyword) => keyword.toLowerCase().includes(query));
+
+ // Check individual settings with enhanced matching
+ const matchingSettings = category.settings.filter((setting) => {
+ const keyMatch = setting.key.toLowerCase().includes(query);
+ const labelMatch = setting.label.toLowerCase().includes(query);
+ const descriptionMatch = setting.description?.toLowerCase().includes(query) || false;
+ const keywordsMatch = setting.keywords?.some((keyword) => keyword.toLowerCase().includes(query)) || false;
+
+ return keyMatch || labelMatch || descriptionMatch || keywordsMatch;
+ });
+
+ if (categoryMatch || matchingSettings.length > 0) {
+ // Calculate relevance score based on match quality
+ let relevanceScore = 0;
+
+ if (categoryMatch) {
+ // Category title/description match gets high score
+ if (category.title.toLowerCase().includes(query)) relevanceScore += 20;
+ if (category.description.toLowerCase().includes(query)) relevanceScore += 15;
+ if (category.keywords.some((keyword) => keyword.toLowerCase() === query)) relevanceScore += 25;
+ if (category.keywords.some((keyword) => keyword.toLowerCase().includes(query))) relevanceScore += 10;
+ }
+
+ // Add score for individual setting matches
+ matchingSettings.forEach((setting) => {
+ if (setting.key.toLowerCase() === query) relevanceScore += 30;
+ else if (setting.key.toLowerCase().includes(query)) relevanceScore += 15;
+
+ if (setting.label.toLowerCase().includes(query)) relevanceScore += 12;
+ if (setting.description?.toLowerCase().includes(query)) relevanceScore += 8;
+
+ if (setting.keywords?.some((keyword) => keyword.toLowerCase() === query)) relevanceScore += 20;
+ else if (setting.keywords?.some((keyword) => keyword.toLowerCase().includes(query))) relevanceScore += 5;
+ });
+
+ const categoryResult: SettingsCategory = {
+ ...category,
+ matchingSettings: matchingSettings.length > 0 ? matchingSettings : category.settings,
+ relevanceScore
+ };
+ results.push(categoryResult);
+ }
+ });
+
+ // Sort by relevance (highest first)
+ searchResults = results.sort((a, b) => (b.relevanceScore || 0) - (a.relevanceScore || 0));
+ }
+
+ async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
+ try {
+ await settingsAPI.updateSettings(updatedSettings as any);
+ currentSettings = { ...currentSettings, ...updatedSettings };
+ settingsStore.set(currentSettings);
+ settingsStore.reload();
+ } catch (error) {
+ console.error('Error updating settings:', error);
+ throw error;
+ }
+ }
+
+ function navigateToCategory(categoryUrl: string) {
+ goto(categoryUrl);
+ }
+
+ function clearSearch() {
+ searchQuery = '';
+ showSearchResults = false;
+ }
+</script>
+
+<div class="settings-dashboard px-4 py-4 sm:px-6 sm:py-6 lg:px-8">
+ <!-- Header -->
+ <div class="mb-6 sm:mb-8">
+ <div
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-4 shadow-sm sm:p-6"
+ >
+ <div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
+ <div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
+ <div class="relative">
+ <div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
+ <div class="flex items-start gap-3 sm:gap-4">
+ <div
+ class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
+ >
+ <SettingsIcon class="size-4 sm:size-5" />
+ </div>
+ <div class="min-w-0">
+ <h1 class="text-xl font-bold tracking-tight sm:text-2xl">{m.sidebar_settings()}</h1>
+ <p class="text-muted-foreground mt-1 text-sm sm:text-base">Configure and customize your Arcane experience</p>
+ </div>
+ </div>
+ </div>
+
+ <!-- Search Bar -->
+ <div class="relative mt-4 w-full sm:mt-6 sm:max-w-md">
+ <SearchIcon class="text-muted-foreground absolute left-3 top-1/2 size-4 -translate-y-1/2" />
+ <input
+ type="text"
+ placeholder="Search settings..."
+ bind:value={searchQuery}
+ class="bg-background/50 border-border/50 border-input ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 pl-10 text-sm backdrop-blur-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
+ />
+ {#if showSearchResults}
+ <Button variant="ghost" size="sm" onclick={clearSearch} class="absolute right-2 top-1/2 h-6 w-6 -translate-y-1/2 p-0">
+ ×
+ </Button>
+ {/if}
+ </div>
+ </div>
+ </div>
+ </div>
+
+ {#if !showSearchResults}
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 xl:grid-cols-3">
+ {#each settingsCategories as category}
+ {@const Icon = category.icon}
+ <Card class="hover:border-primary/20 group cursor-pointer transition-all duration-200 hover:shadow-md">
+ <button onclick={() => navigateToCategory(category.url)} class="w-full p-4 text-left sm:p-6">
+ <div class="flex items-start justify-between gap-3">
+ <div class="flex min-w-0 flex-1 items-start gap-3 sm:gap-4">
+ <div
+ class="bg-primary/5 text-primary ring-primary/10 group-hover:bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg ring-1 transition-colors sm:size-12"
+ >
+ <Icon class="size-5 sm:size-6" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <h3 class="text-sm font-semibold leading-tight sm:text-base">{category.title}</h3>
+ <p class="text-muted-foreground mt-1 text-xs leading-relaxed sm:text-sm">{category.description}</p>
+ </div>
+ </div>
+ <ChevronRightIcon
+ class="text-muted-foreground group-hover:text-foreground mt-1 size-4 shrink-0 transition-colors"
+ />
+ </div>
+ </button>
+ </Card>
+ {/each}
+ </div>
+ {:else}
+ <div class="space-y-6 sm:space-y-8">
+ <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
+ <h2 class="text-base font-semibold sm:text-lg">
+ Search Results for "{searchQuery}" ({searchResults.length}
+ {searchResults.length === 1 ? 'result' : 'results'})
+ </h2>
+ </div>
+
+ {#if searchResults.length === 0}
+ <div class="py-8 text-center sm:py-12">
+ <SearchIcon class="text-muted-foreground mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
+ <h3 class="mb-2 text-base font-medium sm:text-lg">No settings found</h3>
+ <p class="text-muted-foreground text-sm sm:text-base">Try adjusting your search terms or browse categories above.</p>
+ </div>
+ {:else}
+ <div class="space-y-4 sm:space-y-6">
+ {#each searchResults as result}
+ {@const Icon = result.icon}
+ <div class="bg-background/40 rounded-lg border shadow-sm">
+ <div class="border-b p-4 sm:p-6">
+ <div class="flex items-center justify-between">
+ <div class="flex items-center gap-3">
+ <Icon class="text-primary size-4 shrink-0 sm:size-5" />
+ <div>
+ <h3 class="text-base font-semibold sm:text-lg">{result.title}</h3>
+ <p class="text-muted-foreground text-xs sm:text-sm">{result.description}</p>
+ </div>
+ </div>
+ <Button variant="outline" size="sm" onclick={() => navigateToCategory(result.url)} class="shrink-0">
+ Go to Page
+ </Button>
+ </div>
+ </div>
+
+ <!-- Show matching settings with descriptions -->
+ {#if result.matchingSettings && result.matchingSettings.length > 0}
+ <div class="space-y-3 p-4 sm:p-6">
+ <h4 class="text-muted-foreground mb-3 text-sm font-medium">Matching Settings:</h4>
+ {#each result.matchingSettings as setting}
+ <div class="bg-background/60 border-primary/20 rounded-md border-l-2 p-3">
+ <div class="flex items-start justify-between gap-3">
+ <div class="min-w-0 flex-1">
+ <h5 class="text-sm font-medium">{setting.label}</h5>
+ {#if setting.description}
+ <p class="text-muted-foreground mt-1 text-xs">{setting.description}</p>
+ {/if}
+ {#if setting.keywords && setting.keywords.length > 0}
+ <div class="mt-2 flex flex-wrap gap-1">
+ {#each setting.keywords.slice(0, 6) as keyword}
+ <span class="bg-muted/50 text-muted-foreground rounded px-2 py-0.5 text-xs">
+ {keyword}
+ </span>
+ {/each}
+ {#if setting.keywords.length > 6}
+ <span class="text-muted-foreground px-2 py-0.5 text-xs">
+ +{setting.keywords.length - 6} more
+ </span>
+ {/if}
+ </div>
+ {/if}
+ </div>
+ <div class="bg-muted/30 text-muted-foreground shrink-0 rounded px-2 py-1 font-mono text-xs">
+ {setting.type}
+ </div>
+ </div>
+ </div>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ {/if}
+</div>
+
+<style>
+ .settings-dashboard :global(.settings-page) {
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 0;
+ padding-bottom: 0;
+ }
+
+ .settings-dashboard :global(.settings-grid) {
+ margin-top: 0;
+ }
+
+ .settings-dashboard :global(.settings-grid .w-full) {
+ padding: 0;
+ }
+</style>
diff --git a/frontend/src/routes/settings/+page.ts b/frontend/src/routes/settings/+page.ts
new file mode 100644
index 000000000..060092bf7
--- /dev/null
+++ b/frontend/src/routes/settings/+page.ts
@@ -0,0 +1,19 @@
+import { settingsAPI } from '$lib/services/api';
+import type { PageLoad } from './$types';
+
+export const load: PageLoad = async () => {
+ try {
+ const [settings, oidcStatus] = await Promise.all([
+ settingsAPI.getSettings(),
+ settingsAPI.getOidcStatus()
+ ]);
+
+ return {
+ settings,
+ oidcStatus
+ };
+ } catch (error) {
+ console.error('Failed to load settings:', error);
+ throw error;
+ }
+};
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 2593bb74c..b8ea89c0f 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -1,16 +1,25 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
import type { Settings } from '$lib/types/settings.type';
import settingsStore from '$lib/stores/config-store';
import { settingsAPI } from '$lib/services/api';
import DockerSettingsForm from '../forms/docker-settings-form.svelte';
import BoxesIcon from '@lucide/svelte/icons/boxes';
import { m } from '$lib/paraglide/messages';
+ import { getContext } from 'svelte';
let { data } = $props();
let currentSettings = $state<Settings>(data.settings);
+ let hasChanges = $state(false);
+ let isLoading = $state(false);
- let isLoading = $state({ saving: false, testing: false });
+ const formState = getContext('settingsFormState') as any;
+
+ $effect(() => {
+ if (formState) {
+ formState.hasChanges = hasChanges;
+ formState.isLoading = isLoading;
+ }
+ });
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
@@ -27,24 +36,28 @@
}
</script>
-<div class="settings-page px-4 py-6">
+<div class="settings-page px-4 py-4 sm:px-6 sm:py-6 lg:px-8">
<div
- class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-6 shadow-sm"
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-4 shadow-sm sm:p-6"
>
<div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
<div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
- <div class="relative flex items-start gap-4">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-10 items-center justify-center rounded-lg ring-1">
- <BoxesIcon class="size-5" />
- </div>
- <div>
- <h1 class="settings-title">{m.docker_title()}</h1>
- <p class="settings-description">{m.docker_description()}</p>
+ <div class="relative flex items-start justify-between gap-3 sm:gap-4">
+ <div class="flex min-w-0 items-start gap-3 sm:gap-4">
+ <div
+ class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
+ >
+ <BoxesIcon class="size-4 sm:size-5" />
+ </div>
+ <div class="min-w-0">
+ <h1 class="settings-title text-xl sm:text-3xl">{m.docker_title()}</h1>
+ <p class="settings-description text-sm sm:text-base">{m.docker_description()}</p>
+ </div>
</div>
</div>
</div>
- <div class="settings-grid settings-grid-single">
- <DockerSettingsForm settings={currentSettings} callback={updateSettingsConfig} />
+ <div class="settings-grid settings-grid-single mt-6 sm:mt-8">
+ <DockerSettingsForm settings={currentSettings} callback={updateSettingsConfig} bind:hasChanges bind:isLoading />
</div>
</div>
diff --git a/frontend/src/routes/settings/forms/docker-settings-form.svelte b/frontend/src/routes/settings/forms/docker-settings-form.svelte
index 515352314..854c27e60 100644
--- a/frontend/src/routes/settings/forms/docker-settings-form.svelte
+++ b/frontend/src/routes/settings/forms/docker-settings-form.svelte
@@ -3,24 +3,30 @@
import * as Alert from '$lib/components/ui/alert/index.js';
import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
- import FormInput from '$lib/components/form/form-input.svelte';
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '$lib/utils/form.utils';
- import { Button } from '$lib/components/ui/button';
+ import { getContext, onMount } from 'svelte';
+ import { createForm } from '$lib/utils/form.utils';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
- import * as FieldSet from '$lib/components/ui/field-set';
+ import * as Card from '$lib/components/ui/card';
import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
import { m } from '$lib/paraglide/messages';
+ import ActivityIcon from '@lucide/svelte/icons/activity';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import TrashIcon from '@lucide/svelte/icons/trash';
+ import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
let {
callback,
- settings
+ settings,
+ hasChanges = $bindable(),
+ isLoading = $bindable(false)
}: {
settings: Settings;
callback: (appConfig: Partial<Settings>) => Promise<void>;
+ hasChanges: boolean;
+ isLoading: boolean;
} = $props();
- let isLoading = $state(false);
let pruneMode = $state(settings.dockerPruneMode);
type PollingIntervalMode = 'hourly' | 'daily' | 'weekly' | 'custom';
@@ -35,7 +41,6 @@
value: 'hourly',
minutes: 60,
label: m.hourly(),
- // If these were swapped, fix them:
description: m.polling_hourly_description()
},
{
@@ -92,6 +97,19 @@
let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, settings));
+ const formHasChanges = $derived.by(
+ () =>
+ $formInputs.pollingEnabled.value !== settings.pollingEnabled ||
+ $formInputs.pollingInterval.value !== settings.pollingInterval ||
+ $formInputs.autoUpdate.value !== settings.autoUpdate ||
+ $formInputs.autoUpdateInterval.value != settings.autoUpdateInterval ||
+ $formInputs.dockerPruneMode.value != settings.dockerPruneMode
+ );
+
+ $effect(() => {
+ hasChanges = formHasChanges;
+ });
+
// Keep form value in sync with preset selection unless "custom"
$effect(() => {
if (pollingIntervalMode !== 'custom') {
@@ -101,96 +119,158 @@
async function onSubmit() {
const data = form.validate();
- if (!data) return;
+ if (!data) {
+ toast.error('Please check the form for errors');
+ return;
+ }
isLoading = true;
- await callback(data).finally(() => (isLoading = false));
- toast.success(m.general_settings_saved());
+ await callback(data)
+ .then(() => toast.success(m.general_settings_saved()))
+ .catch((error) => {
+ console.error('Failed to save settings:', error);
+ toast.error('Failed to save settings. Please try again.');
+ })
+ .finally(() => (isLoading = false));
}
+
+ function resetForm() {
+ $formInputs.pollingEnabled.value = settings.pollingEnabled;
+ $formInputs.pollingInterval.value = settings.pollingInterval;
+ $formInputs.autoUpdate.value = settings.autoUpdate;
+ $formInputs.autoUpdateInterval.value = settings.autoUpdateInterval;
+ $formInputs.dockerPruneMode.value = settings.dockerPruneMode;
+ }
+
+ onMount(() => {
+ const formState = getContext('settingsFormState') as any;
+ if (formState) {
+ formState.saveFunction = onSubmit;
+ formState.resetFunction = resetForm;
+ }
+ });
</script>
-<form onsubmit={preventDefault(onSubmit)} class="space-y-6">
- <div class="w-full p-6">
- <FieldSet.Root>
- <FieldSet.Content class="flex flex-col gap-8">
- <div class="min-w-0 space-y-4">
+<div class="space-y-4 sm:space-y-6">
+ <!-- Image Polling Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <ActivityIcon class="size-4" />
+ </div>
+ <div>
+ <Card.Title class="text-base">Image Polling</Card.Title>
+ <Card.Description class="text-xs">Configure automatic image update checking</Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <div class="space-y-3">
+ <SwitchWithLabel
+ id="pollingEnabled"
+ label={m.docker_enable_polling_label()}
+ description={m.docker_enable_polling_description()}
+ bind:checked={$formInputs.pollingEnabled.value}
+ />
+
+ {#if $formInputs.pollingEnabled.value}
+ <div class="border-primary/20 space-y-3 border-l-2 pl-3">
+ <SelectWithLabel
+ id="pollingIntervalMode"
+ name="pollingIntervalMode"
+ bind:value={pollingIntervalMode}
+ label={m.docker_polling_interval_label()}
+ placeholder="Select interval"
+ options={imagePollingOptions.map(({ value, label, description }) => ({ value, label, description }))}
+ />
+
+ {#if pollingIntervalMode === 'custom'}
+ <TextInputWithLabel
+ bind:value={$formInputs.pollingInterval.value}
+ label={m.custom_polling_interval()}
+ placeholder={m.docker_polling_interval_placeholder()}
+ helpText={m.docker_polling_interval_description()}
+ type="number"
+ />
+ {/if}
+
+ {#if $formInputs.pollingInterval.value < 30}
+ <Alert.Root variant="warning">
+ <ZapIcon class="size-4" />
+ <Alert.Title>{m.docker_rate_limit_warning_title()}</Alert.Title>
+ <Alert.Description>{m.docker_rate_limit_warning_description()}</Alert.Description>
+ </Alert.Root>
+ {/if}
+ </div>
+ {/if}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <!-- Auto Update Card -->
+ {#if $formInputs.pollingEnabled.value}
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <RefreshCwIcon class="size-4" />
+ </div>
+ <div>
+ <Card.Title class="text-base">Auto Updates</Card.Title>
+ <Card.Description class="text-xs">Automatically update containers when new images are available</Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <div class="space-y-3">
<SwitchWithLabel
- id="pollingEnabled"
- label={m.docker_enable_polling_label()}
- description={m.docker_enable_polling_description()}
- bind:checked={$formInputs.pollingEnabled.value}
+ id="autoUpdateSwitch"
+ label={m.docker_auto_update_label()}
+ description={m.docker_auto_update_description()}
+ bind:checked={$formInputs.autoUpdate.value}
/>
- {#if $formInputs.pollingEnabled.value}
- <div class="space-y-4">
- <SelectWithLabel
- id="pollingIntervalMode"
- name="pollingIntervalMode"
- bind:value={pollingIntervalMode}
- label={m.docker_polling_interval_label()}
- placeholder="Select interval"
- options={imagePollingOptions.map(({ value, label, description }) => ({ value, label, description }))}
+
+ {#if $formInputs.autoUpdate.value}
+ <div class="border-primary/20 border-l-2 pl-3">
+ <TextInputWithLabel
+ bind:value={$formInputs.autoUpdateInterval.value}
+ label={m.docker_auto_update_interval_label()}
+ placeholder={m.docker_auto_update_interval_placeholder()}
+ helpText={m.docker_auto_update_interval_description()}
+ type="number"
/>
- {#if pollingIntervalMode === 'custom'}
- <FormInput
- bind:input={$formInputs.pollingInterval}
- type="number"
- id="pollingInterval"
- label={m.custom_polling_interval()}
- placeholder={m.docker_polling_interval_placeholder()}
- description={m.docker_polling_interval_description()}
- />
- {/if}
-
- <div>
- {#if $formInputs.pollingInterval.value < 30}
- <Alert.Root variant="warning">
- <ZapIcon class="size-4" />
- <Alert.Title>{m.docker_rate_limit_warning_title()}</Alert.Title>
- <Alert.Description>{m.docker_rate_limit_warning_description()}</Alert.Description>
- </Alert.Root>
- {/if}
- </div>
-
- <div>
- <SwitchWithLabel
- id="autoUpdateSwitch"
- label={m.docker_auto_update_label()}
- description={m.docker_auto_update_description()}
- bind:checked={$formInputs.autoUpdate.value}
- />
- </div>
- {#if $formInputs.autoUpdate.value}
- <FormInput
- bind:input={$formInputs.autoUpdateInterval}
- type="number"
- id="autoUpdateInterval"
- label={m.docker_auto_update_interval_label()}
- placeholder={m.docker_auto_update_interval_placeholder()}
- description={m.docker_auto_update_interval_description()}
- />
- {/if}
</div>
{/if}
</div>
- <div class="min-w-0">
- <SelectWithLabel
- id="dockerPruneMode"
- name="pruneMode"
- bind:value={$formInputs.dockerPruneMode.value}
- label={m.docker_prune_action_label()}
- description={pruneModeDescription}
- placeholder={m.docker_prune_placeholder()}
- options={pruneModeOptions}
- onValueChange={(v) => (pruneMode = v as 'all' | 'dangling')}
- />
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ <!-- Cleanup Settings Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <TrashIcon class="size-4" />
</div>
- </FieldSet.Content>
- <FieldSet.Footer>
- <div class="flex w-full place-items-center justify-between">
- <span class="text-muted-foreground text-sm">{m.general_save_instructions()}</span>
- <Button type="submit" disabled={isLoading} size="sm">{isLoading ? m.common_saving() : m.common_save()}</Button>
+ <div>
+ <Card.Title class="text-base">Cleanup Settings</Card.Title>
+ <Card.Description class="text-xs">Configure how Docker images are pruned</Card.Description>
</div>
- </FieldSet.Footer>
- </FieldSet.Root>
- </div>
-</form>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <SelectWithLabel
+ id="dockerPruneMode"
+ name="pruneMode"
+ bind:value={$formInputs.dockerPruneMode.value}
+ label={m.docker_prune_action_label()}
+ description={pruneModeDescription}
+ placeholder={m.docker_prune_placeholder()}
+ options={pruneModeOptions}
+ onValueChange={(v) => (pruneMode = v as 'all' | 'dangling')}
+ />
+ </Card.Content>
+ </Card.Root>
+</div>
diff --git a/frontend/src/routes/settings/forms/general-settings-form.svelte b/frontend/src/routes/settings/forms/general-settings-form.svelte
index 9697f1c77..68a5aa976 100644
--- a/frontend/src/routes/settings/forms/general-settings-form.svelte
+++ b/frontend/src/routes/settings/forms/general-settings-form.svelte
@@ -1,24 +1,28 @@
<script lang="ts">
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '$lib/utils/form.utils';
- import { Button } from '$lib/components/ui/button';
- import * as FieldSet from '$lib/components/ui/field-set';
- import FormInput from '$lib/components/form/form-input.svelte';
+ import { getContext, onMount } from 'svelte';
+ import { createForm } from '$lib/utils/form.utils';
+ import * as Card from '$lib/components/ui/card';
import type { Settings } from '$lib/types/settings.type';
import { toast } from 'svelte-sonner';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import { m } from '$lib/paraglide/messages';
+ import FolderIcon from '@lucide/svelte/icons/folder';
+ import UserIcon from '@lucide/svelte/icons/user';
+ import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
let {
settings,
- callback
+ callback,
+ hasChanges = $bindable(),
+ isLoading = $bindable(false)
}: {
settings: Settings;
callback: (appConfig: Partial<Settings>) => Promise<void>;
+ hasChanges: boolean;
+ isLoading: boolean;
} = $props();
- let isLoading = $state(false);
-
const formSchema = z.object({
projectsDirectory: z.string().min(1, m.general_projects_directory_required()),
baseServerUrl: z.string().min(1, m.general_base_url_required()),
@@ -27,63 +31,104 @@
let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, settings));
+ const formHasChanges = $derived.by(
+ () =>
+ $formInputs.projectsDirectory.value !== settings.projectsDirectory ||
+ $formInputs.baseServerUrl.value !== settings.baseServerUrl ||
+ $formInputs.enableGravatar.value !== settings.enableGravatar
+ );
+
+ $effect(() => {
+ hasChanges = formHasChanges;
+ });
+
async function onSubmit() {
const data = form.validate();
- if (!data) return;
+ if (!data) {
+ toast.error('Please check the form for errors');
+ return;
+ }
isLoading = true;
await callback(data)
.then(() => toast.success(m.general_settings_saved()))
+ .catch((error) => {
+ console.error('Failed to save settings:', error);
+ toast.error('Failed to save settings. Please try again.');
+ })
.finally(() => (isLoading = false));
}
-</script>
-<form onsubmit={preventDefault(onSubmit)} class="space-y-6">
- <div class="w-full p-6">
- <FieldSet.Root>
- <FieldSet.Content class="grid grid-cols-1 gap-6 md:grid-cols-2">
- <div class="bg-background/40 min-w-0 space-y-4 rounded-lg border p-5 shadow-sm">
- <div class="space-y-1">
- <h3 class="text-base font-medium">{m.general_projects_heading()}</h3>
- <p class="text-muted-foreground text-sm">{m.general_projects_description()}</p>
- </div>
+ function resetForm() {
+ $formInputs.projectsDirectory.value = settings.projectsDirectory;
+ $formInputs.baseServerUrl.value = settings.baseServerUrl;
+ $formInputs.enableGravatar.value = settings.enableGravatar;
+ }
- <FormInput
- label={m.general_projects_directory_label()}
- placeholder={m.general_projects_directory_placeholder()}
- bind:input={$formInputs.projectsDirectory}
- helpText={m.general_projects_directory_help()}
- />
+ onMount(() => {
+ const formState = getContext('settingsFormState') as any;
+ if (formState) {
+ formState.saveFunction = onSubmit;
+ formState.resetFunction = resetForm;
+ }
+ });
+</script>
- <FormInput
- label={m.general_base_url_label()}
- placeholder={m.general_base_url_placeholder()}
- bind:input={$formInputs.baseServerUrl}
- helpText={m.general_base_url_help()}
- />
+<div class="space-y-4 sm:space-y-6">
+ <!-- Projects Configuration Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <FolderIcon class="size-4" />
</div>
+ <div>
+ <Card.Title class="text-base">{m.general_projects_heading()}</Card.Title>
+ <Card.Description class="text-xs">{m.general_projects_description()}</Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <div class="space-y-3">
+ <TextInputWithLabel
+ bind:value={$formInputs.projectsDirectory.value}
+ label={m.general_projects_directory_label()}
+ placeholder={m.general_projects_directory_placeholder()}
+ helpText={m.general_projects_directory_help()}
+ type="text"
+ />
- <div class="bg-background/40 min-w-0 space-y-4 rounded-lg border p-5 shadow-sm">
- <div class="space-y-1">
- <h3 class="text-base font-medium">{m.general_user_avatars_heading()}</h3>
- <p class="text-muted-foreground text-sm">{m.general_user_avatars_description()}</p>
- </div>
+ <TextInputWithLabel
+ bind:value={$formInputs.baseServerUrl.value}
+ label={m.general_base_url_label()}
+ placeholder={m.general_base_url_placeholder()}
+ helpText={m.general_base_url_help()}
+ type="text"
+ />
+ </div>
+ </Card.Content>
+ </Card.Root>
- <SwitchWithLabel
- id="enableGravatar"
- label={m.general_enable_gravatar_label()}
- description={m.general_enable_gravatar_description()}
- bind:checked={$formInputs.enableGravatar.value}
- />
+ <!-- User Preferences Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <UserIcon class="size-4" />
</div>
- </FieldSet.Content>
-
- <FieldSet.Footer>
- <div class="flex w-full place-items-center justify-between">
- <span class="text-muted-foreground text-sm">{m.general_save_instructions()}</span>
- <Button type="submit" disabled={isLoading} size="sm">{isLoading ? m.common_saving() : m.common_save()}</Button>
+ <div>
+ <Card.Title class="text-base">{m.general_user_avatars_heading()}</Card.Title>
+ <Card.Description class="text-xs">{m.general_user_avatars_description()}</Card.Description>
</div>
- </FieldSet.Footer>
- </FieldSet.Root>
- </div>
-</form>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <SwitchWithLabel
+ id="enableGravatar"
+ label={m.general_enable_gravatar_label()}
+ description={m.general_enable_gravatar_description()}
+ bind:checked={$formInputs.enableGravatar.value}
+ />
+ </Card.Content>
+ </Card.Root>
+</div>
diff --git a/frontend/src/routes/settings/forms/security-settings-form.svelte b/frontend/src/routes/settings/forms/security-settings-form.svelte
index ec7adcb12..0862a8917 100644
--- a/frontend/src/routes/settings/forms/security-settings-form.svelte
+++ b/frontend/src/routes/settings/forms/security-settings-form.svelte
@@ -1,9 +1,9 @@
<script lang="ts">
import { z } from 'zod/v4';
- import { createForm, preventDefault } from '$lib/utils/form.utils';
- import * as FieldSet from '$lib/components/ui/field-set';
+ import { getContext, onMount } from 'svelte';
+ import { createForm } from '$lib/utils/form.utils';
+ import * as Card from '$lib/components/ui/card';
import { Button } from '$lib/components/ui/button';
- import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
import { toast } from 'svelte-sonner';
@@ -11,18 +11,25 @@
import type { OidcStatusInfo } from '$lib/types/settings.type';
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
import { m } from '$lib/paraglide/messages';
+ import LockIcon from '@lucide/svelte/icons/lock';
+ import ClockIcon from '@lucide/svelte/icons/clock';
+ import KeyIcon from '@lucide/svelte/icons/key';
+ import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
let {
settings,
oidcStatus,
- callback
+ callback,
+ hasChanges = $bindable(),
+ isLoading = $bindable(false)
}: {
settings: Settings;
oidcStatus: OidcStatusInfo;
callback: (appConfig: Partial<Settings>) => Promise<void>;
+ hasChanges: boolean;
+ isLoading: boolean;
} = $props();
- let isLoading = $state({ saving: false });
let showOidcConfigDialog = $state(false);
let oidcConfigForm = $state({
@@ -59,14 +66,29 @@
let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, settings));
+ const formHasChanges = $derived.by(
+ () =>
+ $formInputs.authLocalEnabled.value !== settings.authLocalEnabled ||
+ $formInputs.authOidcEnabled.value !== settings.authOidcEnabled ||
+ $formInputs.authSessionTimeout.value !== settings.authSessionTimeout ||
+ $formInputs.authPasswordPolicy.value !== settings.authPasswordPolicy
+ );
+
+ $effect(() => {
+ hasChanges = formHasChanges;
+ });
+
// Helper: treat OIDC as active if forced by server or enabled in form
const isOidcActive = () => $formInputs.authOidcEnabled.value || oidcStatus.envForced;
async function onSubmit() {
const data = form.validate();
- if (!data) return;
+ if (!data) {
+ toast.error('Please check the form for errors');
+ return;
+ }
- isLoading.saving = true;
+ isLoading = true;
let authOidcConfig = settings.authOidcConfig;
if (data.authOidcEnabled && !oidcStatus.envForced) {
@@ -87,9 +109,28 @@
authPasswordPolicy: data.authPasswordPolicy
})
.then(() => toast.success(m.security_settings_saved()))
- .finally(() => (isLoading.saving = false));
+ .catch((error) => {
+ console.error('Failed to save settings:', error);
+ toast.error('Failed to save settings. Please try again.');
+ })
+ .finally(() => (isLoading = false));
}
+ function resetForm() {
+ $formInputs.authLocalEnabled.value = settings.authLocalEnabled;
+ $formInputs.authOidcEnabled.value = settings.authOidcEnabled;
+ $formInputs.authSessionTimeout.value = settings.authSessionTimeout;
+ $formInputs.authPasswordPolicy.value = settings.authPasswordPolicy;
+ }
+
+ onMount(() => {
+ const formState = getContext('settingsFormState') as any;
+ if (formState) {
+ formState.saveFunction = onSubmit;
+ formState.resetFunction = resetForm;
+ }
+ });
+
// Only depend on envForced; open config when enabling and not forced
function handleOidcSwitchChange(checked: boolean) {
$formInputs.authOidcEnabled.value = checked;
@@ -128,12 +169,12 @@
async function handleSaveOidcConfig() {
try {
- isLoading.saving = true;
+ isLoading = true;
$formInputs.authOidcEnabled.value = true;
const data = form.validate();
if (!data) {
- isLoading.saving = false;
+ isLoading = false;
return;
}
@@ -154,140 +195,163 @@
toast.success(m.security_oidc_saved());
showOidcConfigDialog = false;
} finally {
- isLoading.saving = false;
+ isLoading = false;
}
}
</script>
-<form onsubmit={preventDefault(onSubmit)} class="space-y-6">
- <div class="w-full p-6">
- <FieldSet.Root>
- <FieldSet.Content class="flex flex-col gap-8">
- <div class="min-w-0 space-y-4">
- <h2 class="text-muted-foreground text-sm font-semibold">{m.security_authentication_heading()}</h2>
+<div class="space-y-4 sm:space-y-6">
+ <!-- Authentication Methods Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <LockIcon class="size-4" />
+ </div>
+ <div>
+ <Card.Title class="text-base">{m.security_authentication_heading()}</Card.Title>
+ <Card.Description class="text-xs">Configure login methods for your application</Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <div class="space-y-3">
+ <SwitchWithLabel
+ id="localAuthSwitch"
+ label={m.security_local_auth_label()}
+ description={m.security_local_auth_description()}
+ bind:checked={$formInputs.authLocalEnabled.value}
+ onCheckedChange={handleLocalSwitchChange}
+ />
+ <div class="space-y-2">
<SwitchWithLabel
- id="localAuthSwitch"
- label={m.security_local_auth_label()}
- description={m.security_local_auth_description()}
- bind:checked={$formInputs.authLocalEnabled.value}
- onCheckedChange={handleLocalSwitchChange}
+ id="oidcAuthSwitch"
+ label={m.security_oidc_auth_label()}
+ description={oidcStatus.envForced ? m.security_oidc_auth_description_forced() : m.security_oidc_auth_description()}
+ disabled={oidcStatus.envForced}
+ bind:checked={$formInputs.authOidcEnabled.value}
+ onCheckedChange={handleOidcSwitchChange}
/>
- <div class="space-y-2">
- <SwitchWithLabel
- id="oidcAuthSwitch"
- label={m.security_oidc_auth_label()}
- description={oidcStatus.envForced ? m.security_oidc_auth_description_forced() : m.security_oidc_auth_description()}
- disabled={oidcStatus.envForced}
- checked={$formInputs.authOidcEnabled.value}
- onCheckedChange={handleOidcSwitchChange}
- />
-
- {#if isOidcActive()}
- <div class="pl-11">
- {#if oidcStatus.envForced}
- {#if !oidcStatus.envConfigured}
- <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
- {m.security_server_forces_oidc_missing_env()}
- </Button>
- {:else}
- <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
- {m.security_oidc_configured_forced_view()}
- </Button>
- {/if}
+ {#if isOidcActive()}
+ <div class="pl-8 sm:pl-11">
+ {#if oidcStatus.envForced}
+ {#if !oidcStatus.envConfigured}
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ {m.security_server_forces_oidc_missing_env()}
+ </Button>
{:else}
<Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
- {m.security_manage_oidc_config()}
+ {m.security_oidc_configured_forced_view()}
</Button>
{/if}
- </div>
- {/if}
- </div>
+ {:else}
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ {m.security_manage_oidc_config()}
+ </Button>
+ {/if}
+ </div>
+ {/if}
</div>
+ </div>
+ </Card.Content>
+ </Card.Root>
- <div class="min-w-0 space-y-4">
- <h2 class="text-muted-foreground text-sm font-semibold">{m.security_session_heading()}</h2>
-
- <FormInput
- type="number"
- id="sessionTimeout"
- label={m.security_session_timeout_label()}
- placeholder={m.security_session_timeout_placeholder()}
- bind:input={$formInputs.authSessionTimeout}
- description={m.security_session_timeout_description()}
- />
+ <!-- Session Settings Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <ClockIcon class="size-4" />
+ </div>
+ <div>
+ <Card.Title class="text-base">{m.security_session_heading()}</Card.Title>
+ <Card.Description class="text-xs">Configure session timeout and duration</Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <TextInputWithLabel
+ bind:value={$formInputs.authSessionTimeout.value}
+ label={m.security_session_timeout_label()}
+ placeholder={m.security_session_timeout_placeholder()}
+ helpText={m.security_session_timeout_description()}
+ type="number"
+ />
+ </Card.Content>
+ </Card.Root>
- <div class="space-y-2">
- <span class="text-sm font-medium" id="passwordPolicyLabel">{m.security_password_policy_label()}</span>
- <Tooltip.Provider>
- <div class="mt-2 grid grid-cols-3 gap-2" role="group" aria-labelledby="passwordPolicyLabel">
- <Tooltip.Root>
- <Tooltip.Trigger>
- <Button
- variant={$formInputs.authPasswordPolicy.value === 'basic' ? 'default' : 'outline'}
- class={$formInputs.authPasswordPolicy.value === 'basic'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
- onclick={() => ($formInputs.authPasswordPolicy.value = 'basic')}
- type="button"
- >{m.security_password_policy_basic()}
- </Button>
- </Tooltip.Trigger>
- <Tooltip.Content side="top" align="center">{m.security_password_policy_basic_tooltip()}</Tooltip.Content>
- </Tooltip.Root>
-
- <Tooltip.Root>
- <Tooltip.Trigger>
- <Button
- variant={$formInputs.authPasswordPolicy.value === 'standard' ? 'default' : 'outline'}
- class={$formInputs.authPasswordPolicy.value === 'standard'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
- onclick={() => ($formInputs.authPasswordPolicy.value = 'standard')}
- type="button"
- >{m.security_password_policy_standard()}
- </Button>
- </Tooltip.Trigger>
- <Tooltip.Content side="top" align="center">{m.security_password_policy_standard_tooltip()}</Tooltip.Content>
- </Tooltip.Root>
-
- <Tooltip.Root>
- <Tooltip.Trigger>
- <Button
- variant={$formInputs.authPasswordPolicy.value === 'strong' ? 'default' : 'outline'}
- class={$formInputs.authPasswordPolicy.value === 'strong'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
- onclick={() => ($formInputs.authPasswordPolicy.value = 'strong')}
- type="button"
- >{m.security_password_policy_strong()}
- </Button>
- </Tooltip.Trigger>
- <Tooltip.Content side="top" align="center">{m.security_password_policy_strong_tooltip()}</Tooltip.Content>
- </Tooltip.Root>
- </div>
- </Tooltip.Provider>
- </div>
+ <!-- Password Policy Card -->
+ <Card.Root class="overflow-hidden">
+ <Card.Header class="py-4! bg-muted/20 border-b">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
+ <KeyIcon class="size-4" />
</div>
- </FieldSet.Content>
-
- <FieldSet.Footer>
- <div class="flex w-full place-items-center justify-between">
- <span class="text-muted-foreground text-sm">{m.security_save_instructions()}</span>
- <Button type="submit" disabled={isLoading.saving} size="sm"
- >{isLoading.saving ? m.common_saving() : m.common_save()}</Button
- >
+ <div>
+ <Card.Title class="text-base">{m.security_password_policy_label()}</Card.Title>
+ <Card.Description class="text-xs">Set password strength requirements</Card.Description>
</div>
- </FieldSet.Footer>
- </FieldSet.Root>
- </div>
-
- <OidcConfigDialog
- bind:open={showOidcConfigDialog}
- currentSettings={settings}
- {oidcStatus}
- bind:oidcForm={oidcConfigForm}
- onSave={handleSaveOidcConfig}
- />
-</form>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <Tooltip.Provider>
+ <div class="grid grid-cols-1 gap-2 sm:grid-cols-3 sm:gap-3" role="group" aria-labelledby="passwordPolicyLabel">
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <Button
+ variant={$formInputs.authPasswordPolicy.value === 'basic' ? 'default' : 'outline'}
+ class={$formInputs.authPasswordPolicy.value === 'basic'
+ ? 'arcane-button-create h-12 w-full text-xs sm:text-sm'
+ : 'arcane-button-restart h-12 w-full text-xs sm:text-sm'}
+ onclick={() => ($formInputs.authPasswordPolicy.value = 'basic')}
+ type="button"
+ >{m.security_password_policy_basic()}
+ </Button>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">{m.security_password_policy_basic_tooltip()}</Tooltip.Content>
+ </Tooltip.Root>
+
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <Button
+ variant={$formInputs.authPasswordPolicy.value === 'standard' ? 'default' : 'outline'}
+ class={$formInputs.authPasswordPolicy.value === 'standard'
+ ? 'arcane-button-create h-12 w-full text-xs sm:text-sm'
+ : 'arcane-button-restart h-12 w-full text-xs sm:text-sm'}
+ onclick={() => ($formInputs.authPasswordPolicy.value = 'standard')}
+ type="button"
+ >{m.security_password_policy_standard()}
+ </Button>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">{m.security_password_policy_standard_tooltip()}</Tooltip.Content>
+ </Tooltip.Root>
+
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <Button
+ variant={$formInputs.authPasswordPolicy.value === 'strong' ? 'default' : 'outline'}
+ class={$formInputs.authPasswordPolicy.value === 'strong'
+ ? 'arcane-button-create h-12 w-full text-xs sm:text-sm'
+ : 'arcane-button-restart h-12 w-full text-xs sm:text-sm'}
+ onclick={() => ($formInputs.authPasswordPolicy.value = 'strong')}
+ type="button"
+ >{m.security_password_policy_strong()}
+ </Button>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">{m.security_password_policy_strong_tooltip()}</Tooltip.Content>
+ </Tooltip.Root>
+ </div>
+ </Tooltip.Provider>
+ </Card.Content>
+ </Card.Root>
+</div>
+
+<OidcConfigDialog
+ bind:open={showOidcConfigDialog}
+ currentSettings={settings}
+ {oidcStatus}
+ bind:oidcForm={oidcConfigForm}
+ onSave={handleSaveOidcConfig}
+/>
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index 712db668b..eaaecb174 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -5,9 +5,21 @@
import GeneralSettingsForm from '../forms/general-settings-form.svelte';
import SettingsIcon from '@lucide/svelte/icons/settings';
import { m } from '$lib/paraglide/messages';
+ import { getContext } from 'svelte';
let { data } = $props();
let currentSettings = $state(data.settings);
+ let hasChanges = $state(false);
+ let isLoading = $state(false);
+
+ const formState = getContext('settingsFormState') as any;
+
+ $effect(() => {
+ if (formState) {
+ formState.hasChanges = hasChanges;
+ formState.isLoading = isLoading;
+ }
+ });
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
@@ -22,24 +34,28 @@
}
</script>
-<div class="settings-page px-4 py-6">
+<div class="settings-page px-4 py-4 sm:px-6 sm:py-6 lg:px-8">
<div
- class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-6 shadow-sm"
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-4 shadow-sm sm:p-6"
>
<div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
<div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
- <div class="relative flex items-start gap-4">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-10 items-center justify-center rounded-lg ring-1">
- <SettingsIcon class="size-5" />
- </div>
- <div>
- <h1 class="settings-title">{m.general_title()}</h1>
- <p class="settings-description">{m.general_description()}</p>
+ <div class="relative flex items-start justify-between gap-3 sm:gap-4">
+ <div class="flex min-w-0 items-start gap-3 sm:gap-4">
+ <div
+ class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
+ >
+ <SettingsIcon class="size-4 sm:size-5" />
+ </div>
+ <div class="min-w-0">
+ <h1 class="settings-title text-xl sm:text-3xl">{m.general_title()}</h1>
+ <p class="settings-description text-sm sm:text-base">{m.general_description()}</p>
+ </div>
</div>
</div>
</div>
- <div class="settings-grid settings-grid-single">
- <GeneralSettingsForm settings={currentSettings} callback={updateSettingsConfig} />
+ <div class="settings-grid settings-grid-single mt-6 sm:mt-8">
+ <GeneralSettingsForm settings={currentSettings} callback={updateSettingsConfig} bind:hasChanges bind:isLoading />
</div>
</div>
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index 5ae01719f..4dd9d0d8e 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -6,9 +6,21 @@
import SecuritySettingsForm from '../forms/security-settings-form.svelte';
import LockIcon from '@lucide/svelte/icons/lock';
import { m } from '$lib/paraglide/messages';
+ import { getContext } from 'svelte';
let { data }: { data: PageData } = $props();
let currentSettings = $state<Settings>(data.settings);
+ let hasChanges = $state(false);
+ let isLoading = $state(false);
+
+ const formState = getContext('settingsFormState') as any;
+
+ $effect(() => {
+ if (formState) {
+ formState.hasChanges = hasChanges;
+ formState.isLoading = isLoading;
+ }
+ });
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
@@ -23,24 +35,34 @@
}
</script>
-<div class="settings-page px-4 py-6">
+<div class="settings-page px-4 py-4 sm:px-6 sm:py-6 lg:px-8">
<div
- class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-6 shadow-sm"
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-4 shadow-sm sm:p-6"
>
<div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
<div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
- <div class="relative flex items-start gap-4">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-10 items-center justify-center rounded-lg ring-1">
- <LockIcon class="size-5" />
- </div>
- <div>
- <h1 class="settings-title">{m.security_title()}</h1>
- <p class="settings-description">{m.security_description()}</p>
+ <div class="relative flex items-start justify-between gap-3 sm:gap-4">
+ <div class="flex min-w-0 items-start gap-3 sm:gap-4">
+ <div
+ class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
+ >
+ <LockIcon class="size-4 sm:size-5" />
+ </div>
+ <div class="min-w-0">
+ <h1 class="settings-title text-xl sm:text-3xl">{m.security_title()}</h1>
+ <p class="settings-description text-sm sm:text-base">{m.security_description()}</p>
+ </div>
</div>
</div>
</div>
- <div class="settings-grid settings-grid-single">
- <SecuritySettingsForm settings={currentSettings} oidcStatus={data.oidcStatus} callback={updateSettingsConfig} />
+ <div class="settings-grid settings-grid-single mt-6 sm:mt-8">
+ <SecuritySettingsForm
+ settings={currentSettings}
+ oidcStatus={data.oidcStatus}
+ callback={updateSettingsConfig}
+ bind:hasChanges
+ bind:isLoading
+ />
</div>
</div>
diff --git a/frontend/src/routes/settings/users/+page.svelte b/frontend/src/routes/settings/users/+page.svelte
index 9c10a2069..5ae0c6796 100644
--- a/frontend/src/routes/settings/users/+page.svelte
+++ b/frontend/src/routes/settings/users/+page.svelte
@@ -110,13 +110,13 @@
}
</script>
-<div class="space-y-6 pb-8">
- <div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
- <div>
- <h1 class="text-3xl font-bold tracking-tight">{m.users_title()}</h1>
- <p class="text-muted-foreground mt-1 text-sm">{m.users_subtitle()}</p>
+<div class="space-y-4 sm:space-y-6 pb-6 sm:pb-8 px-4 sm:px-6 lg:px-8">
+ <div class="flex flex-col justify-between gap-3 sm:gap-4 sm:flex-row sm:items-center">
+ <div class="min-w-0">
+ <h1 class="text-xl sm:text-3xl font-bold tracking-tight">{m.users_title()}</h1>
+ <p class="text-muted-foreground mt-1 text-xs sm:text-sm">{m.users_subtitle()}</p>
</div>
- <div class="flex items-center gap-2">
+ <div class="flex items-center gap-2 shrink-0">
<ArcaneButton
action="create"
customLabel={m.users_create_button()}
@@ -127,7 +127,7 @@
</div>
</div>
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
+ <div class="grid grid-cols-1 gap-3 sm:gap-4 sm:grid-cols-3">
<StatCard
title={m.users_total()}
value={totalUsers}