Rework the settings page
- clear sections (general, devices, security / remote access, backup) with headings, short descriptions and a sticky quick-jump bar - cards of equal height per row with their buttons aligned at the bottom, centred page width - "add a DSP" is a compact card that opens the form (with cancel) - phones: the DSP button shrinks instead of covering the mute/settings buttons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf0adc01fe
commit
5fc745cd72
3 files changed
+68
-14
No files matched your search
+25
-14
@@ -1806,9 +1806,9 @@ function deviceForm(d) {
|
||||
const actions = isNew
|
||||
? [h("button", { class: "on", onclick: async () => {
|
||||
if (transport === "tcp" && !values().host) return toast(t("IP address missing"));
|
||||
try { const nd = await api("POST", "/api/devices", values()); S.cur = nd.id; toast(t("Added")); }
|
||||
try { const nd = await api("POST", "/api/devices", values()); S.cur = nd.id; S.addDev = false; toast(t("Added")); }
|
||||
catch (e) { toast(e.message); }
|
||||
} }, t("Add"))]
|
||||
} }, t("Add")), h("button", { onclick: () => { S.addDev = false; render(); } }, t("Cancel"))]
|
||||
: [
|
||||
h("button", { onclick: async () => { try { await api("PUT", `/api/devices/${d.id}`, values()); toast(t("Saved")); } catch (e) { toast(e.message); } } }, t("Save")),
|
||||
d.status === "disconnected" || d.status === "error"
|
||||
@@ -1836,8 +1836,8 @@ function deviceForm(d) {
|
||||
h("label", {}, t("Model"), f.model),
|
||||
h("label", { class: "chk" }, f.autoconnect, t("Connect automatically")),
|
||||
isNew ? null : colorSection(d),
|
||||
isNew ? null : lockSection(d),
|
||||
h("div", { class: "actions" }, actions)));
|
||||
isNew ? null : lockSection(d)),
|
||||
h("div", { class: "actions" }, actions));
|
||||
}
|
||||
|
||||
// App settings backup: devices, amplifiers/limiter data, PIN, remote access (not the DSP presets)
|
||||
@@ -1987,22 +1987,33 @@ function langCard() {
|
||||
location.reload();
|
||||
};
|
||||
return h("div", { class: "card" }, h("h3", {}, "Language / Sprache"),
|
||||
h("p", { class: "info" }, t("Language of the app on this device.")),
|
||||
h("div", { class: "seg" }, Object.entries(LANGS).map(([k, label]) =>
|
||||
h("button", { class: k === LANG ? "on" : "", "aria-pressed": String(k === LANG), "data-view-ok": "", onclick: () => set(k) }, label))));
|
||||
}
|
||||
|
||||
function addDeviceCard() {
|
||||
if (S.addDev) return deviceForm(null);
|
||||
return h("button", { class: "card addcard devadd", onclick: () => { S.addDev = true; render(); } },
|
||||
h("span", { class: "plus" }, "+"), h("b", {}, t("Add a DSP")),
|
||||
h("small", {}, t("Over the network or with a USB cable")));
|
||||
}
|
||||
|
||||
function viewSettings() {
|
||||
return [
|
||||
h("div", { class: "cards" }, langCard(), demoCard(), logoCard()),
|
||||
h("h2", { class: "section" }, t("Devices")),
|
||||
h("div", { class: "cards" }, ...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), deviceForm(null)),
|
||||
h("p", { class: "info" }, t("Both DSPs can be connected at the same time – switch between them at the top. "),
|
||||
t("The DSPs accept only one connection: close the Thomann editor first.")),
|
||||
h("h2", { class: "section" }, S.isApp ? t("Remote access") : t("Security")),
|
||||
h("div", { class: "cards" }, S.isApp ? remoteCard() : null, pinCard()),
|
||||
h("h2", { class: "section" }, t("Backup")),
|
||||
h("div", { class: "cards" }, backupCard()),
|
||||
const sections = [
|
||||
["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard()]],
|
||||
["devices", t("Devices"), t("Several DSPs can be connected at the same time – pick one at the top. A DSP accepts only one connection: close the Thomann editor first."),
|
||||
"wide", [...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), addDeviceCard()]],
|
||||
["access", S.isApp ? t("Remote access") : t("Security"), S.isApp ? t("Let phones and tablets in your network control this computer – they log in with the PIN.") : t("Who may use this web interface."),
|
||||
"wide", [S.isApp ? remoteCard() : null, pinCard()]],
|
||||
["backup", t("Backup"), t("Save and restore the settings of this app."), "wide", [backupCard()]],
|
||||
];
|
||||
const nav = h("nav", { class: "setnav", "aria-label": t("Settings") }, sections.map(([id, title]) =>
|
||||
h("button", { class: "chip", "data-view-ok": "", onclick: () => document.getElementById("set-" + id)?.scrollIntoView({ behavior: "smooth", block: "start" }) }, title)));
|
||||
return h("div", { class: "setwrap" }, nav, sections.map(([id, title, desc, cls, cards]) =>
|
||||
h("section", { class: "setsec", id: "set-" + id },
|
||||
h("header", {}, h("h2", {}, title), h("p", {}, desc)),
|
||||
h("div", { class: "setgrid " + cls }, cards.filter(Boolean)))));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ render
|
||||
|
||||
Reference in new issue
Block a user