5dcadd1c20
Warm, friendly redesign replacing the generic cold-shadcn look. Built as a swappable token bundle so other presets can be added later; dark mode and the user-tunable accent hue are retained. Foundation - app.css: warm cream (light) + "dusk" (dark) token system; terracotta accent (default hue 16); pastel --room-* palette; vivid --status-* (dots/bars) plus AA-legible --status-*-ink (text); soft warm shadows; --radius 1rem; font tokens - Fonts: Fraunces (display) + Figtree (body), self-hosted in static/fonts (no Google CDN) so offline/LAN installs work; system-ui fallbacks kept - h1/h2/h3 render in Fraunces via base layer Chrome and surfaces - Sidebar, Header, home, AppCard/BoardCard, BoardHeader, sections, favorites - 29 widgets + integration renderers: cozy card shells, room-palette charts - Default background is a static warm "cozy" glow (mesh demoted, rAF gated on prefers-reduced-motion) System-wide - Status colors tokenized (no raw bg/text-*-500 or status hex); success/warning to status tokens, categorical to room palette, errors to destructive - Inputs rounded-xl; buttons rounded-xl; cards/dialogs rounded-[1.4rem]; soft-shadow vocabulary only; focus-visible:ring-primary/30 - Forms, admin tables (now cozy cards), dialogs, popovers, auth screens a11y: reduced-motion guards; darker status "ink" text for AA on cream. Known tradeoff: terracotta primary + white button text ~2.96:1 (signature color, user-tunable). Verified: svelte-check 0/0, build ok, 274 tests pass, eslint 0 errors. Design refs + system sheet in design-mockups/.
148 lines
5.6 KiB
Svelte
148 lines
5.6 KiB
Svelte
<script lang="ts">
|
|
import { t } from 'svelte-i18n';
|
|
import { superForm } from 'sveltekit-superforms';
|
|
import type { PageData } from './$types.js';
|
|
import AmbientBackground from '$lib/components/background/AmbientBackground.svelte';
|
|
|
|
let { data }: { data: PageData } = $props();
|
|
|
|
const { form, errors, enhance, submitting } = superForm(data.form);
|
|
|
|
const showLocalForm = $derived(data.authMode === 'local' || data.authMode === 'both');
|
|
const showOAuthButton = $derived(data.authMode === 'oauth' || data.authMode === 'both');
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<title>{$t('auth.login_submit')} — {$t('app_title')}</title>
|
|
</svelte:head>
|
|
|
|
<AmbientBackground />
|
|
|
|
<main class="relative z-10 flex min-h-screen items-center justify-center bg-background/80 p-4 text-foreground">
|
|
<div class="w-full max-w-md rounded-[1.6rem] border border-border bg-card/90 p-8 shadow-[var(--shadow-lift)] backdrop-blur-sm">
|
|
<div class="mb-8 text-center">
|
|
<div class="mx-auto mb-3 flex h-14 w-14 items-center justify-center rounded-2xl text-primary-foreground shadow-[var(--shadow-soft)]" style="background: linear-gradient(135deg, var(--room-peach), var(--room-terra));">
|
|
<svg
|
|
class="h-7 w-7"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<rect x="3" y="3" width="7" height="7" />
|
|
<rect x="14" y="3" width="7" height="7" />
|
|
<rect x="14" y="14" width="7" height="7" />
|
|
<rect x="3" y="14" width="7" height="7" />
|
|
</svg>
|
|
</div>
|
|
<h1 class="text-2xl font-bold text-card-foreground">{$t('auth.login_title')}</h1>
|
|
<p class="mt-1 text-sm text-muted-foreground">{$t('auth.login_subtitle')}</p>
|
|
</div>
|
|
|
|
{#if showOAuthButton}
|
|
<a
|
|
href="/auth/oauth/authorize"
|
|
class="flex w-full items-center justify-center gap-2 rounded-xl border border-border bg-background px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30"
|
|
>
|
|
<svg class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" />
|
|
<polyline points="10 17 15 12 10 7" />
|
|
<line x1="15" y1="12" x2="3" y2="12" />
|
|
</svg>
|
|
{$t('auth.oauth_signin')}
|
|
</a>
|
|
{/if}
|
|
|
|
{#if showOAuthButton && showLocalForm}
|
|
<div class="relative my-4">
|
|
<div class="absolute inset-0 flex items-center">
|
|
<div class="w-full border-t border-border"></div>
|
|
</div>
|
|
<div class="relative flex justify-center text-xs uppercase">
|
|
<span class="bg-card px-2 text-muted-foreground">{$t('auth.or')}</span>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
|
|
{#if showLocalForm}
|
|
<form method="POST" use:enhance class="space-y-4">
|
|
<div>
|
|
<label for="email" class="mb-1 block text-sm font-medium text-card-foreground">
|
|
{$t('auth.email')}
|
|
</label>
|
|
<input
|
|
id="email"
|
|
name="email"
|
|
type="email"
|
|
autocomplete="email"
|
|
bind:value={$form.email}
|
|
class="w-full rounded-xl border border-input bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30"
|
|
placeholder={$t('auth.email_placeholder')}
|
|
/>
|
|
{#if $errors.email}
|
|
<p class="mt-1 text-sm text-destructive">{$errors.email[0]}</p>
|
|
{/if}
|
|
</div>
|
|
|
|
<div>
|
|
<label for="password" class="mb-1 block text-sm font-medium text-card-foreground">
|
|
{$t('auth.password')}
|
|
</label>
|
|
<input
|
|
id="password"
|
|
name="password"
|
|
type="password"
|
|
autocomplete="current-password"
|
|
bind:value={$form.password}
|
|
class="w-full rounded-xl border border-input bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-muted-foreground transition-colors focus:border-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30"
|
|
placeholder={$t('auth.password_placeholder')}
|
|
/>
|
|
{#if $errors.password}
|
|
<p class="mt-1 text-sm text-destructive">{$errors.password[0]}</p>
|
|
{/if}
|
|
</div>
|
|
|
|
<div class="flex items-center justify-between gap-4">
|
|
<label class="flex items-center gap-2 text-sm text-muted-foreground">
|
|
<input
|
|
type="checkbox"
|
|
name="rememberMe"
|
|
bind:checked={$form.rememberMe}
|
|
class="h-4 w-4 rounded border-input text-primary focus-visible:ring-2 focus-visible:ring-primary/30"
|
|
/>
|
|
<span>{$t('auth.remember_me')}</span>
|
|
</label>
|
|
<a href="/forgot-password" class="text-xs text-primary hover:underline">
|
|
{$t('auth.forgot_password')}
|
|
</a>
|
|
</div>
|
|
|
|
<button
|
|
type="submit"
|
|
disabled={$submitting}
|
|
class="w-full rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground shadow-[var(--shadow-soft)] transition-all hover:-translate-y-0.5 hover:bg-primary/90 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-50"
|
|
>
|
|
{#if $submitting}
|
|
<span class="flex items-center justify-center gap-2">
|
|
<span class="h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground border-t-transparent"></span>
|
|
{$t('auth.login_submitting')}
|
|
</span>
|
|
{:else}
|
|
{$t('auth.login_submit')}
|
|
{/if}
|
|
</button>
|
|
</form>
|
|
{/if}
|
|
|
|
{#if showLocalForm}
|
|
<p class="mt-6 text-center text-sm text-muted-foreground">
|
|
{$t('auth.no_account')}
|
|
<a href="/register" class="font-medium text-primary hover:underline">{$t('auth.register')}</a>
|
|
</p>
|
|
{/if}
|
|
</div>
|
|
</main>
|