From 976f66d383b1509d15d8a58199ba2bc52a14bdc8 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sat, 28 Feb 2026 12:08:20 +0100 Subject: [PATCH] [feat](trx-frontend-http): format copied rds overlay text Co-authored-by: Codex Signed-off-by: Stan Grams --- .../trx-frontend-http/assets/web/app.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 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 6ce7d24..141725c 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 @@ -3194,19 +3194,31 @@ function formatOverlayPi(pi) { } function formatOverlayPty(pty, ptyName) { - if (ptyName) return `PTY ${ptyName}`; - return pty != null ? `PTY ${pty}` : "PTY --"; + if (ptyName) return ptyName; + return pty != null ? String(pty) : "--"; } async function copyRdsPsToClipboard() { - const ps = lastSpectrumData?.rds?.program_service; - if (!ps || ps.length === 0) { + const rds = lastSpectrumData?.rds; + const ps = rds?.program_service; + if (!rds || !ps || ps.length === 0) { showHint("No RDS PS", 1200); return; } + const now = new Date(); + const yyyy = now.getFullYear(); + const mm = String(now.getMonth() + 1).padStart(2, "0"); + const dd = String(now.getDate()).padStart(2, "0"); + const hh = String(now.getHours()).padStart(2, "0"); + const min = String(now.getMinutes()).padStart(2, "0"); + const freqMhz = Number.isFinite(lastFreqHz) ? (Math.round((lastFreqHz / 100_000)) / 10).toFixed(1) : "--.-"; + const piHex = rds.pi != null + ? `0x${rds.pi.toString(16).toUpperCase().padStart(4, "0")}` + : "--"; + const clipText = `${yyyy}-${mm}-${dd} ${hh}:${min} - ${freqMhz} MHz - ${piHex} - ${ps}`; try { - await navigator.clipboard.writeText(ps); - showHint(`Copied ${ps}`, 1200); + await navigator.clipboard.writeText(clipText); + showHint("RDS copied", 1200); } catch (_) { showHint("Clipboard failed", 1500); }