domaino/app-admin/src/routes/login/+page.svelte
agent 52d7a5e3e2 Admin shell: standalone login/preview, fixed admin theme
- /login and /preview no longer render the admin navbar (the login page
  showed Pages/Export/Logout to signed-out users; the page preview iframe
  showed the whole admin shell above the draft).
- Site colours from Globals were written onto --color-primary/--color-accent
  of the admin document, which are DaisyUI's theme variables — so the brand
  colour restyled every admin button (low-contrast white-on-sage) and flashed
  after hydration. Apply them only inside /preview; give the admin its own
  sage primary at ~5:1 contrast.
- Login page redesigned with DaisyUI 5 markup (full-width inputs, labels
  above), autocomplete hints, pending state.
- Navbar: active-route highlight, consistent button sizes, wraps instead of
  overflowing on narrow screens.
- Import: confirm before overwriting, show per-item errors instead of
  auto-reloading them away, friendly message for invalid JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 10:35:15 +00:00

38 lines
1.5 KiB
Svelte

<script lang="ts">
let { form } = $props();
let submitting = $state(false);
</script>
<svelte:head><title>Sign in | CMS</title></svelte:head>
<div class="grid min-h-screen place-items-center bg-base-200 p-4">
<div class="w-full max-w-sm">
<p class="mb-6 text-center text-lg font-bold tracking-tight">Massage CMS</p>
<form class="card bg-base-100 shadow-xl" method="POST" action="?/login" onsubmit={() => (submitting = true)}>
<div class="card-body gap-4">
<div>
<h1 class="text-2xl font-bold">Sign in</h1>
<p class="text-sm text-base-content/60">Use your CMS account to manage the website.</p>
</div>
{#if form?.message}
<div class="alert alert-error text-sm" role="alert">{form.message}</div>
{/if}
<fieldset class="fieldset gap-3 p-0">
<label class="flex flex-col gap-1">
<span class="fieldset-legend p-0">Email</span>
<!-- svelte-ignore a11y_autofocus -->
<input class="input w-full" name="email" type="email" autocomplete="username" defaultValue={form?.email ?? ''} required autofocus />
</label>
<label class="flex flex-col gap-1">
<span class="fieldset-legend p-0">Password</span>
<input class="input w-full" name="password" type="password" autocomplete="current-password" required />
</label>
</fieldset>
<button class="btn btn-primary w-full" type="submit" disabled={submitting}>
{#if submitting}<span class="loading loading-spinner loading-sm"></span>{/if}
Sign in
</button>
</div>
</form>
</div>
</div>