From fbfff4154fec13b66c04425ac61b8d3f3136ecbd Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Wed, 4 Mar 2026 19:26:48 +0100 Subject: [PATCH] [fix](trx-frontend): compact map tooltip frequencies Co-authored-by: OpenAI Codex Signed-off-by: Stan Grams --- .../trx-frontend-http/assets/web/app.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 09ab676..e312ca0 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 @@ -4396,6 +4396,15 @@ function formatDecodeLocatorTime(tsMs) { }); } +function formatMapPopupFreq(hz) { + if (!Number.isFinite(hz)) return "--"; + const value = Number(hz); + if (value >= 1_000_000_000) return `${(value / 1_000_000_000).toFixed(6).replace(/\.?0+$/, "")} GHz`; + if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(6).replace(/\.?0+$/, "")} MHz`; + if (value >= 1_000) return `${(value / 1_000).toFixed(3).replace(/\.?0+$/, "")} kHz`; + return `${Math.round(value)} Hz`; +} + function buildDecodeLocatorTooltipHtml(grid, entry, type) { const details = entry?.stationDetails instanceof Map ? Array.from(entry.stationDetails.values()) @@ -4405,9 +4414,7 @@ function buildDecodeLocatorTooltipHtml(grid, entry, type) { const rows = details .map((detail) => { const station = escapeMapHtml(String(detail?.station || "Unknown")); - const freq = Number.isFinite(detail?.freq_hz) - ? `${Number(detail.freq_hz).toFixed(0)} Hz` - : "--"; + const freq = formatMapPopupFreq(Number(detail?.freq_hz)); const meta = [ Number.isFinite(detail?.snr_db) ? `${Number(detail.snr_db).toFixed(1)} dB` : null, Number.isFinite(detail?.dt_s) ? `dt ${Number(detail.dt_s).toFixed(2)}` : null,