package web import "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n" // PageRow is a status page in the list. type PageRow struct { ID string Title string Slug string Published bool URL string Domain string } // PagesView is the data of the status page list. type PagesView struct { Pages []PageRow CanWrite bool } templ StatusPagesPage(p Page, me Me, v PagesView) { @consoleShell(p, me) { @settingsHeading("pages.title", "pages.intro") if len(v.Pages) > 0 { } if v.CanWrite {
@sectionHeading("pages.create")
@formError() @valueField(i18n.T(ctx, "pages.page_title"), "title", "", "Acme status", true) @valueField(i18n.T(ctx, "pages.slug"), "slug", "", "acme", true) @submit(i18n.T(ctx, "pages.create"))
} } } // PageMonitorOption is a monitor in the page editor. type PageMonitorOption struct { ID string Name string Included bool Section string Label string } // PageEditor is the data of the status page editor. type PageEditor struct { ID string Title string Slug string Description string Published bool Accent string LogoURL string CSS string URL string Domain string DomainVerified bool RecordName string RecordValue string Monitors []PageMonitorOption } templ StatusPageEditor(p Page, me Me, e PageEditor) { @consoleShell(p, me) {

← { i18n.T(ctx, "pages.title") }

{ e.Title }

if e.Published { { i18n.T(ctx, "pages.open") } ↗ } { i18n.T(ctx, "pages.export") }
@sectionHeading("pages.settings")
@formError() @valueField(i18n.T(ctx, "pages.page_title"), "title", e.Title, "", true) @valueField(i18n.T(ctx, "pages.slug"), "slug", e.Slug, "", true)
{ i18n.T(ctx, "pages.description") } @MarkdownEditor("description", e.Description, 5, 10000, MarkdownInline)
@checkbox(i18n.T(ctx, "pages.published"), "published", e.Published)

{ i18n.T(ctx, "pages.theme") }

@valueField(i18n.T(ctx, "pages.accent"), "theme.accent", e.Accent, "#1f6feb", false) @valueField(i18n.T(ctx, "pages.logo"), "theme.logo_url", e.LogoURL, "https://example.com/logo.svg", false) @submit(i18n.T(ctx, "common.save"))
@sectionHeading("pages.components")
@formError() if len(e.Monitors) == 0 {

{ i18n.T(ctx, "console.monitors.empty") }

}
    for _, m := range e.Monitors {
  • { m.Name }
  • }
@submit(i18n.T(ctx, "common.save"))
@sectionHeading("pages.domain")
@formError() @valueField(i18n.T(ctx, "pages.domain_name"), "domain", e.Domain, "status.example.com", false) @submit(i18n.T(ctx, "common.save"))
if e.Domain != "" {
if e.DomainVerified {

● { i18n.T(ctx, "pages.domain_verified") }

{ i18n.T(ctx, "pages.domain_cname") }

} else {

{ i18n.T(ctx, "pages.domain_instructions") }

TXT
{ e.RecordName }
{ i18n.T(ctx, "pages.value") }
{ e.RecordValue }
}
}
} }