Remove RIR auto-check; gate the column behind a setting
Two blockers from review: - NumberField.commit() fires onChange on every keystroke, so typing a decimal RIR (e.g. 1.5) committed the auto-check after the first character, before the value was finished — and the same auto-check turned a stray tap on an empty field's "−" (or clearing it) into a permanent "RIR 0", since 0 is indistinguishable from unset once the key exists on the set. Logging RIR is back to a plain field with no side effect; the checkbox is the only way to mark a set done, same as weight and reps. - The RIR stepper narrowed every reps-mode row's +/- buttons for everyone, including the majority not running an RIR-based program. It's now behind a `showRir` setting (Settings → Units & timer, default off), so the existing row is untouched unless opted in.
This commit is contained in:
1 parent
eb582e3c7b
commit
c3929b0a70
3 files changed
+14
-18
No files matched your search
@@ -133,6 +133,9 @@ export default function Settings() {
|
||||
<Row icon="bell" iconTint="var(--pink)" title={t('Sounds')}>
|
||||
<Switch checked={!!S.sound} onChange={v => update(s => { s.sound = v })} />
|
||||
</Row>
|
||||
<Row icon="target" iconTint="var(--purple)" title={t('Show RIR column')}>
|
||||
<Switch checked={!!S.showRir} onChange={v => update(s => { s.showRir = v })} />
|
||||
</Row>
|
||||
</Section>
|
||||
|
||||
{(user || MOBILE) && <NotificationsCard S={S} update={update} toast={toast} />}
|
||||
|
||||
@@ -75,25 +75,18 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
const 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
|
||||
// RIR (reps in reserve) only makes sense for weighted rep sets, not cardio/timed holds,
|
||||
// and is opt-in (Settings) since it adds a third stepper to every row.
|
||||
const col3 = mode === 'reps' && S.showRir ? { 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) => {
|
||||
// Logging RIR is the last thing you do for a set — it means you just finished it, so it
|
||||
// checks the set off by itself instead of making you tap Done separately. Only fires once
|
||||
// (guarded by !s.done) so editing RIR on an already-done set doesn't re-trigger the beep/
|
||||
// rest timer, and never applies to weight/reps, which you can set before you've lifted.
|
||||
const markDoneFromRir = () => { if (col.f === 'rir' && !s.done) onToggle(i) }
|
||||
const set = v => { onField(i, col.f, v); markDoneFromRir() }
|
||||
return (
|
||||
<div className={'stp ' + cls}>
|
||||
<button aria-label="Decrease" onClick={() => set(Math.max(0, Math.round(((s[col.f] || 0) - col.step) * 100) / 100))}><Icon name="minus" /></button>
|
||||
<span className="val"><NumberField decimal={col.dec} value={s[col.f] ?? ''} onChange={set} /></span>
|
||||
<button aria-label="Increase" onClick={() => set(Math.max(0, Math.round(((s[col.f] || 0) + col.step) * 100) / 100))}><Icon name="plus" /></button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const cell = (s, i, col, cls) => (
|
||||
<div className={'stp ' + cls}>
|
||||
<button aria-label="Decrease" onClick={() => onField(i, col.f, Math.max(0, Math.round(((s[col.f] || 0) - col.step) * 100) / 100))}><Icon name="minus" /></button>
|
||||
<span className="val"><NumberField decimal={col.dec} value={s[col.f] ?? ''} onChange={v => onField(i, col.f, v)} /></span>
|
||||
<button aria-label="Increase" onClick={() => onField(i, col.f, Math.max(0, Math.round(((s[col.f] || 0) + col.step) * 100) / 100))}><Icon name="plus" /></button>
|
||||
</div>
|
||||
)
|
||||
return <>
|
||||
<Media ex={ex} key={entry.id} compact={compact} minimizable />
|
||||
<div className="row between" style={{ marginBottom: 6 }}>
|
||||
|
||||
Reference in new issue
Block a user