Bodyweight work, logged the way it is done
A push-up has no weight to type and the app asked for one anyway, on a quarter of the catalogue. Issues #31, #32 and #33 are the same gap seen from three sides: the app assumed progress lived in the load. Two flags on the exercise config rather than two new modes, because "bodyweight" and "per side" are equally true of a rep set and a timed hold: bodyweight — seeded from the equipment the dataset already records. The weight column is gone, the set row is one stepper, and the working-weight prompt stops asking about a weight that was never there. A belt weight reads as an addition and hands progression back to the normal policies, because now there is something to add. side — 8 logged is 8 per side. The total is spelled out where there is width for it, and volume counts both sides so a routine that moved to single-arm work no longer halves itself on the chart. Bodyweight progression grows reps, and now sets: a rep ceiling sends the reps back to the bottom and adds a set instead of climbing forever, stopping at six with the advice it should have given all along. No ceiling keeps the old behaviour exactly. Both flags are written to a plan only when they disagree with the catalogue, and absent reads as false, so every existing plan, workout and backup is read unchanged.
This commit is contained in:
1 parent
8de55ce0d9
commit
c33ff15d9d
20 files changed
+524
-44
No files matched your search
+45
-8
@@ -1,9 +1,9 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useStore } from './store/useStore.js'
|
||||
import { useUI } from './store/useUI.js'
|
||||
import { EXDB, EXIDX, BODYPARTS, isCardio, allExercises, equipmentOf } from './lib/exercises.js'
|
||||
import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf } from './lib/exercises.js'
|
||||
import { fmtDate, fmtNum, fmtVol, fmtDur, durPart, todayISO, uid, exCount, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'
|
||||
import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf } from './lib/history.js'
|
||||
import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide } from './lib/history.js'
|
||||
import { beep, vibrate } from './lib/sound.js'
|
||||
import { t, instrFor, getLang, INSTR_LANGS } from './lib/i18n.js'
|
||||
import { nav } from './lib/nav.js'
|
||||
@@ -11,14 +11,14 @@ import { starterRoutines } from './lib/starter.js'
|
||||
import Media, { Thumb } from './components/Media.jsx'
|
||||
import Stepper from './components/Stepper.jsx'
|
||||
import Icon from './components/Icon.jsx'
|
||||
import { Button, Slider, Switch, Segmented, SelectRow } from './components/ui.jsx'
|
||||
import { Button, Slider, Switch, Segmented, SelectRow, Row } from './components/ui.jsx'
|
||||
import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js'
|
||||
import BodyMap from './components/BodyMap.jsx'
|
||||
import { loadOfWorkouts } from './lib/muscles.js'
|
||||
import { parseImport, mergeImport } from './lib/import-csv.js'
|
||||
import { buildPlanBundle, parsePlan, mergePlan, printPlan } from './lib/plan-share.js'
|
||||
import { estimate1RM, best1RM, is1RMRecord, REP_CAP } from './lib/onerm.js'
|
||||
import { nextPrescription, applyPrescription, policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC } from './lib/progression.js'
|
||||
import { nextPrescription, applyPrescription, policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC, MAX_BW_SETS } from './lib/progression.js'
|
||||
import { MOBILE, shareExport } from './lib/mobile.js'
|
||||
|
||||
const S = () => useStore.getState().S
|
||||
@@ -489,6 +489,9 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
|
||||
// Cardio keeps its own duration+speed form; the reps/time choice (issue #16) is offered for
|
||||
// everything else, which is where the gap was — planks, hangs, wall sits, loaded carries.
|
||||
const mode = cardio ? 'cardio' : modeOf({ ...c, id: ex.id })
|
||||
// Both default from the dataset and are then whatever the config says — see isBw.
|
||||
const bw = !cardio && isBw({ ...c, id: ex.id })
|
||||
const perSide = isPerSide(c)
|
||||
// Keep whatever the other mode already had (sets, weight) and fill only what is missing.
|
||||
const setMode = m => setC(x => ({ ...defaultConfig(ex.id, m), ...x, mode: m }))
|
||||
const save = () => {
|
||||
@@ -499,12 +502,19 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
|
||||
const prog = {}
|
||||
if (c.prog) prog.prog = c.prog
|
||||
if (c.inc > 0) prog.inc = c.inc
|
||||
// Written only when it differs from what the dataset already says, so a barbell config
|
||||
// stays exactly the shape it was before these flags existed.
|
||||
const flags = {}
|
||||
if (bw !== isBodyweightEq(ex.id)) flags.bodyweight = bw
|
||||
if (perSide) flags.side = true
|
||||
if (cardio) onSave({ sets, min: Math.max(1, Math.round(c.min) || 20), speed: Math.max(0, c.speed || 8) })
|
||||
else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...prog })
|
||||
else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...flags, ...prog })
|
||||
else {
|
||||
const reps = Math.max(1, Math.round(c.reps) || 10)
|
||||
const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...prog }
|
||||
const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...prog }
|
||||
if (policyFor({ ...c, id: ex.id }, routine, 'reps') === 'double') out.repsMin = Math.min(reps, Math.max(1, Math.round(c.repsMin) || Math.max(1, reps - 2)))
|
||||
// A ceiling below the working reps would tell you to add a set on day one.
|
||||
if (bw && !(out.weight > 0) && c.repsMax > 0) out.repsMax = Math.max(reps, Math.round(c.repsMax))
|
||||
onSave(out)
|
||||
}
|
||||
}
|
||||
@@ -532,12 +542,39 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
|
||||
</> : <>
|
||||
<Stepper label={t('Sets')} value={c.sets} step={1} decimal={false} onChange={v => setC(x => ({ ...x, sets: v }))} />
|
||||
<Stepper label={t('Reps')} value={c.reps} step={1} decimal={false} onChange={v => setC(x => ({ ...x, reps: v }))} />
|
||||
<Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />
|
||||
{/* On bodyweight work the weight stepper is the click #32 is about, so it is not here
|
||||
until there is a belt to describe — see the added-weight row below. */}
|
||||
{!bw && <Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />}
|
||||
</>}
|
||||
</div>
|
||||
{mode === 'time' && <div className="small dim" style={{ marginBottom: 18 }}>
|
||||
{mode === 'time' && !bw && <div className="small dim" style={{ marginBottom: 18 }}>
|
||||
{t('A timer runs while you hold the set. Leave the weight at 0 for bodyweight holds.')}
|
||||
</div>}
|
||||
{/* ---------- bodyweight + per side (issues #31/#32/#33) ---------- */}
|
||||
{!cardio && <div className="sect-b" style={{ marginBottom: 8 }}>
|
||||
<Row icon="figureStrength" iconTint="var(--acc)" title={t('Bodyweight')}
|
||||
subtitle={bw ? t('No weight to enter — just log the reps.') : t('Ask for a weight on every set.')}>
|
||||
<Switch checked={bw} onChange={v => setC(x => ({ ...x, bodyweight: v, weight: v ? 0 : x.weight }))} />
|
||||
</Row>
|
||||
{bw && <Row icon="plus" iconTint="var(--indigo)" title={t('Added weight')}
|
||||
subtitle={t('For dips or pull-ups with a belt. Progression then follows the weight.')}>
|
||||
<Stepper value={c.weight || 0} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />
|
||||
</Row>}
|
||||
{mode === 'reps' && <Row icon="shuffle" iconTint="var(--blue)" title={t('Reps per side')}
|
||||
subtitle={perSide ? t('{0} logged is {1} in total.', c.reps || 0, (c.reps || 0) * 2) : t('For lunges, single-arm rows and the like.')}>
|
||||
<Switch checked={perSide} onChange={v => setC(x => ({ ...x, side: v || undefined }))} />
|
||||
</Row>}
|
||||
</div>}
|
||||
{/* The rep ceiling only means something when there is no load to add instead. */}
|
||||
{mode === 'reps' && bw && !(c.weight > 0) && <div className="row cfgrow" style={{ marginBottom: 18 }}>
|
||||
<Stepper label={t('Top of the range')} value={c.repsMax || 0} step={1} decimal={false}
|
||||
onChange={v => setC(x => ({ ...x, repsMax: v }))} />
|
||||
</div>}
|
||||
{mode === 'reps' && bw && !(c.weight > 0) && <div className="small dim" style={{ marginTop: -10, marginBottom: 18 }}>
|
||||
{c.repsMax > 0
|
||||
? t('Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.', c.repsMax, MAX_BW_SETS)
|
||||
: t('Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.')}
|
||||
</div>}
|
||||
<ProgressionFields ex={ex} mode={mode} c={c} setC={setC} routine={routine} unit={st.unit} />
|
||||
<Button variant="primary" onClick={save}>{existing ? t('Save') : t('Add to routine')}</Button>
|
||||
{ex.custom && <><div style={{ height: 8 }} /><Button icon="pencil" onClick={() => { close(); customExSheet(ex) }}>{t('Edit or delete this exercise')}</Button></>}
|
||||
|
||||
Reference in new issue
Block a user