From bd5c9096959c75bc5e21217a9df6697a082387e1 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Tue, 3 Mar 2026 22:37:05 +0100 Subject: [PATCH] [fix](trx-frontend): polish map filter layout Co-authored-by: OpenAI Codex Signed-off-by: Stan Grams --- .../trx-frontend-http/assets/web/app.js | 35 ++++++++++++++----- .../trx-frontend-http/assets/web/style.css | 2 -- 2 files changed, 27 insertions(+), 10 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 73830dd..0e27f74 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 @@ -3282,13 +3282,14 @@ function renderMapLocatorChipRow(container, items, selectedSet, kind) { container.innerHTML = `No ${kind === "band" ? "bands" : "sources"} available`; return; } + let helperText = ""; if (kind === "source") { const allVisible = items.every((item) => mapFilter[item.key]); if (allVisible) { - container.innerHTML = 'All sources visible by default'; + helperText = "All sources visible by default"; } } else if (!(selectedSet instanceof Set) || selectedSet.size === 0) { - container.innerHTML = `All ${kind === "band" ? "bands" : "sources"} visible by default`; + helperText = `All ${kind === "band" ? "bands" : "sources"} visible by default`; } for (const item of items) { const btn = document.createElement("button"); @@ -3304,6 +3305,12 @@ function renderMapLocatorChipRow(container, items, selectedSet, kind) { : `${escapeMapHtml(item.label)}`; container.appendChild(btn); } + if (helperText) { + const hint = document.createElement("span"); + hint.className = "map-locator-empty"; + hint.textContent = helperText; + container.appendChild(hint); + } } function renderMapLocatorPhaseRow(container, phase) { @@ -3330,10 +3337,20 @@ function rebuildMapLocatorFilters() { const choiceLabelEl = document.getElementById("map-locator-choice-label"); if (!phaseEl || !choiceEl || !choiceLabelEl) return; + const availableSources = new Set(); + if (aisMarkers.size > 0) availableSources.add("ais"); + if (vdesMarkers.size > 0) availableSources.add("vdes"); + for (const entry of stationMarkers.values()) { + if (entry?.type === "aprs" && (entry.marker || (entry.lat != null && entry.lon != null))) { + availableSources.add("aprs"); + break; + } + } const bandMap = new Map(); for (const entry of locatorMarkers.values()) { const sourceType = entry?.sourceType; if (!sourceType) continue; + availableSources.add(sourceType); const meta = entry?.bandMeta instanceof Map ? entry.bandMeta : new Map(); for (const [label, hz] of meta.entries()) { if (!bandMap.has(label)) { @@ -3360,12 +3377,14 @@ function rebuildMapLocatorFilters() { if (!bandMap.has(key)) mapLocatorFilter.bands.delete(key); } - const sourceItems = ["ais", "vdes", "aprs", "bookmark", "ft8", "wspr"].map((key) => ({ - key, - label: mapSourceLabel(key), - color: mapSourceColor(key), - kind: "source", - })); + const sourceItems = ["ais", "vdes", "aprs", "bookmark", "ft8", "wspr"] + .filter((key) => availableSources.has(key)) + .map((key) => ({ + key, + label: mapSourceLabel(key), + color: mapSourceColor(key), + kind: "source", + })); const bandItems = Array.from(bandMap.values()) .sort((a, b) => (b.sortHz - a.sortHz) || a.label.localeCompare(b.label)); diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css index 37756cc..b7d18fe 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css @@ -1552,8 +1552,6 @@ small { color: var(--text-muted); } flex-direction: column; gap: 0.3rem; margin-bottom: 0.55rem; - padding-top: 0.15rem; - border-top: 1px solid color-mix(in srgb, var(--border) 86%, transparent); } .map-locator-filter-group { display: flex;