[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:
@@ -3282,13 +3282,14 @@ function renderMapLocatorChipRow(container, items, selectedSet, kind) {
|
||||
container.innerHTML = `<span class="map-locator-empty">No ${kind === "band" ? "bands" : "sources"} available</span>`;
|
||||
return;
|
||||
}
|
||||
let helperText = "";
|
||||
if (kind === "source") {
|
||||
const allVisible = items.every((item) => mapFilter[item.key]);
|
||||
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) {
|
||||
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) {
|
||||
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>`;
|
||||
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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user