[style](trx-frontend): dim placeholder gaps in RDS PS

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-02 21:54:56 +01:00
parent 91a55554ac
commit b6692b759e
2 changed files with 25 additions and 2 deletions
@@ -4445,6 +4445,20 @@ function formatOverlayPs(ps) {
.replaceAll(" ", "_");
}
function formatPsHtml(ps) {
const clipped = String(ps ?? "").slice(0, 8);
let html = "";
for (let i = 0; i < 8; i += 1) {
const ch = clipped[i];
if (ch == null || ch === " ") {
html += `<span class="rds-ps-gap">_</span>`;
} else {
html += escapeMapHtml(ch);
}
}
return html;
}
function formatOverlayPi(pi) {
return pi != null
? `PI 0x${pi.toString(16).toUpperCase().padStart(4, "0")}`
@@ -4611,7 +4625,7 @@ function updateRdsPsOverlay(rds) {
`${overlayTrafficFlagHtml("TA", rds?.traffic_announcement)}` +
`</span>`;
rdsPsOverlay.innerHTML =
`<span class="${mainClass}">${escapeMapHtml(mainText)}</span>` +
`<span class="${mainClass}">${hasPs ? formatPsHtml(ps) : escapeMapHtml(mainText)}</span>` +
`<span class="rds-ps-meta">` +
`<span class="rds-ps-meta-text">${escapeMapHtml(metaText)}</span>` +
`${trafficFlags}` +
@@ -4678,7 +4692,13 @@ function updateRdsPsOverlay(rds) {
statusEl.textContent = "Decoding";
statusEl.className = "rds-value rds-decoding";
piEl.textContent = rds.pi != null ? `0x${rds.pi.toString(16).toUpperCase().padStart(4, "0")}` : "--";
psEl.textContent = rds.program_service ?? "--";
if (psEl) {
if (rds.program_service) {
psEl.innerHTML = formatPsHtml(rds.program_service);
} else {
psEl.textContent = "--";
}
}
ptyEl.textContent = rds.pty_name ?? (rds.pty != null ? String(rds.pty) : "--");
ptyNameEl.textContent = rds.pty != null ? String(rds.pty) : "--";
if (ptynEl) ptynEl.textContent = rds.program_type_name_long ?? "--";
@@ -577,6 +577,9 @@ small { color: var(--text-muted); }
letter-spacing: 0.08em;
white-space: pre;
}
.rds-ps-gap {
color: color-mix(in srgb, currentColor 34%, var(--text-muted));
}
.rds-ps-fallback {
display: block;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;