229f89fee2
P1-28: Tailwind standalone CLI wired into the Makefile. `make tailwind` downloads the pinned v3.4.17 binary into bin/tailwindcss (gitignored), builds web/styles/input.css → web/static/css/styles.css. `make build` now runs the CSS pass first; `make tailwind-watch` for dev. Output is embedded in the binary via web.FS — single static binary, no Node. The CSS source carries every component class the v1 mockups defined (status dots, buttons, host row, log viewer, progress bar, fields, chips, snippet panel, empty state) so screens that land later can just reach for them. P1-23: html/template tree at web/templates with two layouts (base with chrome, chromeless for login + bootstrap), one nav partial, and two pages (dashboard placeholder, login). internal/server/ui parses the tree at startup; ui_handlers.go in the http package wires: GET / dashboard (303 → /login when unauthed) GET /login sign-in form POST /login consume form, mint session cookie, 303 → / POST /logout drop cookie, 303 → /login GET /static/* embedded Tailwind bundle The HTML login flow shares store/session logic with /api/auth/login via a new authenticateAndSession helper — same security guarantees, two surface representations (HTML form / JSON). Verified end-to-end: bootstrap → form-login → authed dashboard → sign-out → 303 cycle works in the browser; Tailwind output emits only the component classes referenced in the live templates (9.6kB minified). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
42 lines
1.7 KiB
HTML
42 lines
1.7 KiB
HTML
{{define "nav"}}
|
|
<header>
|
|
<!-- top bar -->
|
|
<div class="hairline">
|
|
<div class="max-w-[1280px] mx-auto px-8 flex items-center justify-between py-4">
|
|
<div class="flex items-center gap-3">
|
|
<a href="/" class="mono text-[13px] text-ink font-medium tracking-[0.02em] no-underline">restic-manager</a>
|
|
<span class="mono text-[11px] text-ink-fade">{{.Version}}</span>
|
|
</div>
|
|
<div class="flex items-center gap-5">
|
|
{{if .User}}
|
|
<span class="mono text-xs text-ink-mute">{{.User.Username}}</span>
|
|
<form method="post" action="/logout" class="inline">
|
|
<button class="btn btn-ghost" type="submit">Sign out</button>
|
|
</form>
|
|
{{else}}
|
|
<a href="/login" class="btn btn-ghost">Sign in</a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- primary nav -->
|
|
<div class="hairline">
|
|
<div class="max-w-[1280px] mx-auto px-8 flex items-end justify-between">
|
|
<nav class="flex items-end">
|
|
<a href="/" class="nav-tab {{if eq .Active "dashboard"}}active{{end}}">Dashboard</a>
|
|
<a href="/repos" class="nav-tab {{if eq .Active "repos"}}active{{end}}">Repos</a>
|
|
<a href="/alerts" class="nav-tab {{if eq .Active "alerts"}}active{{end}}">Alerts{{if .OpenAlerts}} <span class="mono ml-1.5 text-[11px] text-bad">{{.OpenAlerts}}</span>{{end}}</a>
|
|
<a href="/audit" class="nav-tab {{if eq .Active "audit"}}active{{end}}">Audit</a>
|
|
<a href="/settings" class="nav-tab {{if eq .Active "settings"}}active{{end}}">Settings</a>
|
|
</nav>
|
|
{{if .User}}
|
|
<div class="pb-3">
|
|
<a href="/hosts/new" class="btn btn-primary">+ Add host</a>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</header>
|
|
{{end}}
|