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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Add optional RIR (reps in reserve) to reps-mode sets
Octavio Di Marco6714b16e6ac8
diff --git a/frontend/src/index.css b/frontend/src/index.cssindex 386bd6289..7cec07448 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -539,6 +539,7 @@ h4.sec{.sethead .n-sp{width:24px;flex:none}.sethead .w-sp{flex:1.4;text-align:center}.sethead .r-sp{flex:1;text-align:center}+.sethead .rir-sp{flex:1.1;text-align:center}.sethead .ck-sp{width:30px;flex:none}.setrow{display:flex;align-items:center;gap:8px;padding:7px 0;position:relative}.setrow+.setrow::before{@@ -551,7 +552,19 @@ h4.sec{}.setrow .stp.w{flex:1.4;min-width:0}.setrow .stp.r{flex:1;min-width:0}+.setrow .stp.rir{flex:1.1;min-width:0}.setrow .stp button{width:32px;height:40px}+/* a 3rd stepper (RIR) needs narrower buttons and a tighter row gap to fit next to weight+reps+ on narrow phones, same technique as the exercise-config sheet's three-steppers-in-a-row+ (.cfgrow below) — RIR's own value is short ("1.5") so its buttons shrink the most, weight/reps+ just enough to make room since their values ("82.5", "12") need more of what's left. */+.setrow.rir3{gap:6px}+.setrow.rir3 .stp.w{flex:1.2}+.setrow.rir3 .stp.r{flex:1}+.setrow.rir3 .stp.rir{flex:.85}+.setrow.rir3 .stp button{width:23px}+.setrow.rir3 .stp.rir button{width:20px}+.setrow.rir3 .stp .num{font-size:14px}.setrow.done .n{background:var(--acc);color:var(--on-acc)}.setrow.done{opacity:.45}/* why the next target is what it is (issue #17) */diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.jsindex e9d773995..65e541e46 100644--- a/frontend/src/lib/history.js+++ b/frontend/src/lib/history.js@@ -29,7 +29,7 @@ export function setLabel(id, s, cfg) {const mode = modeOf(cfg || { id })if (mode === 'cardio') return `${s.min || 0} min @ ${fmtNum(s.speed || 0)} km/h`if (mode === 'time') return fmtSec(s.sec) + (s.w > 0 ? ` · ${fmtNum(s.w)}` : '')- return `${fmtNum(s.w || 0)}×${s.r || 0}`+ return `${fmtNum(s.w || 0)}×${s.r || 0}` + (s.rir != null ? ` (RIR ${fmtNum(s.rir)})` : '')}// Default config for a freshly added exercise.export function defaultConfig(id, mode) {diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.jsindex 19d394444..ec05d9a0a 100644--- a/frontend/src/lib/history.test.js+++ b/frontend/src/lib/history.test.js@@ -63,6 +63,12 @@ describe('setLabel', () => {expect(setLabel(LIFT, { w: 0, r: 0 })).toBe('0×0')expect(setLabel(CARDIO, {})).toBe('0 min @ 0 km/h')})++ it('appends RIR when present, including a valid 0', () => {+ expect(setLabel(LIFT, { w: 60, r: 10, rir: 2 })).toBe('60×10 (RIR 2)')+ expect(setLabel(LIFT, { w: 60, r: 10, rir: 1.5 })).toBe('60×10 (RIR 1.5)')+ expect(setLabel(LIFT, { w: 60, r: 10, rir: 0 })).toBe('60×10 (RIR 0)')+ })})describe('defaultConfig', () => {diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex b5c2329c0..3dda36609 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -75,6 +75,8 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemovconst col2 = cardio ? { f: 'speed', step: 0.5, dec: true, hd: t('Speed (km/h)') }: timed ? { f: 'w', step: 2.5, dec: true, hd: t('Weight ({0})', S.unit) }: { f: 'r', step: 1, dec: false, hd: t('Reps') }+ // RIR (reps in reserve) only makes sense for weighted rep sets, not cardio/timed holds.+ const col3 = mode === 'reps' ? { f: 'rir', step: 0.5, dec: true, hd: t('RIR') } : null// Uses the shared stepper markup so a set row picks up the same control styling// as every other +/- field in the app.const cell = (s, i, col, cls) => (@@ -102,11 +104,12 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov<span>{t(...plan.why)}</span></div>}<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>- <div className="sethead"><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>- {entry.sets.map((s, i) => <div key={i} className={'setrow' + (s.done ? ' done' : '')}>+ <div className="sethead"><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{col3 && <span className="rir-sp">{col3.hd}</span>}{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>+ {entry.sets.map((s, i) => <div key={i} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' rir3' : '')}><div className="n">{i + 1}</div>{cell(s, i, col1, 'w')}{cell(s, i, col2, 'r')}+ {col3 && cell(s, i, col3, 'rir')}{/* A timed set is started, not typed: the timer counts the hold down and checks theset off itself. The checkbox stays for anyone who timed it on their own watch. */}{timed && <button className="setgo" aria-label={t('Start set')} disabled={s.done || !!working}