Notifications page: one list of toggles, without group headings
This commit is contained in:
parent
a6960c25a2
commit
5863639e1a
3 changed files with 15 additions and 25 deletions
|
|
@ -569,7 +569,6 @@ async function notifications() {
|
||||||
else device = row("This device", "Turn notifications on to get the ones picked below here, even with the panel closed.", '<button class="btn primary" type="button" data-act="notif-on">Turn on</button>');
|
else device = row("This device", "Turn notifications on to get the ones picked below here, even with the panel closed.", '<button class="btn primary" type="button" data-act="notif-on">Turn on</button>');
|
||||||
|
|
||||||
const dis = d.available ? "" : "disabled";
|
const dis = d.available ? "" : "disabled";
|
||||||
const groups = [...new Set(d.types.map((t) => t.group))];
|
|
||||||
v.innerHTML = `
|
v.innerHTML = `
|
||||||
<div class="page-head">
|
<div class="page-head">
|
||||||
<div><h1>Notifications</h1><p class="sub">Get bans, gags, mutes and server alerts on your phone or computer. Nothing about your own actions is sent to you.</p></div>
|
<div><h1>Notifications</h1><p class="sub">Get bans, gags, mutes and server alerts on your phone or computer. Nothing about your own actions is sent to you.</p></div>
|
||||||
|
|
@ -589,11 +588,10 @@ async function notifications() {
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<div class="panel-head"><div><h2>What to send</h2><p>For all your devices.</p></div></div>
|
<div class="panel-head"><div><h2>What to send</h2><p>For all your devices.</p></div></div>
|
||||||
${groups.map((g) => `<div class="notif-group">${esc(g)}</div>
|
${d.types.map((t) => row(esc(t.label), t.help ? esc(t.help) : "",
|
||||||
${d.types.filter((t) => t.group === g).map((t) => row(esc(t.label), t.help ? esc(t.help) : "",
|
|
||||||
t.ready
|
t.ready
|
||||||
? `<button class="switch" type="button" role="switch" aria-checked="${p.types.includes(t.key)}" aria-label="${esc(t.label)}" data-ntype="${esc(t.key)}" ${dis}></button>`
|
? `<button class="switch" type="button" role="switch" aria-checked="${p.types.includes(t.key)}" aria-label="${esc(t.label)}" data-ntype="${esc(t.key)}" ${dis}></button>`
|
||||||
: `<span class="tag">Coming later</span><button class="switch" type="button" role="switch" aria-checked="false" aria-label="${esc(t.label)}" disabled></button>`)).join("")}`).join("")}
|
: `<span class="tag">Coming later</span><button class="switch" type="button" role="switch" aria-checked="false" aria-label="${esc(t.label)}" disabled></button>`)).join("")}
|
||||||
</section>
|
</section>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -679,13 +679,6 @@ td.num, th.num { text-align: right; white-space: nowrap; }
|
||||||
.setting .control .tag + .switch { margin-left: 10px; }
|
.setting .control .tag + .switch { margin-left: 10px; }
|
||||||
|
|
||||||
/* Notifications page. */
|
/* Notifications page. */
|
||||||
.notif-group {
|
|
||||||
padding: 14px 18px 2px;
|
|
||||||
color: var(--faint);
|
|
||||||
font: 600 12px var(--body);
|
|
||||||
letter-spacing: 0.06em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
.quiet-times { display: flex; align-items: center; gap: 8px; }
|
.quiet-times { display: flex; align-items: center; gap: 8px; }
|
||||||
.quiet-times .input { width: 120px; }
|
.quiet-times .input { width: 120px; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,24 +26,23 @@ import (
|
||||||
// send yet: the page shows them, switched off.
|
// send yet: the page shows them, switched off.
|
||||||
type notifyType struct {
|
type notifyType struct {
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Group string `json:"group"`
|
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
Help string `json:"help,omitempty"`
|
Help string `json:"help,omitempty"`
|
||||||
Ready bool `json:"ready"`
|
Ready bool `json:"ready"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var notifyTypes = []notifyType{
|
var notifyTypes = []notifyType{
|
||||||
{Key: "ban", Group: "Bans", Label: "Ban added", Ready: true},
|
{Key: "ban", Label: "Ban added", Ready: true},
|
||||||
{Key: "unban", Group: "Bans", Label: "Ban lifted", Ready: true},
|
{Key: "unban", Label: "Ban lifted", Ready: true},
|
||||||
{Key: "gag", Group: "Gags", Label: "Gag added", Ready: true},
|
{Key: "gag", Label: "Gag added", Ready: true},
|
||||||
{Key: "ungag", Group: "Gags", Label: "Gag lifted", Ready: true},
|
{Key: "ungag", Label: "Gag lifted", Ready: true},
|
||||||
{Key: "mute", Group: "Mutes", Label: "Mute added", Ready: true},
|
{Key: "mute", Label: "Mute added", Ready: true},
|
||||||
{Key: "unmute", Group: "Mutes", Label: "Mute lifted", Ready: true},
|
{Key: "unmute", Label: "Mute lifted", Ready: true},
|
||||||
{Key: "silence", Group: "Silences", Label: "Silence added", Ready: true},
|
{Key: "silence", Label: "Silence added", Ready: true},
|
||||||
{Key: "unsilence", Group: "Silences", Label: "Silence lifted", Ready: true},
|
{Key: "unsilence", Label: "Silence lifted", Ready: true},
|
||||||
{Key: "server", Group: "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: "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", Group: "Server", Label: "Live score", Help: "An updating scoreboard while people are playing. Coming later."},
|
{Key: "livescore", Label: "Live score", Help: "An updating scoreboard while people are playing. Coming later."},
|
||||||
{Key: "calladmin", Group: "Players", Label: "Admin called", Help: "A player asks for an admin in game. Needs a server plugin, coming later."},
|
{Key: "calladmin", Label: "Admin called", Help: "A player asks for an admin in game. Needs a server plugin, coming later."},
|
||||||
}
|
}
|
||||||
|
|
||||||
// readyTypes are the keys that can be switched on, which is also everyone's default.
|
// readyTypes are the keys that can be switched on, which is also everyone's default.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue