Files
bookhoard/templates/login.templ
T
John O'Keefe d5bb874651 feat(themes): Omarchy catalog, 12 light themes, Dark/Light Appearance picker
Expand the catalog from 11 themes (10 dark, 1 light) to 37 (24/13):
all 18 remaining Omarchy defaults (palettes from each theme's
colors.toml) plus 8 canonical light themes (Tokyo Night Day, Solarized
Light, One Light, Ayu Light, GitHub Light, Gruvbox Light, Everforest
Light, Kanagawa Lotus). Lupine leads the light list as the default
light theme; the app default stays tokyo-night.

Appearance panel: Dark/Light segmented filter (SSR-initialized from the
user's current theme), scrollable theme list, Bookshelf section pinned;
active row revealed on open. Light themes carry color-scheme: light and
the soft-shadow token set. Public-page theme selects get Dark/Light
optgroups. New moon/sun icons.

tailwind.config: safelist the new theme ids — Tailwind v3 purges custom
@layer base class selectors that appear in no scanned content file, so
an unsafelisted id silently ships without its CSS (found the hard way).

theme.ts: applyTheme now swaps only theme-* classes (changing theme
from the login select no longer wipes min-h-screen) and keeps the class
in sync on <html> for the new ThemeFlashGuard — a pre-paint inline
script on the four public pages that applies the saved theme before
first paint.

Kanagawa's UI accent uses crystalBlue (#7e9cd8) instead of Omarchy's
foreground-as-accent so links stay distinguishable from text.
2026-10-18 12:08:07 -04:00

75 lines
3.2 KiB
Templ

package templates
templ Login(sessionExpired bool, deleted bool, registrationEnabled bool) {
<!DOCTYPE html>
<html lang="en">
<head>
@ThemeFlashGuard()
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Login - Bookhoard</title>
<script src="/static/htmx.min.js"></script>
<script type="module" src="/static/main.js"></script>
<link href="/static/style.css" rel="stylesheet"/>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg"/>
</head>
<body class="theme-tokyo-night min-h-screen" x-data="login" x-init="initLoginTheme()">
<div class="brand-gradient min-h-screen flex flex-col items-center justify-center p-4 relative">
<select
id="theme-select"
@change="changeTheme()"
class="input absolute top-4 right-4 w-auto py-1.5 pr-8 text-sm cursor-pointer"
aria-label="Theme"
>
<optgroup label="Dark">
for _, opt := range ThemeOptionsFor(ModeDark) {
<option value={ opt.Name }>{ opt.Label }</option>
}
</optgroup>
<optgroup label="Light">
for _, opt := range ThemeOptionsFor(ModeLight) {
<option value={ opt.Name }>{ opt.Label }</option>
}
</optgroup>
</select>
<div class="w-full max-w-sm">
<a href="/" class="flex items-center justify-center gap-2.5 mb-8">
<span class="text-3xl">📚</span>
<span class="text-2xl font-bold tracking-tight" style="color: var(--text-primary)">Bookhoard</span>
</a>
if sessionExpired {
<div class="mb-4 p-3 rounded-xl flex items-start gap-2" style="background-color: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid var(--accent);">
@Icon("info", "h-5 w-5 shrink-0")
<p class="text-sm" style="color: var(--text-primary)">Your session has expired. Please log in again to continue.</p>
</div>
}
if deleted {
<div class="mb-4 p-3 rounded-xl flex items-start gap-2" style="background-color: color-mix(in srgb, var(--status-success) 14%, transparent); border: 1px solid var(--status-success);">
@Icon("check-circle", "h-5 w-5 shrink-0")
<p class="text-sm" style="color: var(--text-primary)">Your account has been deleted successfully.</p>
</div>
}
<form hx-post="/api/auth/login" hx-target="#result" hx-swap="innerHTML" class="card p-6 space-y-4">
<div>
<label class="block text-xs font-semibold uppercase tracking-wide mb-2" style="color: var(--text-secondary)">Email or Username</label>
<input type="text" name="login" class="input" required/>
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wide mb-2" style="color: var(--text-secondary)">Password</label>
<input type="password" name="password" class="input" required/>
</div>
<button type="submit" class="btn btn-primary w-full py-2.5">Sign In</button>
</form>
<div id="result" class="mt-4 text-center text-sm"></div>
if registrationEnabled {
<p class="text-center mt-6 text-sm" style="color: var(--text-secondary)">
Don't have an account?
<a href="/register" class="font-medium hover:underline" style="color: var(--accent)">Sign up</a>
</p>
}
</div>
</div>
</body>
</html>
}