feat: sequences can step on time; searchable group pickers
- Sequences: advance_mode "time" makes each step last its `seconds` (0.1–3600) instead of beats; editor gets a "Steps last" selector. - UI: search box in the groups modal; searchable add pickers for zone groups and presets. - Preset "try" sends only to the current zone's groups, never broadcast. - led-driver: max_brightness ceiling from device config; follow a controller that restarted its beat counter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
38162d4b89
commit
d664026ee5
10 files changed
+229
-92
No files matched your search
+42
-49
@@ -457,29 +457,29 @@ function renderZoneGroupsEditor(containerEl, rows, groupsMap) {
|
||||
const idsInRows = new Set(rows.map((r) => String(r.id)));
|
||||
const addWrap = document.createElement("div");
|
||||
addWrap.className = "zone-devices-add profiles-actions";
|
||||
const sel = document.createElement("select");
|
||||
sel.className = "zone-device-add-select";
|
||||
sel.appendChild(new Option("Add group…", ""));
|
||||
entries.forEach(([gid, g]) => {
|
||||
if (idsInRows.has(gid)) return;
|
||||
const groupLabel = (gid, g) => {
|
||||
const gn = g && g.name ? String(g.name).trim() : "";
|
||||
const optLabel = gn ? `${gn} (${gid})` : `Group ${gid}`;
|
||||
sel.appendChild(new Option(optLabel, gid));
|
||||
});
|
||||
const addBtn = document.createElement("button");
|
||||
addBtn.type = "button";
|
||||
addBtn.className = "btn btn-primary btn-small";
|
||||
addBtn.textContent = "Add";
|
||||
addBtn.addEventListener("click", () => {
|
||||
const gid = sel.value;
|
||||
if (!gid || !groupsMap[gid]) return;
|
||||
const gn = groupsMap[gid].name ? String(groupsMap[gid].name).trim() : gid;
|
||||
rows.push({ id: gid, name: gn });
|
||||
sel.value = "";
|
||||
renderZoneGroupsEditor(containerEl, rows, groupsMap);
|
||||
});
|
||||
addWrap.appendChild(sel);
|
||||
addWrap.appendChild(addBtn);
|
||||
return gn ? `${gn} (${gid})` : `Group ${gid}`;
|
||||
};
|
||||
const picker =
|
||||
typeof window.createSearchableAddPicker === "function"
|
||||
? window.createSearchableAddPicker({
|
||||
entries,
|
||||
excludeIds: idsInRows,
|
||||
labelFor: groupLabel,
|
||||
searchTextFor: (gid, g) => `${(g && g.name) || ""} ${gid}`,
|
||||
onPick: (gid) => {
|
||||
if (!gid || !groupsMap[gid]) return;
|
||||
const gn = groupsMap[gid].name ? String(groupsMap[gid].name).trim() : gid;
|
||||
rows.push({ id: gid, name: gn });
|
||||
renderZoneGroupsEditor(containerEl, rows, groupsMap);
|
||||
},
|
||||
placeholder: "Search groups to add…",
|
||||
emptyMessage: "No groups match your search.",
|
||||
noItemsMessage: "All groups are already on this zone.",
|
||||
})
|
||||
: null;
|
||||
if (picker) addWrap.appendChild(picker);
|
||||
if (panel) {
|
||||
panel.addSlot.appendChild(addWrap);
|
||||
} else {
|
||||
@@ -1027,35 +1027,28 @@ async function refreshEditTabPresetsUi(zoneId) {
|
||||
} else {
|
||||
const addWrap = document.createElement("div");
|
||||
addWrap.className = "zone-devices-add profiles-actions";
|
||||
const sel = document.createElement("select");
|
||||
sel.className = "zone-device-add-select";
|
||||
sel.setAttribute("aria-label", "Preset to add to this zone");
|
||||
sel.appendChild(new Option("Add preset…", ""));
|
||||
const sorted = availableToAdd.slice().sort((a, b) => {
|
||||
const na = (allPresets[a] && allPresets[a].name) || a;
|
||||
const nb = (allPresets[b] && allPresets[b].name) || b;
|
||||
return String(na).localeCompare(String(nb), undefined, { sensitivity: "base" });
|
||||
});
|
||||
sorted.forEach((presetId) => {
|
||||
const preset = allPresets[presetId] || {};
|
||||
const name = preset.name || presetId;
|
||||
sel.appendChild(new Option(`${name} — ${presetId}`, presetId));
|
||||
});
|
||||
const addBtn = document.createElement("button");
|
||||
addBtn.type = "button";
|
||||
addBtn.className = "btn btn-primary btn-small";
|
||||
addBtn.textContent = "Add";
|
||||
addBtn.addEventListener("click", async () => {
|
||||
const presetId = sel.value;
|
||||
if (!presetId) return;
|
||||
if (typeof window.addPresetToTab === "function") {
|
||||
await window.addPresetToTab(presetId, zoneId);
|
||||
sel.value = "";
|
||||
const sorted = availableToAdd
|
||||
.slice()
|
||||
.sort((x, y) => {
|
||||
const nx = (allPresets[x] && allPresets[x].name) || x;
|
||||
const ny = (allPresets[y] && allPresets[y].name) || y;
|
||||
return String(nx).localeCompare(String(ny), undefined, { sensitivity: "base" });
|
||||
})
|
||||
.map((id) => [id, allPresets[id] || {}]);
|
||||
const picker = window.createSearchableAddPicker({
|
||||
entries: sorted,
|
||||
labelFor: (id, p) => `${p.name || id} — ${id}`,
|
||||
searchTextFor: (id, p) => `${p.name || ""} ${id} ${p.pattern || ""}`,
|
||||
onPick: async (id) => {
|
||||
if (typeof window.addPresetToTab !== "function") return;
|
||||
await window.addPresetToTab(id, zoneId);
|
||||
await refreshEditTabPresetsUi(zoneId);
|
||||
}
|
||||
},
|
||||
placeholder: "Search presets to add…",
|
||||
emptyMessage: "No presets match your search.",
|
||||
noItemsMessage: "No presets to add.",
|
||||
});
|
||||
addWrap.appendChild(sel);
|
||||
addWrap.appendChild(addBtn);
|
||||
addWrap.appendChild(picker);
|
||||
addEl.appendChild(addWrap);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user