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 2acdce2..606be50 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 @@ -1561,10 +1561,22 @@ function formatBwLabel(hz) { // Current receive bandwidth (Hz) — updated by server sync and BW drag. let currentBandwidthHz = 3_000; const spectrumBwInput = document.getElementById("spectrum-bw-input"); +const spectrumBwSetBtn = document.getElementById("spectrum-bw-set-btn"); + +function formatBandwidthInputKhz(hz) { + const khz = hz / 1000; + if (Math.abs(Math.round(khz) - khz) < 0.0001) return String(Math.round(khz)); + if (Math.abs(Math.round(khz * 10) - khz * 10) < 0.0001) return khz.toFixed(1); + return khz.toFixed(2); +} function syncBandwidthInput(hz) { if (!spectrumBwInput || !Number.isFinite(hz) || hz <= 0) return; - spectrumBwInput.value = String(Math.round(hz)); + const [, minBw, maxBw, stepBw] = mwDefaultsForMode(modeEl ? modeEl.value : "USB"); + spectrumBwInput.min = String(minBw / 1000); + spectrumBwInput.max = String(maxBw / 1000); + spectrumBwInput.step = String(stepBw / 1000); + spectrumBwInput.value = formatBandwidthInputKhz(hz); } // Apply mode-specific BW default and optionally push to server. @@ -1580,7 +1592,8 @@ async function applyBwDefaultForMode(mode, sendToServer) { async function applyBandwidthFromInput() { if (!spectrumBwInput) return; const [, minBw, maxBw] = mwDefaultsForMode(modeEl ? modeEl.value : "USB"); - const next = Math.round(Number(spectrumBwInput.value)); + const nextKhz = Number(spectrumBwInput.value); + const next = Math.round(nextKhz * 1000); if (!Number.isFinite(next) || next <= 0) { syncBandwidthInput(currentBandwidthHz); return; @@ -1593,7 +1606,6 @@ async function applyBandwidthFromInput() { } if (spectrumBwInput) { - spectrumBwInput.addEventListener("change", () => { applyBandwidthFromInput(); }); spectrumBwInput.addEventListener("keydown", (e) => { if (e.key === "Enter") { e.preventDefault(); @@ -1601,6 +1613,9 @@ if (spectrumBwInput) { } }); } +if (spectrumBwSetBtn) { + spectrumBwSetBtn.addEventListener("click", () => { applyBandwidthFromInput(); }); +} // --- Tab navigation --- document.querySelector(".tab-bar").addEventListener("click", (e) => { diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html index 5d503db..29721a1 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/index.html @@ -65,7 +65,10 @@
- +
+ + +
diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css index 00b26a5..3ed7b8f 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/style.css @@ -653,17 +653,21 @@ button:focus-visible, input:focus-visible, select:focus-visible { font-size: 0.78rem; color: var(--text-muted); } +#spectrum-bw-row { + display: flex; + align-items: center; + gap: 0.4rem; +} #spectrum-bw-label { display: flex; align-items: center; gap: 0.3rem; - font-size: 0.78rem; - color: var(--accent-yellow); - font-weight: 600; + font-size: 0.75rem; + color: var(--text-muted); min-width: 0; } #spectrum-bw-input { - width: 5.25rem; + width: 4.5rem; padding: 1px 4px; font-size: 0.75rem; border: 1px solid var(--border); @@ -673,6 +677,12 @@ button:focus-visible, input:focus-visible, select:focus-visible { text-align: right; height: 1.5rem; } +#spectrum-bw-set-btn { + height: 1.5rem; + min-height: 0; + padding: 0 8px; + font-size: 0.73rem; +} #spectrum-level-row { display: flex; align-items: center;