Add Prettier and ESLint tooling (Refs #77)
This commit is contained in:
@@ -7,28 +7,46 @@
|
||||
let settings = $state<FleetSettings | null>(null);
|
||||
let loading = $state(true);
|
||||
let error = $state('');
|
||||
onMount(() => { void loadSettings(); });
|
||||
onMount(() => {
|
||||
void loadSettings();
|
||||
});
|
||||
|
||||
async function loadSettings() {
|
||||
loading = true; error = '';
|
||||
loading = true;
|
||||
error = '';
|
||||
try {
|
||||
const response = await fetch('/api/settings');
|
||||
if (!response.ok) throw new Error('Could not load fleet settings.');
|
||||
settings = validateFleetSettings(await response.json());
|
||||
} catch (cause) { error = cause instanceof Error ? cause.message : 'Could not load fleet settings.'; }
|
||||
finally { loading = false; }
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : 'Could not load fleet settings.';
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Settings · Electric Cherry</title></svelte:head>
|
||||
<section class="page">
|
||||
<SectionHeader title="Settings" subtitle="Shared fleet limits and history retention. Changes apply without restarting." />
|
||||
<SectionHeader
|
||||
title="Settings"
|
||||
subtitle="Shared fleet limits and history retention. Changes apply without restarting."
|
||||
/>
|
||||
{#if loading}<p role="status">Loading fleet settings…</p>
|
||||
{:else if settings}<SettingsEditor initial={settings} />
|
||||
{:else}<div><p class="ui-error" role="alert">{error}</p><Button onclick={loadSettings}>Retry loading</Button></div>{/if}
|
||||
{:else}<div>
|
||||
<p class="ui-error" role="alert">{error}</p>
|
||||
<Button onclick={loadSettings}>Retry loading</Button>
|
||||
</div>{/if}
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.page { display: grid; gap: var(--space-4); }
|
||||
p { font-size: var(--text-sm); color: var(--text-secondary); }
|
||||
.page {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
p {
|
||||
font-size: var(--text-sm);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user