From 553a4fcf80efc85c2b3dccfe53fcddb05e03fd3b Mon Sep 17 00:00:00 2001 From: 4aiman Date: Sat, 17 Oct 2026 10:57:08 +0300 Subject: [PATCH] Record screen: show the live HR number on the HR toggle button The HR toggle (ex-wind button) showed only the heart+pulse icon. Now the current bpm renders on it (onHrUpdate writes #rec-hr-num); it clears when HR is toggled off, leaving just the grey icon. --- frontend/css/styles.css | 4 +++- frontend/js/main.js | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/css/styles.css b/frontend/css/styles.css index 28d8214..f580eaa 100644 --- a/frontend/css/styles.css +++ b/frontend/css/styles.css @@ -726,9 +726,11 @@ select { .workout-screen .btn-primary, .workout-screen .btn-secondary { margin-top: 8px; width: 100%; } /* HR on/off toggle on the record screen (replaces the wind button): grey = off, coloured = on. */ -.rec-hr-toggle { color: #888; display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 6px 10px; } +.rec-hr-toggle { color: #888; display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding: 6px 10px; } .rec-hr-toggle svg { display: block; } .rec-hr-toggle.active { color: #ef5350; background: rgba(239, 83, 80, 0.18); } +.rec-hr-num { font-size: 14px; font-weight: 700; min-width: 0; } +.rec-hr-num:empty { display: none; } /* Progress fill for long-running action buttons: the background fills left-to-right by --pct (0-100%, set from JS). The label stays on top and readable; the unfilled part keeps diff --git a/frontend/js/main.js b/frontend/js/main.js index 2e0d2b8..615aa17 100644 --- a/frontend/js/main.js +++ b/frontend/js/main.js @@ -4602,7 +4602,7 @@ async function renderRecordingInline(container) {
${GPS.recording.state === "waiting_gps" ? "Поиск GPS..." : GPS.recording.state === "ready" ? "Начните движение..." : ""}
- +
@@ -5089,6 +5089,8 @@ async function renderRecordingInline(container) { hrEl.textContent = reading.hr; hrEl.className = "rec-hr-val " + hrZoneClass(reading.hr); } + let hrNum = document.querySelector("#rec-hr-num"); // live HR on the toggle button itself + if (hrNum) hrNum.textContent = reading.hr; let spo2El = document.querySelector("#rec-spo2"); if (spo2El) spo2El.textContent = reading.spo2 ? `SpO2: ${reading.spo2}%` : ""; let bpEl = document.querySelector("#rec-bp"); @@ -5149,6 +5151,7 @@ async function renderRecordingInline(container) { hrToggle.disabled = true; await GPS.setHrOn(!GPS.recording.hrOn); hrToggle.classList.toggle("active", !!GPS.recording.hrOn); + if (!GPS.recording.hrOn) { let n = container.querySelector("#rec-hr-num"); if (n) n.textContent = ""; } // off -> icon only hrToggle.disabled = false; };