Reset: nicer dialog, only in the desktop apps
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29a89af562
commit
bbe8a73775
6 files changed
+60
-20
No files matched your search
+14
-9
@@ -2232,19 +2232,24 @@ async function resetDialog() {
|
||||
const matches = () => input.value.trim().toUpperCase() === code;
|
||||
const input = h("input", { type: "text", class: "code resetcode", maxlength: 2, autocomplete: "off", autocapitalize: "characters", spellcheck: "false", "aria-label": t("Letters"),
|
||||
oninput: () => { document.querySelector("#modal .dlg-actions button:last-child").disabled = !matches(); } });
|
||||
const pin = h("input", { type: "password", inputmode: "numeric", maxlength: 4, autocomplete: "off", placeholder: "••••" });
|
||||
const stuck = S.order.map(id => S.devices[id]).filter(d => !d.demo && d.test_saved && d.status !== "online").map(d => d.name);
|
||||
const open = modal({ title: t("Reset all app settings?"),
|
||||
body: h("div", { class: "form" },
|
||||
h("p", { class: "dlg-text" }, t("All DSPs are disconnected at once, then this app starts fresh: DSP list, colours and group names, amplifiers, SoundField plan, dashboard, DJ Brake, remote access and language are gone, and the PIN is 1234 again.")),
|
||||
h("p", { class: "dlg-text" }, h("b", {}, t("Nothing changes on the DSPs: their settings and presets stay as they are."))),
|
||||
stuck.length ? h("p", { class: "dlg-text resetwarn" }, t("{names} still has the lowered levels of an interrupted audio test. The app can no longer undo that after the reset.", { names: stuck.join(", ") })) : null,
|
||||
S.isApp ? null : h("label", {}, t("Current PIN"), pin),
|
||||
h("div", { class: "resetcheck" }, h("span", {}, t("To confirm, type these letters:")), h("b", { class: "resetletters", "aria-label": code }, code), input)),
|
||||
body: h("div", { class: "resetbody" },
|
||||
h("p", { class: "resetlead" }, t("All DSPs are disconnected first, then the app starts fresh.")),
|
||||
h("div", { class: "resetlists" },
|
||||
h("div", { class: "resetlist gone" }, h("b", {}, t("Removed from the app")), h("ul", {},
|
||||
[t("DSP list"), t("Colours and group names"), t("Amplifiers and SoundField plan"), t("Dashboard and DJ Brake"), t("Remote access and language"), t("PIN, back to 1234")].map(x => h("li", {}, x)))),
|
||||
h("div", { class: "resetlist stays" }, h("b", {}, t("Stays as it is")), h("ul", {},
|
||||
[t("All settings in the DSPs"), t("Presets in the DSPs"), t("A copy of the old app settings")].map(x => h("li", {}, x))))),
|
||||
stuck.length ? h("p", { class: "resetwarn" }, t("{names} still has the lowered levels of an interrupted audio test. The app can no longer undo that after the reset.", { names: stuck.join(", ") })) : null,
|
||||
h("div", { class: "resetcheck" }, h("span", {}, t("To confirm, type these letters:")),
|
||||
h("div", { class: "resetrow" },
|
||||
h("div", { class: "resetletters", role: "img", "aria-label": code }, [...code].map(c => h("i", {}, c))),
|
||||
h("span", { class: "resetarrow", "aria-hidden": "true" }, "→"), input))),
|
||||
actions: [{ label: t("Cancel") }, { label: t("Reset"), primary: true, cls: "danger-on", value: () => matches() ? true : undefined }] });
|
||||
document.querySelector("#modal .dlg-actions button:last-child").disabled = true;
|
||||
if (!await open) return;
|
||||
try { await api("POST", "/api/reset", { pin: pin.value }); appWasReset(); }
|
||||
try { await api("POST", "/api/reset"); appWasReset(); }
|
||||
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
|
||||
}
|
||||
|
||||
@@ -2277,7 +2282,7 @@ function backupCard() {
|
||||
h("p", { class: "info" }, t("Saves devices, amplifiers & limiter calculator, PIN and remote access to a file. ") +
|
||||
t("The settings inside the DSPs are saved per device via “File…” at the top.")),
|
||||
h("div", { class: "row" }, h("button", { onclick: exportCfg }, t("Back up…")), h("button", { onclick: restore }, t("Restore…")),
|
||||
h("button", { class: "danger", onclick: resetDialog }, t("Reset all app settings…"))));
|
||||
S.isApp ? h("button", { class: "danger", onclick: resetDialog }, t("Reset all app settings…")) : null));
|
||||
}
|
||||
|
||||
// Desktop app only: let phones/tablets on the LAN use this PC as server (they need the PIN)
|
||||
|
||||
Reference in new issue
Block a user