From e801fc306546515b44b3442892653674bde4592d Mon Sep 17 00:00:00 2001 From: C-West8 <125926137+C-West8@users.noreply.github.com> Date: Fri, 23 Oct 2026 14:11:44 -0500 Subject: [PATCH] CSS cleanup --- src/lib/components/ActionStatus.svelte | 24 +++++++++ src/lib/components/FolderSyncForm.svelte | 30 ++++++++--- src/lib/components/RunNowButton.svelte | 21 ++++---- src/lib/components/StableText.svelte | 30 +++++++++++ src/lib/server/forms.ts | 14 +++++ src/lib/styles/app.css | 3 ++ src/routes/admin/login/+page.svelte | 5 +- .../admin/projects/[id]/+page.server.ts | 21 ++++---- src/routes/admin/projects/[id]/+page.svelte | 53 +++++++++++++------ src/routes/admin/projects/new/+page.svelte | 11 ++-- src/routes/projects/[id]/+page.server.ts | 11 ++-- src/routes/projects/[id]/+page.svelte | 20 +++++-- 12 files changed, 186 insertions(+), 57 deletions(-) create mode 100644 src/lib/components/ActionStatus.svelte create mode 100644 src/lib/components/StableText.svelte diff --git a/src/lib/components/ActionStatus.svelte b/src/lib/components/ActionStatus.svelte new file mode 100644 index 0000000..4427266 --- /dev/null +++ b/src/lib/components/ActionStatus.svelte @@ -0,0 +1,24 @@ + + + + +

{status?.text ?? ''}

+ + diff --git a/src/lib/components/FolderSyncForm.svelte b/src/lib/components/FolderSyncForm.svelte index fc0a3eb..09346c0 100644 --- a/src/lib/components/FolderSyncForm.svelte +++ b/src/lib/components/FolderSyncForm.svelte @@ -1,11 +1,29 @@ @@ -55,13 +56,10 @@ }} >

{unavailable ?? message ?? ''}

@@ -73,9 +71,12 @@ gap: 0.3rem; } + /* Always two lines tall, so a message appearing doesn't push the page down. */ .run-now p { - max-width: 22rem; + width: 22rem; + max-width: 100%; text-align: right; - min-height: 1.2em; + height: 3em; + overflow: hidden; } diff --git a/src/lib/components/StableText.svelte b/src/lib/components/StableText.svelte new file mode 100644 index 0000000..c707da7 --- /dev/null +++ b/src/lib/components/StableText.svelte @@ -0,0 +1,30 @@ + + + + {text} + {#each options as option (option)} + + {/each} + + + diff --git a/src/lib/server/forms.ts b/src/lib/server/forms.ts index 60807db..40f793b 100644 --- a/src/lib/server/forms.ts +++ b/src/lib/server/forms.ts @@ -20,6 +20,20 @@ export async function attempt( } } +/** + * `attempt` for pages with several forms. Success and failure both carry the action's name, + * so the page can show the message beside the button that was used. + */ +export function attemptAction( + action: string, + work: () => Promise, + echo?: E +) { + return attempt(async () => ({ action, message: await work() }), { action, ...echo } as { + action: string; + } & E); +} + /** A form field as a string (empty if missing or a file). */ export function field(data: FormData, name: string): string { const value = data.get(name); diff --git a/src/lib/styles/app.css b/src/lib/styles/app.css index 57a1698..f70b1da 100644 --- a/src/lib/styles/app.css +++ b/src/lib/styles/app.css @@ -59,6 +59,9 @@ html { -webkit-text-size-adjust: 100%; + /* Keep room for the scrollbar even when the page is short, so filtering or collapsing a + list never shifts everything sideways. */ + scrollbar-gutter: stable; } body { diff --git a/src/routes/admin/login/+page.svelte b/src/routes/admin/login/+page.svelte index 550a53f..e9ea05d 100644 --- a/src/routes/admin/login/+page.svelte +++ b/src/routes/admin/login/+page.svelte @@ -1,5 +1,6 @@