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
|
const actions = isNew
|
||||||
? [h("button", { class: "on", onclick: async () => {
|
? [h("button", { class: "on", onclick: async () => {
|
||||||
if (transport === "tcp" && !values().host) return toast(t("IP address missing"));
|
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); }
|
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")),
|
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"
|
d.status === "disconnected" || d.status === "error"
|
||||||
@@ -1836,8 +1836,8 @@ function deviceForm(d) {
|
|||||||
h("label", {}, t("Model"), f.model),
|
h("label", {}, t("Model"), f.model),
|
||||||
h("label", { class: "chk" }, f.autoconnect, t("Connect automatically")),
|
h("label", { class: "chk" }, f.autoconnect, t("Connect automatically")),
|
||||||
isNew ? null : colorSection(d),
|
isNew ? null : colorSection(d),
|
||||||
isNew ? null : lockSection(d),
|
isNew ? null : lockSection(d)),
|
||||||
h("div", { class: "actions" }, actions)));
|
h("div", { class: "actions" }, actions));
|
||||||
}
|
}
|
||||||
|
|
||||||
// App settings backup: devices, amplifiers/limiter data, PIN, remote access (not the DSP presets)
|
// App settings backup: devices, amplifiers/limiter data, PIN, remote access (not the DSP presets)
|
||||||
@@ -1987,22 +1987,33 @@ function langCard() {
|
|||||||
location.reload();
|
location.reload();
|
||||||
};
|
};
|
||||||
return h("div", { class: "card" }, h("h3", {}, "Language / Sprache"),
|
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("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))));
|
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() {
|
function viewSettings() {
|
||||||
return [
|
const sections = [
|
||||||
h("div", { class: "cards" }, langCard(), demoCard(), logoCard()),
|
["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard()]],
|
||||||
h("h2", { class: "section" }, t("Devices")),
|
["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."),
|
||||||
h("div", { class: "cards" }, ...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), deviceForm(null)),
|
"wide", [...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), addDeviceCard()]],
|
||||||
h("p", { class: "info" }, t("Both DSPs can be connected at the same time – switch between them at the top. "),
|
["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."),
|
||||||
t("The DSPs accept only one connection: close the Thomann editor first.")),
|
"wide", [S.isApp ? remoteCard() : null, pinCard()]],
|
||||||
h("h2", { class: "section" }, S.isApp ? t("Remote access") : t("Security")),
|
["backup", t("Backup"), t("Save and restore the settings of this app."), "wide", [backupCard()]],
|
||||||
h("div", { class: "cards" }, S.isApp ? remoteCard() : null, pinCard()),
|
|
||||||
h("h2", { class: "section" }, t("Backup")),
|
|
||||||
h("div", { class: "cards" }, 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
|
// ------------------------------------------------------------------ render
|
||||||
|
|||||||
@@ -466,6 +466,16 @@ const DE = {
|
|||||||
"The logo could not be read": "Das Logo konnte nicht gelesen werden",
|
"The logo could not be read": "Das Logo konnte nicht gelesen werden",
|
||||||
"The image is too small – at least {n}×{n} pixels": "Das Bild ist zu klein – mindestens {n}×{n} Pixel",
|
"The image is too small – at least {n}×{n} pixels": "Das Bild ist zu klein – mindestens {n}×{n} Pixel",
|
||||||
"Test": "Test",
|
"Test": "Test",
|
||||||
|
// settings page
|
||||||
|
"Language of the app on this device.": "Sprache der App auf diesem Gerät.",
|
||||||
|
"Add a DSP": "DSP hinzufügen",
|
||||||
|
"Over the network or with a USB cable": "Über das Netzwerk oder per USB-Kabel",
|
||||||
|
"General": "Allgemein",
|
||||||
|
"Language, demo mode and your logo.": "Sprache, Demo-Modus und dein Logo.",
|
||||||
|
"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.": "Mehrere DSPs können gleichzeitig verbunden sein – oben auswählen. Ein DSP erlaubt nur eine Verbindung: den Thomann-Editor vorher schließen.",
|
||||||
|
"Let phones and tablets in your network control this computer – they log in with the PIN.": "Handys und Tablets im Netzwerk können diesen Computer fernsteuern – sie melden sich mit der PIN an.",
|
||||||
|
"Who may use this web interface.": "Wer diese Weboberfläche benutzen darf.",
|
||||||
|
"Save and restore the settings of this app.": "Einstellungen dieser App sichern und wiederherstellen.",
|
||||||
};
|
};
|
||||||
|
|
||||||
const DE_PATTERNS = [
|
const DE_PATTERNS = [
|
||||||
|
|||||||
@@ -641,3 +641,36 @@ button.devitem.paused, button.devitem:disabled { opacity: .45; cursor: not-allow
|
|||||||
}
|
}
|
||||||
#viewtabs button .short { display: none; }
|
#viewtabs button .short { display: none; }
|
||||||
.logorow + .actions { margin-top: 12px; }
|
.logorow + .actions { margin-top: 12px; }
|
||||||
|
|
||||||
|
/* ---- settings page */
|
||||||
|
.setwrap { max-width: 1180px; margin: 0 auto; }
|
||||||
|
.setnav { position: sticky; top: var(--hdr); z-index: 9; display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0; margin-bottom: 4px;
|
||||||
|
background: linear-gradient(var(--bg) 75%, transparent); }
|
||||||
|
.setnav .chip { min-height: 32px; }
|
||||||
|
.setsec { margin: 6px 0 30px; scroll-margin-top: calc(var(--hdr) + 58px); }
|
||||||
|
.setsec > header { margin: 0 2px 12px; }
|
||||||
|
.setsec > header h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .01em; }
|
||||||
|
.setsec > header p { margin: 4px 0 0; color: var(--dim); font-size: 13px; max-width: 760px; }
|
||||||
|
.setgrid { display: grid; gap: 12px; align-items: stretch; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
|
||||||
|
.setgrid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
|
||||||
|
.setgrid > .card { display: flex; flex-direction: column; margin: 0; }
|
||||||
|
.setgrid > .card > h3 { margin-bottom: 8px; }
|
||||||
|
.setgrid > .card > p.info { margin: 0 0 12px; }
|
||||||
|
.setgrid > .card > :last-child { margin-top: auto; } /* buttons and switches line up at the bottom of each row */
|
||||||
|
.setgrid > .card > .actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; }
|
||||||
|
.setgrid > .card > .actions button { flex: 1 1 auto; }
|
||||||
|
.setgrid > .card .devform { align-content: start; }
|
||||||
|
.setgrid .seg { width: 100%; }
|
||||||
|
.setgrid .seg button { min-height: 40px; }
|
||||||
|
.setgrid > .card .row { gap: 8px; }
|
||||||
|
.setgrid > .card > .row > button { flex: 1 1 auto; }
|
||||||
|
button.devadd { min-height: 180px; border: 2px dashed var(--line); background: transparent; flex-direction: column; justify-content: center;
|
||||||
|
align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; color: var(--dim); }
|
||||||
|
button.devadd:hover { border-color: var(--accent); color: var(--text); background: var(--panel); }
|
||||||
|
button.devadd .plus { font-size: 34px; line-height: 1; color: var(--accent); }
|
||||||
|
button.devadd b { font-size: 15px; color: var(--text); }
|
||||||
|
.setgrid > button.devadd > :last-child { margin-top: 0; }
|
||||||
|
/* narrow top bar: the DSP button shrinks (name gets shortened) instead of covering the buttons */
|
||||||
|
.devpick { min-width: 0; max-width: min(320px, 100%); }
|
||||||
|
.devpick .dn { min-width: 0; }
|
||||||
|
@media (max-width: 480px) { .devpick .minidots, .devpick small { display: none; } }
|
||||||
Reference in new issue
Block a user