[feat](trx-frontend-http): show rig name and location in page title

Include active rig display name and nearest city in the browser tab
title: "freq - rig name - city, country - trx-rs v<version>".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-22 14:20:09 +01:00
parent 6c8d294f6a
commit 1e438acaf7
@@ -599,6 +599,7 @@ let sdrSquelchSupported = false;
let lastRigIds = []; let lastRigIds = [];
let lastRigDisplayNames = {}; let lastRigDisplayNames = {};
let lastActiveRigId = null; let lastActiveRigId = null;
let lastCityLabel = "";
let sseSessionId = null; let sseSessionId = null;
const originalTitle = document.title; const originalTitle = document.title;
const savedTheme = loadSetting("theme", null); const savedTheme = loadSetting("theme", null);
@@ -618,6 +619,9 @@ function updateDocumentTitle(rds = null) {
if (ps && ps.length > 0) { if (ps && ps.length > 0) {
parts.push(ps); parts.push(ps);
} }
const rigName = (lastActiveRigId && lastRigDisplayNames[lastActiveRigId]) || lastActiveRigId || "";
if (rigName) parts.push(rigName);
if (lastCityLabel) parts.push(lastCityLabel);
parts.push(originalTitle); parts.push(originalTitle);
document.title = parts.join(" - "); document.title = parts.join(" - ");
} }
@@ -941,6 +945,7 @@ function updateRigSubtitle(activeRigId) {
if (!rigSubtitle) return; if (!rigSubtitle) return;
const name = (activeRigId && lastRigDisplayNames[activeRigId]) || activeRigId || "--"; const name = (activeRigId && lastRigDisplayNames[activeRigId]) || activeRigId || "--";
rigSubtitle.textContent = `Rig: ${name}`; rigSubtitle.textContent = `Rig: ${name}`;
updateDocumentTitle(activeChannelRds());
} }
function applyRigList(activeRigId, rigIds, displayNames) { function applyRigList(activeRigId, rigIds, displayNames) {
@@ -6443,9 +6448,11 @@ function reverseGeocodeLocation(lat, lon, grid) {
const country = addr.country || ""; const country = addr.country || "";
if (!city && !country) return; if (!city && !country) return;
const label = city && country ? `${city}, ${country}` : (city || country); const label = city && country ? `${city}, ${country}` : (city || country);
lastCityLabel = label;
if (locationSubtitle) { if (locationSubtitle) {
locationSubtitle.textContent = `Location: ${grid} · ${label}`; locationSubtitle.textContent = `Location: ${grid} · ${label}`;
} }
updateDocumentTitle(activeChannelRds());
}) })
.catch(() => {}); .catch(() => {});
} }