diff --git a/assets/js/contacts_map_hook.js b/assets/js/contacts_map_hook.js index c80288b3..71de8ce2 100644 --- a/assets/js/contacts_map_hook.js +++ b/assets/js/contacts_map_hook.js @@ -50,98 +50,19 @@ export const ContactsMap = { this.lineLayer.addTo(this.map) this.dotLayer.addTo(this.map) - // Discover all bands - const bandSet = new Set() - for (const c of this.allContacts) bandSet.add(c[4]) - this.allBands = [...bandSet].sort((a, b) => a - b) - for (const b of this.allBands) this.enabledBands.add(b) + // Enable all bands initially + for (const c of this.allContacts) this.enabledBands.add(c[4]) + + // Listen for filter changes from LiveView + this.handleEvent("apply_filter", ({enabled_bands, callsign}) => { + this.enabledBands = new Set(enabled_bands) + this.callsignFilter = (callsign || "").toUpperCase() + this.rebuildMap() + }) - this.buildControlPanel() this.rebuildMap() }, - buildControlPanel() { - const control = L.control({position: "bottomright"}) - const self = this - - control.onAdd = function() { - const div = L.DomUtil.create("div") - div.style.cssText = "background:rgba(30,30,40,0.95);color:#fff;padding:8px 12px;border-radius:8px;font-size:11px;line-height:1.8;max-height:60vh;overflow-y:auto;" - L.DomEvent.disableClickPropagation(div) - L.DomEvent.disableScrollPropagation(div) - - // Callsign filter - let html = `