Pick the simulator's stage map from a drop-down, and make the QLC+ show optional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-10-22 14:05:42 +13:00
1 parent df05c8ca49
commit a295fefac0
8 files changed
+154 -20

No files matched your search

+41 -9
View File
@@ -9,6 +9,7 @@ const detailEl = document.getElementById("detail");
const detailTitle = document.getElementById("detail-title");
const detailMeta = document.getElementById("detail-meta");
const channelsEl = document.getElementById("channels");
const stageFileEl = document.getElementById("stage-file");
let stage = null;
let state = { fixtures: {}, age: null, rate: 0, universe: null, packets: 0 };
@@ -592,18 +593,49 @@ canvas.addEventListener("pointercancel", () => {
window.addEventListener("resize", resize);
function showStage(loaded) {
stage = loaded;
selected = null;
detailEl.hidden = true;
nameEl.textContent = stage.name || "xchc";
document.title = stage.name || "xchc";
originEl.textContent = stage.origin || "";
const show = stage.show ? stage.show : "addresses from the stage map";
const target = stage.output_ip ? ` · QLC+ output ${stage.output_ip}` : "";
patchEl.textContent = `${show}${target}`;
buildList();
resize();
}
async function loadStageList() {
const { current, stages } = await fetch("/api/stages").then((response) => response.json());
stageFileEl.replaceChildren(
...stages.map((name) => new Option(name.replace(/\.json$/, ""), name, false, name === current)),
);
stageFileEl.disabled = stages.length < 2;
}
stageFileEl.addEventListener("change", async () => {
stageFileEl.disabled = true;
try {
const response = await fetch("/api/stage", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ file: stageFileEl.value }),
});
if (!response.ok) throw new Error("bad stage");
showStage(await response.json());
} catch {
statusEl.textContent = "could not load that stage";
}
await loadStageList().catch(() => {});
});
fetch("/api/stage")
.then((response) => response.json())
.then((loaded) => {
stage = loaded;
nameEl.textContent = stage.name || "xchc";
document.title = stage.name || "xchc";
originEl.textContent = stage.origin || "";
const show = stage.show ? stage.show : "stage file";
const target = stage.output_ip ? ` · QLC+ output ${stage.output_ip}` : "";
patchEl.textContent = `${show}${target}`;
buildList();
resize();
showStage(loaded);
loadStageList().catch(() => {});
poll();
setInterval(poll, 50);
requestAnimationFrame(frame);