Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

fix(stats): keep the fatigue marker fully inside the bar at its edges

Сергей Горбатенко5c476cbe8311
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index f80534d50..1d1492639 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -120,7 +120,7 @@ function FatigueBar({ value }) {
<span className="zone ready" />
<span className="zone recovering" />
<span className="zone fatigued" />
- <span className="knob" style={{ insetInlineStart: pct + '%' }} />
+ <span className="knob" style={{ insetInlineStart: `clamp(0px, calc(${pct}% - 1.5px), calc(100% - 3px))` }} />
</div>
}
diff --git a/frontend/src/views/Stats.recovery.test.jsx b/frontend/src/views/Stats.recovery.test.jsx
index e1670e8cd..25651b29d 100644
--- a/frontend/src/views/Stats.recovery.test.jsx
+++ b/frontend/src/views/Stats.recovery.test.jsx
@@ -290,7 +290,7 @@ describe('Stats muscle recovery view runtime', () => {
expect(bar).toBeTruthy()
// The bar carries the band as a marker at the value and reads the same state the map does.
expect(bar.getAttribute('aria-label')).toBe(`Fatigue: ${pct}% · Fatigued`)
- expect(bar.querySelector('.knob').getAttribute('style')).toContain(`inset-inline-start: ${pct}%`)
+ expect(bar.querySelector('.knob').getAttribute('style')).toContain(`${pct}%`)
expect(bar.querySelector('.zone.fatigued')).toBeTruthy()
// The percentage stands alone on the right, as its numeric twin.
expect(muscleCard().textContent).toContain(`${pct}%`)