The logo is a pulse that ends in the green status dot. It replaces the plain wordmark in the console, sign-in, legal and API documentation headers and marks status page footers. Every page links an SVG favicon that follows the browser's light or dark scheme, a PNG fallback, an Apple touch icon and a web manifest; the README shows the logo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
112 lines
3.7 KiB
Templ
112 lines
3.7 KiB
Templ
package web
|
|
|
|
import (
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
|
)
|
|
|
|
templ legalLink(l LegalLink) {
|
|
if l.External {
|
|
<a href={ templ.SafeURL(l.Href) } rel="noopener" class="hover:text-ink">{ i18n.T(ctx, LegalTitleID(l.Kind)) }</a>
|
|
} else {
|
|
<a href={ templ.SafeURL(l.Href) } class="hover:text-ink">{ i18n.T(ctx, LegalTitleID(l.Kind)) }</a>
|
|
}
|
|
}
|
|
|
|
// siteFooter links the API documentation and the platform's legal
|
|
// documents.
|
|
templ siteFooter(links []LegalLink) {
|
|
<footer class="mx-auto flex w-full max-w-5xl justify-end gap-4 px-6 py-6 font-mono text-xs text-muted">
|
|
<a href="/api/docs" class="hover:text-ink">{ i18n.T(ctx, "apidocs.footer") }</a>
|
|
for _, l := range links {
|
|
@legalLink(l)
|
|
}
|
|
</footer>
|
|
}
|
|
|
|
templ legalBody(html string) {
|
|
<article class="legal-text max-w-2xl">
|
|
@templ.Raw(html)
|
|
</article>
|
|
}
|
|
|
|
// LegalPage shows a platform legal document.
|
|
// LegalPage shows a platform legal document: inside the console for
|
|
// signed-in users, with a plain header for everyone else, who must be able
|
|
// to read it too.
|
|
templ LegalPage(p Page, me *Me, html string) {
|
|
if me != nil {
|
|
@consoleShell(p, *me) {
|
|
@legalBody(html)
|
|
}
|
|
} else {
|
|
@Layout(p) {
|
|
<header class="border-b border-rule">
|
|
<div class="mx-auto flex max-w-5xl items-center justify-between gap-6 px-6 py-3 text-sm">
|
|
@brandLockup("/")
|
|
<div class="flex items-center gap-5">
|
|
<a href="/login" class="text-muted hover:text-ink">{ i18n.T(ctx, "auth.login.title") }</a>
|
|
@languageSwitch(p.Languages)
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<main class="mx-auto max-w-5xl px-6 py-10">
|
|
@legalBody(html)
|
|
</main>
|
|
}
|
|
}
|
|
}
|
|
|
|
// PublicLegalPage shows a legal document of a status page.
|
|
templ PublicLegalPage(s agentapi.PageSnapshot, a PublicAssets, kind, html, back string) {
|
|
<!DOCTYPE html>
|
|
<html lang={ i18n.Lang(ctx) }>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>{ i18n.T(ctx, LegalTitleID(kind)) } · { s.Title }</title>
|
|
@faviconLinks()
|
|
<link rel="stylesheet" href={ a.CSSHref }/>
|
|
</head>
|
|
<body class="min-h-screen">
|
|
<main class="mx-auto max-w-3xl px-6 py-14">
|
|
<p class="mb-10"><a href={ templ.SafeURL(back) } class="text-sm text-muted hover:text-ink">{ "← " + s.Title }</a></p>
|
|
@legalBody(html)
|
|
</main>
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
// LegalForm is the stored state of one legal document.
|
|
type LegalForm struct {
|
|
Kind string
|
|
URL string
|
|
Markdown string
|
|
}
|
|
|
|
// LegalSettingsPage edits legal documents. apiBase plus the kind is the
|
|
// endpoint each form saves to.
|
|
templ LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, docs []LegalForm) {
|
|
@consoleShell(p, me) {
|
|
@settingsHeading(titleID, introID)
|
|
for _, d := range docs {
|
|
<section class="mb-12 max-w-2xl">
|
|
@sectionHeading(LegalTitleID(d.Kind))
|
|
<form data-api={ apiBase + d.Kind } data-method="put" data-next={ next }>
|
|
@formError()
|
|
<label class="mb-4 block">
|
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "legal.url") }</span>
|
|
<input type="url" name="url" value={ d.URL } placeholder="https://" class="w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"/>
|
|
</label>
|
|
<div class="mb-1">
|
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "legal.markdown") }</span>
|
|
@MarkdownEditor("markdown", d.Markdown, 14, 100000, MarkdownDocument)
|
|
</div>
|
|
<p class="mb-4 text-xs text-muted">{ i18n.T(ctx, "legal.hint") }</p>
|
|
@submit(i18n.T(ctx, "common.save"))
|
|
</form>
|
|
</section>
|
|
}
|
|
}
|
|
}
|