refactor(web): the admin settings cards share one load-and-save cycle (DRY W3)

Five settings cards (Fingerprinting, Loudness, Public address, Proxies,
Notification email) each hand-rolled the same cycle: load into a stored copy
and an editable one, say when they differ, save, adopt what the server
stored, toast. lib/settings/settingsForm.svelte.ts now runs it once
(createSettingsForm), and SettingsLoadStatus draws the "Loading…" / "Couldn't
load … Try again" line for those five and for Library folders and AcoustID.

The Proxies card dropped the server's reason when a save was refused and
toasted a fixed "Couldn't save proxy depth."; it now says why, as the other
cards do. Two cards' "Loading <thing>…" lines now read "Loading…" like the
rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 03:13:32 -05:00
co-authored by Claude Opus 5.5
parent dae46ea980
commit 87c650aca1
10 changed files with 245 additions and 274 deletions
@@ -9,6 +9,7 @@
import { pushToast } from '#lib/stores/toast.svelte.js';
import { plural } from '#lib/utils/plural.js';
import SettingRow from '#lib/components/settings/SettingRow.svelte';
import SettingsLoadStatus from '#lib/components/settings/SettingsLoadStatus.svelte';
// The library's folders, set here rather than only by
// MINSTREL_LIBRARY_SCAN_PATHS. Editing a folder's path says its files moved
@@ -75,13 +76,8 @@
const field = 'w-64 max-w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs';
</script>
{#if loadError}
<p class="px-4 py-3 text-sm text-error-fg">
Couldn't load the library folders.
<button type="button" class="underline hover:no-underline" onclick={load}>Try again</button>
</p>
{:else if current === null}
<p class="px-4 py-3 text-sm text-text-secondary">Loading…</p>
{#if loadError || current === null}
<SettingsLoadStatus failed={loadError} what="the library folders" retry={load} />
{:else if !editing}
<SettingRow
label="Folders"