[fix](trx-frontend-http): restore select_rig call and simplify play button icon
Rig switch needs the server call so SSE/audio follow the selected rig. Play button now uses a fixed triangle icon sized to match header controls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -3349,9 +3349,6 @@ async function switchRigFromSelect(selectEl) {
|
|||||||
showHint("Unknown rig", 1500);
|
showHint("Unknown rig", 1500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Rig selection is purely client-side: set the per-tab rig_id so all
|
|
||||||
// subsequent commands target this rig. No server call needed — postPath()
|
|
||||||
// auto-appends rig_id to every request.
|
|
||||||
const prevRig = lastActiveRigId;
|
const prevRig = lastActiveRigId;
|
||||||
lastActiveRigId = selectEl.value;
|
lastActiveRigId = selectEl.value;
|
||||||
if (prevRig && prevRig !== lastActiveRigId) {
|
if (prevRig && prevRig !== lastActiveRigId) {
|
||||||
@@ -3360,6 +3357,14 @@ async function switchRigFromSelect(selectEl) {
|
|||||||
updateRigSubtitle(lastActiveRigId);
|
updateRigSubtitle(lastActiveRigId);
|
||||||
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
|
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
|
||||||
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
|
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
|
||||||
|
// Also switch the server's active rig so the SSE stream and audio
|
||||||
|
// follow. Commands already carry rig_id per-tab, but SSE is still
|
||||||
|
// global until per-session streams are implemented.
|
||||||
|
try {
|
||||||
|
await postPath(`/select_rig?rig_id=${encodeURIComponent(selectEl.value)}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error("select_rig failed:", err);
|
||||||
|
}
|
||||||
showHint(`Rig: ${lastActiveRigId}`, 1500);
|
showHint(`Rig: ${lastActiveRigId}`, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7748,15 +7753,9 @@ txAudioBtn.addEventListener("click", startTxAudio);
|
|||||||
|
|
||||||
// Header play button mirrors the RX audio toggle.
|
// Header play button mirrors the RX audio toggle.
|
||||||
const headerAudioToggle = document.getElementById("header-audio-toggle");
|
const headerAudioToggle = document.getElementById("header-audio-toggle");
|
||||||
const headerAudioIconPath = document.getElementById("header-audio-icon-path");
|
|
||||||
const PLAY_ICON = "M5 3.5v9l7-4.5z";
|
|
||||||
const STOP_ICON = "M4 3.5h8v9H4z";
|
|
||||||
function syncHeaderAudioBtn() {
|
function syncHeaderAudioBtn() {
|
||||||
if (!headerAudioToggle) return;
|
if (!headerAudioToggle) return;
|
||||||
headerAudioToggle.classList.toggle("audio-active", rxActive);
|
headerAudioToggle.classList.toggle("audio-active", rxActive);
|
||||||
if (headerAudioIconPath) {
|
|
||||||
headerAudioIconPath.setAttribute("d", rxActive ? STOP_ICON : PLAY_ICON);
|
|
||||||
}
|
|
||||||
headerAudioToggle.title = rxActive ? "Stop audio" : "Play audio";
|
headerAudioToggle.title = rxActive ? "Stop audio" : "Play audio";
|
||||||
}
|
}
|
||||||
if (headerAudioToggle) {
|
if (headerAudioToggle) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="top-bar-actions">
|
<div class="top-bar-actions">
|
||||||
<button id="header-audio-toggle" class="header-bar-btn header-audio-btn" aria-label="Toggle audio playback" title="Toggle audio playback">
|
<button id="header-audio-toggle" class="header-bar-btn header-audio-btn" aria-label="Toggle audio playback" title="Toggle audio playback">
|
||||||
<svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path id="header-audio-icon-path" d="M5 3.5v9l7-4.5z"/></svg>
|
<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M5 3v10l8-5z"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<div class="header-rig-switch">
|
<div class="header-rig-switch">
|
||||||
<select id="header-rig-switch-select" aria-label="Select active rig"></select>
|
<select id="header-rig-switch-select" aria-label="Select active rig"></select>
|
||||||
|
|||||||
@@ -1041,6 +1041,10 @@ small { color: var(--text-muted); }
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
.header-audio-btn svg {
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
.header-audio-btn.audio-active {
|
.header-audio-btn.audio-active {
|
||||||
color: var(--accent-green);
|
color: var(--accent-green);
|
||||||
border-color: var(--accent-green);
|
border-color: var(--accent-green);
|
||||||
|
|||||||
Reference in New Issue
Block a user