Dashboard levels: link groups as a coloured pill under the channel numbers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 17:40:45 +01:00
1 parent 967191f2f7
commit 682e734257
2 files changed
+22 -14

No files matched your search

+15 -7
View File
@@ -55,20 +55,27 @@ function dashChannelNav(m, d, s) {
h("button", { class: "small", "data-view-ok": "", "aria-label": t("Next channel"), onclick: () => go(1) }, "›"));
}
// link groups in the level meters: a thin line with a small name (the mixer has the big brackets)
// link groups in the level meters: the channel numbers of a group sit on one pill, the name below it
function dashGroups(d, kind) {
const out = [];
linkedGroups(d, kind).forEach(g => {
const color = custColor(d, kind, g[0]) || linkInfo(d, kind, g[0]).color, name = linkName(d, kind, g);
const title = (name ? name + " · " : "") + g.map(i => chLabel(kind, i)).join(" + ");
g.forEach((j, n) => {
if (n && g[n - 1] === j - 1) return;
let len = 1;
while (g.includes(j + len)) len++;
out.push(h("div", { class: "dgrp", style: `--lc:${color};--len:${len};grid-column:${j + 1} / span ${len}`, title: (name ? name + " · " : "") + g.map(i => chLabel(kind, i)).join(" + ") }, len > 1 ? name : "")); // a single meter has no room for the name
const area = `--lc:${color};grid-column:${j + 1} / span ${len}`;
out.push(h("div", { class: "dgrp", style: area, title }));
if (name && len > 1) out.push(h("div", { class: "dgrpname", style: area, title }, name)); // a single meter has no room for it
});
});
return out;
}
const dashLabelColor = (d, k, i) => {
const l = linkInfo(d, k, i);
return l ? custColor(d, k, i) || l.color : custColor(d, k, i) || (k === "in" ? IN_COLORS[i] : "var(--warn)");
};
const DASH_MODULES = {
status: {
@@ -88,11 +95,12 @@ const DASH_MODULES = {
title: () => t("Levels"), w: 8, min: [3, 5], max: [12, 14], h: 7,
icon: '<path d="M5 20V10M10 20V4M15 20v-7M20 20V8"/>',
body(m, d) {
const col = (k, i) => h("div", { class: "dm" + (chans(d, k)[i].mute ? " muted" : ""), title: chTitle(d, k, i), style: `${ccStyle(d, k, i)};grid-column:${i + 1}` },
ledMeter(d.id, k, i), k === "out" ? limLed(d.id, i) : h("span", { class: "limled ph", "aria-hidden": "true" }), h("small", {}, chLabel(k, i).replace("Out ", "").replace("In ", "")));
const group = (k, label) => h("div", { class: "dmgroup", style: `flex-grow:${chans(d, k).length}` }, h("div", { class: "sub" }, label), h("div", { class: "dms", style: `--n:${chans(d, k).length}` }, dashGroups(d, k), chans(d, k).map((_, i) => col(k, i))));
const bands = linkedGroups(d, "in").length + linkedGroups(d, "out").length > 0;
return h("div", { class: "dmeters" + (bands ? " hasbands" : "") }, group("in", t("Inputs")), group("out", t("Outputs")));
const col = (k, i) => h("div", { class: "dm" + (chans(d, k)[i].mute ? " muted" : ""), title: chTitle(d, k, i), style: `grid-column:${i + 1}` },
ledMeter(d.id, k, i), k === "out" ? limLed(d.id, i) : h("span", { class: "limled ph", "aria-hidden": "true" }));
const numberOf = (k, i) => h("small", { class: "dmlab", style: `color:${dashLabelColor(d, k, i)};grid-column:${i + 1}` }, chLabel(k, i).replace("Out ", "").replace("In ", ""));
const group = (k, label) => h("div", { class: "dmgroup", style: `flex-grow:${chans(d, k).length}` }, h("div", { class: "sub" }, label), h("div", { class: "dms", style: `--n:${chans(d, k).length}` }, chans(d, k).map((_, i) => col(k, i)), dashGroups(d, k), chans(d, k).map((_, i) => numberOf(k, i))));
const named = ["in", "out"].some(k => linkedGroups(d, k).some(g => linkName(d, k, g)));
return h("div", { class: "dmeters" + (named ? " hasnames" : "") }, group("in", t("Inputs")), group("out", t("Outputs")));
},
},
mixer: {