ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m4s
ci / test (pull_request) Successful in 11m52s
ci / build (pull_request) Successful in 17m48s
ci / image (pull_request) Successful in 5m28s
- The console header folds its navigation into a menu below 1024px. - Pages use narrower gutters on phones. - Monitor rows keep name and uptime in place on narrow screens. - Toolbars and the range switch wrap. - Tables scroll sideways instead of squeezing their columns. - Form fields keep 16px text on touch screens so iOS does not zoom in. - The status page footer wraps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
119 lines
4.0 KiB
Templ
119 lines
4.0 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-4 sm: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
|
|
// Consent marks documents every account accepts, which can be put
|
|
// before everyone again.
|
|
Consent bool
|
|
}
|
|
|
|
// 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>
|
|
if d.Consent {
|
|
@checkbox(i18n.T(ctx, "legal.new_version"), "new_version", false)
|
|
<p class="-mt-2 mb-4 ml-6 text-xs text-muted">{ i18n.T(ctx, "legal.new_version_hint") }</p>
|
|
}
|
|
@submit(i18n.T(ctx, "common.save"))
|
|
</form>
|
|
</section>
|
|
}
|
|
}
|
|
}
|