From 0b0e86f49622c5fc69ee829fb6b93a6aafef5f74 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Fri, 13 Mar 2026 19:38:34 +0100 Subject: [PATCH] [fix](trx-frontend-http): sync map legend with filter mode Co-authored-by: OpenAI Codex Signed-off-by: Stan Grams --- .../trx-frontend-http/assets/web/app.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index fe2de8f..c1b9397 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -4303,24 +4303,28 @@ function renderMapLocatorPhaseRow(container, phase) { } } -function renderMapBandLegend(items) { +function renderMapLocatorLegend(phase, sourceItems, bandItems) { const legendEl = document.getElementById("map-band-legend"); if (!legendEl) return; - const bandItems = Array.isArray(items) ? items : []; - if (bandItems.length === 0) { + const isSourcePhase = phase === "type"; + const items = Array.isArray(isSourcePhase ? sourceItems : bandItems) + ? (isSourcePhase ? sourceItems : bandItems) + : []; + if (items.length === 0) { legendEl.classList.add("is-empty"); legendEl.innerHTML = ""; return; } legendEl.classList.remove("is-empty"); - const rows = bandItems + const rows = items .map((item) => { const label = escapeMapHtml(item.label); const color = escapeMapHtml(item.color); return `${label}`; }) .join(""); - legendEl.innerHTML = `
Band Colors
${rows}
`; + const title = isSourcePhase ? "Source Colors" : "Band Colors"; + legendEl.innerHTML = `
${title}
${rows}
`; } function rebuildMapLocatorFilters() { @@ -4379,7 +4383,7 @@ function rebuildMapLocatorFilters() { const bandItems = Array.from(bandMap.values()) .sort((a, b) => (b.sortHz - a.sortHz) || a.label.localeCompare(b.label)); - renderMapBandLegend(bandItems); + renderMapLocatorLegend(mapLocatorFilter.phase, sourceItems, bandItems); if (!phaseEl || !choiceEl || !choiceLabelEl) return; renderMapLocatorPhaseRow(phaseEl, mapLocatorFilter.phase);