fix(workout): label progression guidance
This commit is contained in:
1 parent
5314b342ff
commit
221e365ee8
4 files changed
+63
-2
No files matched your search
@@ -14,6 +14,7 @@ import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeigh
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button, Check, NumberField } from '../components/ui.jsx'
|
||||
import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'
|
||||
import { progressionGuidance } from '../lib/progression-copy.js'
|
||||
import { glyphOf } from '../lib/glyphs.js'
|
||||
import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps } from '../lib/workout-model.js'
|
||||
|
||||
@@ -106,6 +107,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
// What the progression policy decided for this session, and why (issue #17). Computed when
|
||||
// the session was built so the reason matches the numbers already in the rows.
|
||||
const plan = entry.plan
|
||||
const guidance = progressionGuidance(plan)
|
||||
// A bodyweight set has no weight to type, so the column is not there (issue #32) — one
|
||||
// stepper instead of two, which is the whole point of the flag. Adding a belt weight in the
|
||||
// config brings it back, now labelled as the addition it is.
|
||||
@@ -190,9 +192,9 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
</div>}
|
||||
{entry.note && <div className="exnote">{entry.note}</div>}
|
||||
{last && <div className="small dim" style={{ marginBottom: 4 }}>{t('Last time')} ({fmtDate(last.d)}): {last.sets.map(s => setLabel(entry.id, s, last.target)).join(', ')}</div>}
|
||||
{plan && plan.why && plan.kind !== 'off' && <div className={'progline' + (plan.kind === 'deload' ? ' warn' : '')}>
|
||||
{guidance && <div className={'progline' + (plan.kind === 'deload' ? ' warn' : '')}>
|
||||
<Icon name={plan.kind === 'up' ? 'arrowUp' : plan.kind === 'deload' ? 'arrowDown' : 'lightbulb'} />
|
||||
<span>{t(...plan.why)}</span>
|
||||
<span><strong>{t(guidance.policyLabel)}</strong> · {t(...guidance.why)}</span>
|
||||
</div>}
|
||||
<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>
|
||||
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}
|
||||
|
||||
@@ -155,6 +155,22 @@ describe('Workout set completion flow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('progression guidance', () => {
|
||||
it('labels the visible outcome with the policy that calculated it', async () => {
|
||||
await mount([exercise('plain-bench', [false, false, false], {
|
||||
plan: {
|
||||
policy: 'linear',
|
||||
kind: 'up',
|
||||
weight: 62.5,
|
||||
why: ['Every rep last time — {0} {1} more.', 2.5, 'kg'],
|
||||
},
|
||||
})])
|
||||
|
||||
expect(container.querySelector('.progline')?.textContent)
|
||||
.toContain('Linear progression · Every rep last time — 2.5 kg more.')
|
||||
})
|
||||
})
|
||||
|
||||
describe('superset flow survives an exercise being removed mid-session', () => {
|
||||
// removeActiveExercise splices A.entries, shifting every index above the removal down.
|
||||
// The high-water marks are index-keyed, so without re-baselining the shifted exercise
|
||||
|
||||
Reference in new issue
Block a user