[fix](trx-frontend): polish map filter layout

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-03 22:37:05 +01:00
parent a194043caf
commit bd5c909695
2 changed files with 27 additions and 10 deletions
@@ -3282,13 +3282,14 @@ function renderMapLocatorChipRow(container, items, selectedSet, kind) {
container.innerHTML = `<span class="map-locator-empty">No ${kind === "band" ? "bands" : "sources"} available</span>`; container.innerHTML = `<span class="map-locator-empty">No ${kind === "band" ? "bands" : "sources"} available</span>`;
return; return;
} }
let helperText = "";
if (kind === "source") { if (kind === "source") {
const allVisible = items.every((item) => mapFilter[item.key]); const allVisible = items.every((item) => mapFilter[item.key]);
if (allVisible) { if (allVisible) {
container.innerHTML = '<span class="map-locator-empty">All sources visible by default</span>'; helperText = "All sources visible by default";
} }
} else if (!(selectedSet instanceof Set) || selectedSet.size === 0) { } else if (!(selectedSet instanceof Set) || selectedSet.size === 0) {
container.innerHTML = `<span class="map-locator-empty">All ${kind === "band" ? "bands" : "sources"} visible by default</span>`; helperText = `All ${kind === "band" ? "bands" : "sources"} visible by default`;
} }
for (const item of items) { for (const item of items) {
const btn = document.createElement("button"); const btn = document.createElement("button");
@@ -3304,6 +3305,12 @@ function renderMapLocatorChipRow(container, items, selectedSet, kind) {
: `<span class="map-locator-chip-text">${escapeMapHtml(item.label)}</span>`; : `<span class="map-locator-chip-text">${escapeMapHtml(item.label)}</span>`;
container.appendChild(btn); 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) { function renderMapLocatorPhaseRow(container, phase) {
@@ -3330,10 +3337,20 @@ function rebuildMapLocatorFilters() {
const choiceLabelEl = document.getElementById("map-locator-choice-label"); const choiceLabelEl = document.getElementById("map-locator-choice-label");
if (!phaseEl || !choiceEl || !choiceLabelEl) return; 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(); const bandMap = new Map();
for (const entry of locatorMarkers.values()) { for (const entry of locatorMarkers.values()) {
const sourceType = entry?.sourceType; const sourceType = entry?.sourceType;
if (!sourceType) continue; if (!sourceType) continue;
availableSources.add(sourceType);
const meta = entry?.bandMeta instanceof Map ? entry.bandMeta : new Map(); const meta = entry?.bandMeta instanceof Map ? entry.bandMeta : new Map();
for (const [label, hz] of meta.entries()) { for (const [label, hz] of meta.entries()) {
if (!bandMap.has(label)) { if (!bandMap.has(label)) {
@@ -3360,7 +3377,9 @@ function rebuildMapLocatorFilters() {
if (!bandMap.has(key)) mapLocatorFilter.bands.delete(key); if (!bandMap.has(key)) mapLocatorFilter.bands.delete(key);
} }
const sourceItems = ["ais", "vdes", "aprs", "bookmark", "ft8", "wspr"].map((key) => ({ const sourceItems = ["ais", "vdes", "aprs", "bookmark", "ft8", "wspr"]
.filter((key) => availableSources.has(key))
.map((key) => ({
key, key,
label: mapSourceLabel(key), label: mapSourceLabel(key),
color: mapSourceColor(key), color: mapSourceColor(key),
@@ -1552,8 +1552,6 @@ small { color: var(--text-muted); }
flex-direction: column; flex-direction: column;
gap: 0.3rem; gap: 0.3rem;
margin-bottom: 0.55rem; margin-bottom: 0.55rem;
padding-top: 0.15rem;
border-top: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
} }
.map-locator-filter-group { .map-locator-filter-group {
display: flex; display: flex;