Files
uptimesebi/internal/web/layout.templ
Sebastian UnterschützandClaude Opus 5.5 01981826c8
ci / image (pull_request) Successful in 4m36s
ci / lint (pull_request) Successful in 5m10s
ci / test (pull_request) Successful in 5m58s
ci / build (pull_request) Successful in 6m33s
feat(web): spell the product UptimeSebi and give the wordmark its weight
The wordmark next to the logo is set in the sans face, semibold and at
body size instead of small monospace. Page titles, status page footers,
the web manifest, the API document, PDF exports, test emails and the
README use the name UptimeSebi; technical identifiers stay lowercase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
2026-11-22 15:44:47 +01:00

108 lines
3.0 KiB
Templ

package web
import (
"strconv"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
// Page carries what every rendered page needs besides its own content.
type Page struct {
TitleID string
CSRF string
Languages []string
// ErrorID and NoticeID name catalog messages shown above the content,
// typically after a redirect back from an SSO flow.
ErrorID string
NoticeID string
// Legal links the platform's legal notice and privacy policy.
Legal []LegalLink
// RefreshSeconds reloads pages that show live state.
RefreshSeconds int
}
templ Layout(p Page) {
<!DOCTYPE html>
<html lang={ i18n.Lang(ctx) }>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
if p.CSRF != "" {
<meta name="csrf-token" content={ p.CSRF }/>
}
if p.RefreshSeconds > 0 {
<meta http-equiv="refresh" content={ strconv.Itoa(p.RefreshSeconds) }/>
}
<title>{ i18n.T(ctx, p.TitleID) } · UptimeSebi</title>
@faviconLinks()
<link rel="stylesheet" href="/static/dist/app.css"/>
<script src="/static/dist/axios.min.js" defer></script>
<script src="/static/dist/app.js" defer></script>
</head>
<body class="flex min-h-screen flex-col" data-msg-network={ i18n.T(ctx, "app.network_error") }>
<div class="flex-1">
{ children... }
</div>
@siteFooter(p.Legal)
</body>
</html>
}
templ languageSwitch(langs []string) {
<span class="flex gap-2 font-mono text-xs">
for _, l := range langs {
if l == i18n.Lang(ctx) {
<span class="text-ink" aria-current="true">{ l }</span>
} else {
<button type="button" data-locale={ l } class="text-muted hover:text-ink" title={ i18n.T(ctx, "lang."+l) }>{ l }</button>
}
}
</span>
}
templ authShell(p Page) {
@Layout(p) {
<main class="mx-auto mt-[12vh] w-full max-w-sm px-6">
<div class="mb-10 flex items-center justify-between">
@brandLockup("/")
@languageSwitch(p.Languages)
</div>
<h1 class="mb-6 text-xl font-semibold">{ i18n.T(ctx, p.TitleID) }</h1>
@flash(p)
{ children... }
</main>
}
}
templ field(label, name, typ, autocomplete string, required bool) {
<label class="mb-4 block">
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ label }</span>
<input
class="w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink"
type={ typ }
name={ name }
autocomplete={ autocomplete }
required?={ required }
/>
</label>
}
templ submit(label string) {
<button type="submit" class="mt-2 w-full bg-ink px-3 py-2 text-sm font-medium text-paper hover:opacity-90 disabled:opacity-50">
{ label }
</button>
}
templ flash(p Page) {
if p.ErrorID != "" {
<p class="mb-6 border-l-2 border-down pl-2 text-sm text-down">{ i18n.T(ctx, p.ErrorID) }</p>
}
if p.NoticeID != "" {
<p class="mb-6 border-l-2 border-up pl-2 text-sm">{ i18n.T(ctx, p.NoticeID) }</p>
}
}
templ formError() {
<p data-error class="mb-4 hidden border-l-2 border-down pl-2 text-sm text-down"></p>
}