Effort per set: RIR or RPE, whichever scale you think in
The RIR column becomes a three-way setting (Off / RIR / RPE). Both scales measure the same judgement from opposite ends — RPE 8 is RIR 2 — so they share one column and one stepper, but keep their own field on the set. A set is never silently rewritten into the other scale: switching the setting changes what new sets ask for, and old sets still read back with the scale they were logged with. Profiles carrying the old showRir boolean keep their column (effortOf falls back to it until the new setting is chosen), so a backup or another device that still has the flag does not lose the column. The steppers now know the scale: the first + lands on a typical working set (RIR 2 / RPE 8) instead of the end of the scale, and typed values are capped at 10 — there is no RPE 12.
This commit is contained in:
1 parent
fa978a1bb4
commit
4e27461b7e
17 files changed
+210
-51
No files matched your search
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
|
||||
import { useStore, DEF, hasData } from '../store/useStore.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { ACCENTS, todayISO, localTZ } from '../lib/format.js'
|
||||
import { effortOf } from '../lib/history.js'
|
||||
import { webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
|
||||
import { pushSupported, enablePush, disablePush, sendTestPush } from '../lib/push.js'
|
||||
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
|
||||
@@ -133,8 +134,13 @@ 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 })} />
|
||||
{/* Two names for the same judgement, so the column asks in the scale you already think in.
|
||||
The (i) explains the difference rather than making the row title carry it. */}
|
||||
<Row icon="target" iconTint="var(--purple)" title={t('Effort per set')}>
|
||||
<Segmented className="seg-inline"
|
||||
options={[{ value: 'none', label: t('Off') }, { value: 'rir', label: t('RIR') }, { value: 'rpe', label: t('RPE') }]}
|
||||
value={effortOf(S)} onChange={v => update(s => { s.effort = v; delete s.showRir })} />
|
||||
<button className="helpbtn" aria-label={t('What are RIR and RPE?')} onClick={effortHelpSheet}><Icon name="info" /></button>
|
||||
</Row>
|
||||
</Section>
|
||||
|
||||
@@ -169,6 +175,21 @@ export default function Settings() {
|
||||
</div>
|
||||
}
|
||||
|
||||
// Short on purpose: the two scales measure the same thing from opposite ends, and that one
|
||||
// sentence is what people actually come looking for.
|
||||
function effortHelpSheet() {
|
||||
useUI.getState().openSheet(close => <>
|
||||
<h3>{t('Effort per set')}</h3>
|
||||
<div className="muted small" style={{ lineHeight: 1.55, display: 'grid', gap: 10 }}>
|
||||
<div>{t('How hard a set was, logged next to weight and reps. Nothing else reads it — your progression and estimated 1RM are unaffected.')}</div>
|
||||
<div>{t('RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.')}</div>
|
||||
<div>{t('RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.')}</div>
|
||||
<div>{t('So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.')}</div>
|
||||
</div>
|
||||
<div style={{ height: 8 }} />
|
||||
</>)
|
||||
}
|
||||
|
||||
function NotificationsCard({ S, update, toast }) {
|
||||
if (MOBILE) return <MobileReminderCard S={S} update={update} toast={toast} />
|
||||
return <PushCard S={S} update={update} toast={toast} />
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { exOr } from '../lib/exercises.js'
|
||||
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf } from '../lib/history.js'
|
||||
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, EFFORT, effortOf } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
|
||||
import { beep, vibrate } from '../lib/sound.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
@@ -75,24 +75,28 @@ 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,
|
||||
// and is opt-in (Settings) since it adds a third stepper to every row. `opt` because an
|
||||
// unlogged RIR is not the same as RIR 0 — 0 says the set went to failure.
|
||||
const col3 = mode === 'reps' && S.showRir ? { f: 'rir', step: 0.5, dec: true, opt: true, hd: t('RIR') } : null
|
||||
// Stepping an optional field that was never filled in stays empty rather than clamping to 0:
|
||||
// otherwise one stray − on a fresh row stamps "(RIR 0)" on the set for good. Going down from
|
||||
// 0.5 still reaches a real 0.
|
||||
// Effort (RIR or RPE, whichever the profile logs) only makes sense for weighted rep sets,
|
||||
// not cardio/timed holds, and is opt-in since it adds a third stepper to every row. `opt`
|
||||
// because an unlogged effort is not the same as 0 — RIR 0 says the set went to failure.
|
||||
const eff = EFFORT[effortOf(S)]
|
||||
const col3 = mode === 'reps' && eff ? { ...eff, dec: true, opt: true, hd: t(eff.hd) } : null
|
||||
// Stepping an optional field that was never filled in must not clamp to 0: one stray − on a
|
||||
// fresh row would stamp "(RIR 0)" — to failure — on the set for good. − leaves it empty, and
|
||||
// the first + lands on a typical working set (RIR 2 / RPE 8) rather than the end of the scale.
|
||||
const bump = (s, i, col, dir) => {
|
||||
const cur = s[col.f]
|
||||
if (col.opt && cur == null && dir < 0) return
|
||||
onField(i, col.f, Math.max(0, Math.round(((cur || 0) + dir * col.step) * 100) / 100))
|
||||
if (col.opt && cur == null) return dir < 0 ? undefined : onField(i, col.f, col.start)
|
||||
const n = Math.round(((cur || 0) + dir * col.step) * 100) / 100
|
||||
onField(i, col.f, Math.min(col.max ?? Infinity, Math.max(0, n)))
|
||||
}
|
||||
// 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) => (
|
||||
<div className={'stp ' + cls}>
|
||||
<button aria-label="Decrease" onClick={() => bump(s, i, col, -1)}><Icon name="minus" /></button>
|
||||
<span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''} onChange={v => onField(i, col.f, v)} /></span>
|
||||
{/* a typed value is capped too — RPE has no 12, and 12 reps in reserve is a warm-up */}
|
||||
<span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''}
|
||||
onChange={v => onField(i, col.f, v == null || col.max == null ? v : Math.min(col.max, v))} /></span>
|
||||
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
|
||||
</div>
|
||||
)
|
||||
@@ -114,13 +118,13 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
<span>{t(...plan.why)}</span>
|
||||
</div>}
|
||||
<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>
|
||||
{/* the header carries the same rir3 sizing as the rows, or the labels drift off their columns */}
|
||||
<div className={'sethead' + (col3 ? ' rir3' : '')}><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' : '')}>
|
||||
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}
|
||||
<div className={'sethead' + (col3 ? ' eff3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{col3 && <span className="eff-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 ? ' eff3' : '')}>
|
||||
<div className="n">{i + 1}</div>
|
||||
{cell(s, i, col1, 'w')}
|
||||
{cell(s, i, col2, 'r')}
|
||||
{col3 && cell(s, i, col3, 'rir')}
|
||||
{col3 && cell(s, i, col3, 'eff')}
|
||||
{/* A timed set is started, not typed: the timer counts the hold down and checks the
|
||||
set 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}
|
||||
|
||||
Reference in new issue
Block a user