Notifications page: count all devices, saying whether this one is included
This commit is contained in:
parent
17232bd5a2
commit
a6960c25a2
1 changed files with 4 additions and 2 deletions
|
|
@ -553,7 +553,9 @@ async function notifications() {
|
||||||
if (state.page !== "notifications") return;
|
if (state.page !== "notifications") return;
|
||||||
state.notif = d;
|
state.notif = d;
|
||||||
const p = d.prefs;
|
const p = d.prefs;
|
||||||
const others = d.devices.length - (here ? 1 : 0);
|
// 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) => `<div class="setting">
|
const row = (label, help, control) => `<div class="setting">
|
||||||
<div><b>${label}</b>${help ? `<p>${help}</p>` : ""}</div>
|
<div><b>${label}</b>${help ? `<p>${help}</p>` : ""}</div>
|
||||||
<div class="control">${control}</div>
|
<div class="control">${control}</div>
|
||||||
|
|
@ -576,7 +578,7 @@ async function notifications() {
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<div class="panel-head"><div><h2>Devices</h2></div></div>
|
<div class="panel-head"><div><h2>Devices</h2></div></div>
|
||||||
${device}
|
${device}
|
||||||
${others > 0 ? row(`${here ? "Other devices" : "Your devices"}`, `${others} ${others === 1 ? "device has" : "devices have"} notifications on.`, '<button class="btn" type="button" data-act="notif-off-all">Turn off everywhere</button>') : ""}
|
${others > 0 ? row("Your devices", `${total} ${total === 1 ? "device has" : "devices have"} notifications on${here ? ", this one included" : ", not this one"}.`, '<button class="btn" type="button" data-act="notif-off-all">Turn off everywhere</button>') : ""}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue