feat: add PSK Reporter Band Activity overlay - #1136
Conversation
Compact horizontal bar chart showing PSKReporter spot counts per HF band. Features: - Client-side counting from usePSKReporter data (filtered by time window) - Real-time updates via custom events (no polling) - Fixed panel size, all 15 HF bands always visible - Inactive bands dimmed with reduced opacity - Minimizeable with footer that shows total spots and time window - Draggable panel with saved position - Styled with band colors and consistent with other overlays
accius
left a comment
There was a problem hiding this comment.
Really nice work overall — this is exactly the right way to build on the PSK Reporter data: the overlay rides the existing MQTT→SSE pipeline with zero new upstream traffic, and the panel follows the layer-plugin conventions (draggable/minimize, storage keys, escaped interpolation). One required change and two optional ones:
Required — please remove the GET /api/pskreporter/band-activity endpoint (server/routes/pskreporter.js). Nothing in this PR calls it — the client gets its counts from the psk-band-activity-changed CustomEvent — and as written it's a footgun on shared/hosted instances: uncached, it iterates every subscriber's recentSpots buffer per unauthenticated request, and it double-counts spots that appear under multiple subscription keys, so the numbers it returns are wrong on any multi-user server anyway. (Your own checklist flags the missing caching.) The feature works perfectly without it — if we later want a server-side aggregate, it needs caching and per-subscriber dedup, which can be its own PR.
Optional:
- Stale counts on quiet bands: the event only fires inside
processSpots, so when no new spots arrive, expired spots stay counted in the panel until the next batch. A periodic re-emit (or filtering by spot age at render time) would keep the bars honest. - In the content-update effect, the
insertBefore(contentTarget, container.querySelector('.psk-band-footer'))fallback would throw if ever reached — afteraddMinimizeTogglewraps children into.psk-panel-content,.psk-band-footeris no longer a direct child ofcontainer. Unreachable today, but worth fixing while you're in there.
Drop the endpoint and this is good to go.
Overlay now uses client-side events exclusively, no server fetch needed.
|
The API endpoint call was originally needed because more info was going to be displayed, but for just this change its definitely not needed, removed it. The stale counts problem does happen if pskreporter has no data. I tried fixing it in various ways but could not figure it out, even converting the event to a useEffect, etc... so it might be out of my skill level and understanding of how React works. |
Compact horizontal bar chart showing PSKReporter spot counts per HF band.
Features:
This should fix #1134
Type of change
How to test
Checklist
server.js: caches have TTLs and size caps (we serve 2,000+ concurrent users)var(--accent-cyan), etc.).bak,.old,console.logdebug lines, or test scripts includedScreenshots (if visual change)