Files
uptimesebi/internal/web/public.templ
T
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

159 lines
5.6 KiB
Templ
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package web
import (
"strings"
"time"
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
)
templ PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) {
<!DOCTYPE html>
<html lang={ i18n.Lang(ctx) }>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="refresh" content="60"/>
<title>{ s.Title }</title>
if a.InlineCSS == "" {
@faviconLinks()
}
if a.InlineCSS != "" {
@templ.Raw("<style>" + a.InlineCSS + "</style>")
} else {
<link rel="stylesheet" href={ a.CSSHref }/>
}
if s.Theme.Accent != "" {
@templ.Raw("<style>:root{--page-accent:" + s.Theme.Accent + "}</style>")
}
if s.Theme.CSS != "" {
@templ.Raw("<style>" + s.Theme.CSS + "</style>")
}
</head>
<body class="min-h-screen">
<main class="mx-auto max-w-3xl px-6 py-14">
<header class="mb-10">
if s.Theme.LogoURL != "" {
<img src={ s.Theme.LogoURL } alt={ s.Title } class="mb-6 h-10"/>
}
<h1 class="text-2xl font-semibold" style="color:var(--page-accent,inherit)">{ s.Title }</h1>
if s.Description != "" {
<div class="legal-text mt-2 text-muted">
@templ.Raw(Markdown(s.Description))
</div>
}
</header>
if !a.StaleSince.IsZero() {
<p class="mb-6 border border-degraded/50 bg-degraded/10 px-4 py-2 text-sm">
{ i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC") }
</p>
}
<section
class={ "mb-12 border-l-4 py-3 pl-4",
templ.KV("border-up", s.Status == agentapi.PageOperational),
templ.KV("border-degraded", s.Status == agentapi.PageDegraded),
templ.KV("border-down", s.Status == agentapi.PageOutage),
templ.KV("border-unknown", s.Status == agentapi.PageUnknown),
templ.KV("border-maintenance", s.Status == agentapi.PageUnderMaintenance) }
>
<p class="text-lg font-medium">{ i18n.T(ctx, "page.status."+s.Status) }</p>
</section>
@pageMaintenance(i18n.T(ctx, "page.maintenance_ongoing"), s.Ongoing(a.Now))
for _, sec := range s.Sections {
<section class="mb-10">
if sec.Name != "" {
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ sec.Name }</h2>
}
<ul class="divide-y divide-rule border-y border-rule">
for _, comp := range sec.Components {
<li class="py-3">
<div class="mb-2 flex items-center gap-2.5">
@statusDot(PageStatus(comp.Status))
<span>{ comp.Name }</span>
<span class="ml-auto text-sm text-muted">{ i18n.T(ctx, "page.component."+comp.Status) }</span>
</div>
@bars(DayBars(comp.Days), 22)
<div class="mt-1 flex justify-between font-mono text-xs text-muted">
<span>{ i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)) }</span>
<span>{ UptimeText(comp.Uptime) }</span>
<span>{ i18n.T(ctx, "page.today") }</span>
</div>
</li>
}
</ul>
</section>
}
@pageMaintenance(i18n.T(ctx, "page.maintenance_upcoming"), s.Upcoming(a.Now))
<section class="mb-12">
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "page.incidents") }</h2>
if len(s.Incidents) == 0 {
<p class="text-sm text-muted">{ i18n.T(ctx, "page.no_incidents") }</p>
} else {
<ul class="divide-y divide-rule border-y border-rule text-sm">
for _, inc := range s.Incidents {
<li class="flex flex-wrap items-baseline gap-x-4 gap-y-1 py-2.5">
if inc.ResolvedAt == nil {
<span class="font-medium text-down">{ i18n.T(ctx, "incidents.ongoing") }</span>
} else {
<span class="text-up">{ i18n.T(ctx, "incidents.resolved") }</span>
}
<span>{ inc.Component }</span>
<span class="ml-auto font-mono text-xs text-muted">
{ inc.StartedAt.UTC().Format("2006-01-02 15:04") }
if inc.ResolvedAt != nil {
– { inc.ResolvedAt.UTC().Format("15:04") }
}
UTC
</span>
</li>
}
</ul>
}
</section>
<footer class="flex justify-between border-t border-rule pt-4 font-mono text-xs text-muted">
<span>{ i18n.T(ctx, "page.updated", "Time", s.GeneratedAt.UTC().Format(time.DateTime)+" UTC") }</span>
<span class="flex gap-4">
for _, l := range PageLegalLinks(s, a.LegalBase) {
@legalLink(l)
}
<span class="flex items-center gap-1">
@brandMark("h-3.5 w-3.5")
UptimeSebi
</span>
</span>
</footer>
</main>
</body>
</html>
}
templ pageMaintenance(heading string, items []agentapi.PageMaintenance) {
if len(items) > 0 {
<section class="mb-12">
<h2 class="mb-3 text-xs font-medium uppercase tracking-wider text-muted">{ heading }</h2>
<ul class="divide-y divide-rule border-y border-rule text-sm">
for _, m := range items {
<li class="py-3">
<div class="flex flex-wrap items-baseline gap-x-4 gap-y-1">
<span class="flex items-center gap-2 font-medium">
@statusDot(StatusMaintenance)
{ m.Title }
</span>
<span class="ml-auto font-mono text-xs text-muted">
{ m.Start.UTC().Format("2006-01-02 15:04") + " – " + m.End.UTC().Format("15:04") + " UTC" }
</span>
</div>
<p class="ml-4 mt-1 text-xs text-muted">{ strings.Join(m.Components, ", ") }</p>
if m.Description != "" {
<div class="legal-text ml-4 mt-2 text-muted">
@templ.Raw(Markdown(m.Description))
</div>
}
</li>
}
</ul>
</section>
}
}