From 3c0655b512c8e1a63ca7f0ce3b78607d3e289e98 Mon Sep 17 00:00:00 2001 From: Astra Date: Sat, 3 Oct 2026 14:14:16 +0100 Subject: [PATCH] Notifications page: switches before the text on phones, one Coming later tag --- internal/web/assets/admin.js | 12 ++++++------ internal/web/assets/styles.css | 7 +++++-- internal/web/notify.go | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/internal/web/assets/admin.js b/internal/web/assets/admin.js index 3383f80..9605471 100644 --- a/internal/web/assets/admin.js +++ b/internal/web/assets/admin.js @@ -556,10 +556,12 @@ async function notifications() { // The count row is only worth showing when there's a device besides this one. const total = d.devices.length; const others = total - (here ? 1 : 0); - const row = (label, help, control) => `
+ const row = (label, help, control, cls = "") => `
${label}${help ? `

${help}

` : ""}
${control}
`; + // A row whose control is one switch: on phones the switch goes before the text. + const toggle = (label, help, sw) => row(label, help, sw, " toggle"); let device; if (!d.available) device = row("This device", "Notifications aren't set up on the panel. Its log says why.", 'Unavailable'); @@ -582,16 +584,14 @@ async function notifications() {

Quiet hours

Nothing is sent between these times, in your timezone (${esc(browserTimezone())}).

- ${row("Quiet hours", "", ``)} + ${toggle("Quiet hours", "", ``)} ${row("From and until", "", `
to
`)}

What to send

For all your devices.

- ${d.types.map((t) => row(esc(t.label), t.help ? esc(t.help) : "", - t.ready - ? `` - : `Coming later`)).join("")} + ${d.types.map((t) => toggle(esc(t.label) + (t.ready ? "" : ' Coming later'), t.help ? esc(t.help) : "", + ``)).join("")}
`; } diff --git a/internal/web/assets/styles.css b/internal/web/assets/styles.css index 40a3410..9e1ef32 100644 --- a/internal/web/assets/styles.css +++ b/internal/web/assets/styles.css @@ -676,11 +676,11 @@ td.num, th.num { text-align: right; white-space: nowrap; } .setting p { margin: 2px 0 0; color: var(--muted); font-size: 14px; } .setting .control { display: flex; justify-content: flex-end; } .setting code { font: 13px ui-monospace, "Cascadia Mono", Menlo, monospace; color: var(--faint); } -.setting .control .tag + .switch { margin-left: 10px; } +.setting b .tag { margin-left: 6px; vertical-align: 1px; } /* Notifications page. */ .quiet-times { display: flex; align-items: center; gap: 8px; } -.quiet-times .input { width: 120px; } +.quiet-times .input { width: 136px; min-width: 0; } .savebar { position: sticky; @@ -846,6 +846,9 @@ dialog::backdrop { background: rgba(5, 6, 9, 0.65); } .live-map { font-size: 42px; } .setting { grid-template-columns: 1fr; gap: 10px; } .setting .control { justify-content: flex-start; } + .setting.toggle { grid-template-columns: auto minmax(0, 1fr); gap: 14px; } + .setting.toggle .control { order: -1; } + .quiet-times .input { flex: 1; width: auto; } .action-grid { grid-template-columns: repeat(2, 1fr); } .hide-sm { display: none; } th, td { padding-left: 12px; padding-right: 12px; } diff --git a/internal/web/notify.go b/internal/web/notify.go index 64815ae..b74ffbd 100644 --- a/internal/web/notify.go +++ b/internal/web/notify.go @@ -41,8 +41,8 @@ var notifyTypes = []notifyType{ {Key: "silence", Label: "Silence added", Ready: true}, {Key: "unsilence", Label: "Silence lifted", Ready: true}, {Key: "server", Label: "Server down and back up", Help: "When the panel loses the game server for 30 seconds, and when it's back.", Ready: true}, - {Key: "livescore", Label: "Live score", Help: "An updating scoreboard while people are playing. Coming later."}, - {Key: "calladmin", Label: "Admin called", Help: "A player asks for an admin in game. Needs a server plugin, coming later."}, + {Key: "livescore", Label: "Live score", Help: "An updating scoreboard while people are playing."}, + {Key: "calladmin", Label: "Admin called", Help: "A player asks for an admin in game. Needs a server plugin."}, } // readyTypes are the keys that can be switched on, which is also everyone's default.