commit
5a0345c905
22 files changed
+565
-49
No files matched your search
@@ -30,6 +30,34 @@ label and nowhere else. Stats now answers the question the number was recorded f
|
||||
sit higher.
|
||||
- Translated into all 12 UI languages.
|
||||
|
||||
### Bodyweight training, logged the way it is done
|
||||
|
||||
A push-up has no weight to type, and the app asked for one anyway — every set, on a quarter of
|
||||
the catalogue. Three reports (#31, #32, #33) turned out to be the same gap: the app assumed
|
||||
progress lived in the load. It doesn't, for the exercises most people actually start with.
|
||||
|
||||
- 💪 **Exercises know they are bodyweight.** Seeded from the equipment the dataset already
|
||||
records, so push-ups, pull-ups, dips and 300-odd others arrive marked. The weight column is
|
||||
not shown, the set row is one stepper instead of two, and the "confirm your working weight"
|
||||
prompt at the end of an exercise stops asking about a weight that was never there. (#32)
|
||||
- **Added weight when there is any.** A dip belt or a weighted vest is entered once in the
|
||||
exercise settings and reads as an addition — "+10 × 8", not "10×8" — everywhere it is shown
|
||||
back. With load on the belt the normal progression rules take over again, because now there
|
||||
is something to add.
|
||||
- 📈 **Reps and sets are the progression.** Clean session, one more rep. Set a top of the range
|
||||
and reaching it adds a set and starts the reps over instead of climbing forever; at six sets
|
||||
it says what it should have said all along, which is that it is time for weight or a harder
|
||||
variation. No ceiling set keeps the old behaviour exactly. (#33)
|
||||
- ↔️ **Reps per side.** For lunges, single-arm rows and every other unilateral movement. You
|
||||
log what you did — 16, the total — and the app shows the split, "8 per side", so the set in
|
||||
front of you is unambiguous without the rep count meaning one thing here and another there.
|
||||
The target steps in twos, 16 → 18 → 20, because half of an odd total is a rep one side never
|
||||
gets. (#31)
|
||||
- Both settings travel with a shared plan, and are written to a plan file only when they
|
||||
disagree with the catalogue — every existing plan, workout and backup is read unchanged and
|
||||
none of it needs migrating.
|
||||
- Translated into all 12 UI languages.
|
||||
|
||||
## v1.2.3 — 2026-07-31
|
||||
|
||||
How hard a set was, in whichever of the two scales you already think in — and the ratings your
|
||||
|
||||
@@ -233,7 +233,11 @@ h4.sec{
|
||||
.lrow-m{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
|
||||
.lrow-t{font-size:17px;letter-spacing:-.012em;line-height:1.25}
|
||||
.lrow-s{font-size:13px;color:var(--label-2);line-height:1.3}
|
||||
.lrow-v{color:var(--label-2);font-size:17px;letter-spacing:-.012em;flex:none}
|
||||
/* flex:none would let a long value ("Follow the routine (Linear progression)") run straight
|
||||
through the title next to it, since the title's column is already free to shrink to nothing.
|
||||
Letting the value shrink and ellipsise instead keeps the two out of each other's way. */
|
||||
.lrow-v{color:var(--label-2);font-size:17px;letter-spacing:-.012em;flex:0 1 auto;min-width:0;
|
||||
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right}
|
||||
.lrow-c{color:var(--label);font-size:15px;flex:none;--icon-stroke:2.4}
|
||||
.lrow-k{color:var(--acc);font-size:17px;flex:none;--icon-stroke:2.4}
|
||||
.lrow.danger,.lrow.danger .lrow-t{color:var(--red)}
|
||||
|
||||
@@ -37,6 +37,13 @@ export const gifSrc = ex => GIF_BASE + ex.gif
|
||||
// Cardio exercises log time + speed instead of weight × reps.
|
||||
export const isCardio = idOrEx => (typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.bp === 'cardio'
|
||||
|
||||
// Exercises the dataset already knows carry no external load (issue #32) — a quarter of the
|
||||
// catalogue. This seeds the `bw` flag on a fresh config so a push-up never asks for a weight
|
||||
// nobody was going to enter. It is only the default: the flag lives on the config, so a dip
|
||||
// done with a belt can turn it off and a custom exercise can turn it on.
|
||||
export const isBodyweightEq = idOrEx =>
|
||||
(typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.eq === 'body weight'
|
||||
|
||||
// An id that resolves to nothing — a plan file built against a different exercise dataset,
|
||||
// a custom exercise deleted on another device before the sync arrived — still has to
|
||||
// render. A placeholder keeps it visible (and removable) instead of taking the whole view
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Pure helpers over the state object S (ported 1:1 from the vanilla app).
|
||||
import { todayISO, isoOf, weekKey, fmtNum } from './format.js'
|
||||
import { isCardio } from './exercises.js'
|
||||
import { isCardio, isBodyweightEq } from './exercises.js'
|
||||
import { t } from './i18n.js'
|
||||
|
||||
// How an exercise is logged (issue #16). This used to be derived from the body part alone,
|
||||
// which meant a plank or a farmer's carry could only be timed by filing it under cardio.
|
||||
@@ -17,6 +18,28 @@ export function modeOf(cfg) {
|
||||
}
|
||||
export const isTimed = cfg => modeOf(cfg) === 'time'
|
||||
|
||||
// Two flags that ride on top of a mode rather than making new ones (issues #31/#32), because
|
||||
// "bodyweight" and "per side" are true of a rep set and of a timed hold alike:
|
||||
// bodyweight — the exercise carries no load of its own, so `w` means *added* weight and is
|
||||
// asked for only once you say there is some. Seeded from the equipment field.
|
||||
// Spelled out rather than `bw`, which a workout already uses for the weigh-in
|
||||
// it was logged at — two different things one letter apart is a bug waiting.
|
||||
// side — the exercise is unilateral. You still log what you did: 16, the total across
|
||||
// both sides. The split is derived for planning ("8 per side"), never entered
|
||||
// — a number that sometimes means one side and sometimes both is the thing
|
||||
// that made this ambiguous in the first place, and one rep count that always
|
||||
// means the same thing beats two that need a legend.
|
||||
// Both are absent on every plan, workout and backup written before they existed, and absent
|
||||
// reads as false, so nothing needs migrating.
|
||||
export const isBw = cfg => (cfg && cfg.bodyweight != null ? !!cfg.bodyweight : isBodyweightEq(cfg && cfg.id))
|
||||
export const isPerSide = cfg => !!(cfg && cfg.side)
|
||||
// What one side did, for display only. Half of an odd total is shown as it falls (8.5) rather
|
||||
// than rounded away: it means the sides were not even, which is worth seeing.
|
||||
export const sideReps = reps => (reps || 0) / 2
|
||||
// Unilateral work moves in pairs, so its rep target steps by two — 16, 18, 20 — and a total
|
||||
// that stayed odd would put a rep on one side and not the other.
|
||||
export const repStep = cfg => (isPerSide(cfg) ? 2 : 1)
|
||||
|
||||
// mm:ss for a work duration — seconds alone read badly past a minute ("90 s" vs "1:30").
|
||||
export function fmtSec(sec) {
|
||||
const n = Math.max(0, Math.round(Number(sec) || 0))
|
||||
@@ -69,27 +92,43 @@ const effortTail = s => {
|
||||
// One-line summary of a logged set. `cfg` carries the mode when the caller has it (a routine
|
||||
// entry or a workout entry); passing an id alone keeps the old body-part behaviour.
|
||||
export function setLabel(id, s, cfg) {
|
||||
const mode = modeOf(cfg || { id })
|
||||
const c = cfg || { id }
|
||||
const mode = modeOf(c)
|
||||
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}` + effortTail(s)
|
||||
// Bodyweight reads as what you did — "12", or "+10 × 12" once there is a belt involved —
|
||||
// rather than "0×12", which says a set was performed with no weight and means nothing.
|
||||
// A per-side set needs no mark here: the number logged is the total, the same as every
|
||||
// other set in the app.
|
||||
const reps = s.r || 0
|
||||
if (isBw({ ...c, id: c.id ?? id })) {
|
||||
const load = s.w > 0 ? `+${fmtNum(s.w)} × ` : ''
|
||||
return `${load}${reps}` + effortTail(s)
|
||||
}
|
||||
return `${fmtNum(s.w || 0)}×${reps}` + effortTail(s)
|
||||
}
|
||||
// Default config for a freshly added exercise.
|
||||
export function defaultConfig(id, mode) {
|
||||
const m = mode || modeOf({ id })
|
||||
if (m === 'cardio') return { sets: 1, min: 20, speed: 8 }
|
||||
if (m === 'time') return { sets: 3, sec: 45, weight: 0, mode: 'time' }
|
||||
return { sets: 3, reps: 10, weight: 0, mode: 'reps' }
|
||||
// Written only when it is true, so a barbell config is byte-for-byte what it was before
|
||||
// the flag existed and a plan file gains nothing it does not need.
|
||||
const bw = isBodyweightEq(id) ? { bodyweight: true } : {}
|
||||
if (m === 'time') return { sets: 3, sec: 45, weight: 0, mode: 'time', ...bw }
|
||||
return { sets: 3, reps: 10, weight: 0, mode: 'reps', ...bw }
|
||||
}
|
||||
// One-line summary of a planned exercise ("3 × 10 · 60 kg"), shared by the routine editor
|
||||
// and the plan export so a mode is described the same way everywhere.
|
||||
export function exLine(cfg, unit) {
|
||||
const mode = modeOf(cfg)
|
||||
const n = cfg.sets || 1
|
||||
const load = cfg.weight ? ' · ' + fmtNum(cfg.weight) + ' ' + unit : ''
|
||||
// Added weight reads as added: "+10 kg" on a dip belt, "60 kg" on a barbell.
|
||||
const load = cfg.weight ? ' · ' + (isBw(cfg) ? '+' : '') + fmtNum(cfg.weight) + ' ' + unit : ''
|
||||
if (mode === 'cardio') return `${n} × ${cfg.min || 20} min @ ${fmtNum(cfg.speed || 8)} km/h`
|
||||
if (mode === 'time') return `${n} × ${fmtSec(cfg.sec || 45)}${load}`
|
||||
return `${n} × ${cfg.reps}${load}`
|
||||
// This is the line with room for it, so the split is spelled out: "3 × 16 · 8/side".
|
||||
const split = isPerSide(cfg) ? ' · ' + t('{0}/side', fmtNum(sideReps(cfg.reps))) : ''
|
||||
return `${n} × ${cfg.reps}${load}${split}`
|
||||
}
|
||||
|
||||
// Drop superset ids that no longer have an adjacent partner (after unlink/reorder/remove).
|
||||
@@ -166,6 +205,8 @@ export function buildSets(S, cfg) {
|
||||
}
|
||||
export function workoutVolume(w) {
|
||||
let v = 0
|
||||
// No special case for unilateral work: a per-side set logs its total, so both sides are
|
||||
// already in the rep count that arrives here.
|
||||
w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * (s.r || 0) }))
|
||||
return v
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort } from './history.js'
|
||||
import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep } from './history.js'
|
||||
import { EXDB } from './exercises.js'
|
||||
|
||||
// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.
|
||||
const CARDIO = EXDB.find(e => e.bp === 'cardio').id
|
||||
const LIFT = EXDB.find(e => e.bp !== 'cardio').id
|
||||
// A *loaded* lift: the catalogue's first non-cardio entry is a sit-up, which since issue #32
|
||||
// defaults to bodyweight and would quietly send every label test down the other path.
|
||||
const LIFT = EXDB.find(e => e.bp !== 'cardio' && e.eq !== 'body weight').id
|
||||
const BW = EXDB.find(e => e.eq === 'body weight').id
|
||||
|
||||
describe('modeOf', () => {
|
||||
it('falls back to the body part when a plan has no mode — every existing plan keeps working', () => {
|
||||
@@ -255,9 +258,73 @@ describe('defaultConfig', () => {
|
||||
expect(defaultConfig(CARDIO)).toEqual({ sets: 1, min: 20, speed: 8 })
|
||||
expect(defaultConfig(LIFT, 'time')).toEqual({ sets: 3, sec: 45, weight: 0, mode: 'time' })
|
||||
})
|
||||
it('seeds the bodyweight flag from the catalogue, and only when it is true', () => {
|
||||
expect(defaultConfig(BW)).toEqual({ sets: 3, reps: 10, weight: 0, mode: 'reps', bodyweight: true })
|
||||
expect(defaultConfig(BW, 'time')).toEqual({ sets: 3, sec: 45, weight: 0, mode: 'time', bodyweight: true })
|
||||
expect('bodyweight' in defaultConfig(LIFT)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
/* ---------- bodyweight and per side (issues #31/#32/#33) ---------- */
|
||||
|
||||
describe('isBw', () => {
|
||||
it('defaults from the catalogue so an existing plan needs no flag', () => {
|
||||
expect(isBw({ id: BW })).toBe(true)
|
||||
expect(isBw({ id: LIFT })).toBe(false)
|
||||
})
|
||||
it('lets the config win in both directions — a belt on a dip, a flag on a machine', () => {
|
||||
expect(isBw({ id: BW, bodyweight: false })).toBe(false)
|
||||
expect(isBw({ id: LIFT, bodyweight: true })).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('sideReps', () => {
|
||||
it('halves the logged total, because the total is what was logged', () => {
|
||||
expect(sideReps(16)).toBe(8)
|
||||
expect(sideReps(0)).toBe(0)
|
||||
})
|
||||
it('shows an odd total as it falls rather than rounding the imbalance away', () => {
|
||||
expect(sideReps(17)).toBe(8.5)
|
||||
})
|
||||
})
|
||||
|
||||
describe('exLine — per side never reaches a timed hold', () => {
|
||||
it('ignores a stale side flag on a hold, which has no reps to split', () => {
|
||||
expect(exLine({ id: LIFT, sets: 3, sec: 45, mode: 'time', side: true }, 'kg')).toBe('3 × 0:45')
|
||||
})
|
||||
})
|
||||
|
||||
describe('repStep', () => {
|
||||
it('steps unilateral work in twos so the total stays splittable', () => {
|
||||
expect(repStep({ side: true })).toBe(2)
|
||||
expect(repStep({})).toBe(1)
|
||||
expect(repStep(null)).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('setLabel — bodyweight', () => {
|
||||
it('reads as reps alone, because "0×12" describes nothing', () => {
|
||||
expect(setLabel(BW, { w: 0, r: 12 }, { id: BW })).toBe('12')
|
||||
})
|
||||
it('spells out a belt as an addition', () => {
|
||||
expect(setLabel(BW, { w: 10, r: 8 }, { id: BW })).toBe('+10 × 8')
|
||||
})
|
||||
it('logs a per-side set as the plain total, like every other set in the app', () => {
|
||||
expect(setLabel(BW, { w: 0, r: 16 }, { id: BW, side: true })).toBe('16')
|
||||
expect(setLabel(LIFT, { w: 20, r: 16 }, { id: LIFT, side: true })).toBe('20×16')
|
||||
})
|
||||
it('keeps the effort tail', () => {
|
||||
expect(setLabel(BW, { w: 0, r: 12, rir: 2 }, { id: BW })).toBe('12 (RIR 2)')
|
||||
})
|
||||
})
|
||||
|
||||
describe('exLine', () => {
|
||||
it('shows the split where there is room for it, next to the total you log', () => {
|
||||
expect(exLine({ id: LIFT, sets: 3, reps: 16, side: true }, 'kg')).toBe('3 × 16 · 8/side')
|
||||
})
|
||||
it('marks added weight as added', () => {
|
||||
expect(exLine({ id: BW, sets: 3, reps: 8, weight: 10 }, 'kg')).toBe('3 × 8 · +10 kg')
|
||||
})
|
||||
it('summarises a planned exercise per mode', () => {
|
||||
expect(exLine({ id: LIFT, sets: 3, reps: 10 }, 'kg')).toBe('3 × 10')
|
||||
expect(exLine({ id: LIFT, sets: 3, reps: 10, weight: 60 }, 'kg')).toBe('3 × 10 · 60 kg')
|
||||
@@ -318,4 +385,14 @@ describe('workoutVolume', () => {
|
||||
] }
|
||||
expect(workoutVolume(w)).toBe(600)
|
||||
})
|
||||
|
||||
it('needs no per-side case — the logged reps are already both sides (issue #31)', () => {
|
||||
const w = { entries: [{ id: LIFT, target: { side: true }, sets: [{ w: 20, r: 16, done: true }] }] }
|
||||
expect(workoutVolume(w)).toBe(320)
|
||||
})
|
||||
|
||||
it('leaves an unloaded bodyweight set at zero volume rather than inventing a number', () => {
|
||||
const w = { entries: [{ id: BW, target: { bodyweight: true }, sets: [{ w: 0, r: 20, done: true }] }] }
|
||||
expect(workoutVolume(w)).toBe(0)
|
||||
})
|
||||
})
|
||||
@@ -8,8 +8,8 @@
|
||||
// 2. A clean, printable page (Save as PDF) where a single exercise never splits across
|
||||
// a page break — each exercise, and each routine that fits, stays in one place.
|
||||
|
||||
import { EXIDX } from './exercises.js'
|
||||
import { modeOf, fmtSec } from './history.js'
|
||||
import { EXIDX, isBodyweightEq } from './exercises.js'
|
||||
import { modeOf, fmtSec, isBw, isPerSide, sideReps } from './history.js'
|
||||
import { uid, todayISO, DAYN, fmtNum, exCount } from './format.js'
|
||||
import { t } from './i18n.js'
|
||||
|
||||
@@ -33,11 +33,17 @@ function cleanEx(e) {
|
||||
if (e.reps != null) o.reps = e.reps
|
||||
if (e.weight) o.weight = e.weight
|
||||
}
|
||||
// How the exercise is logged travels too (issues #31/#32) — the bodyweight flag only when
|
||||
// it disagrees with the catalogue, since agreeing is what the other end already assumes.
|
||||
if (e.bodyweight != null && e.bodyweight !== isBodyweightEq(e.id)) o.bodyweight = e.bodyweight
|
||||
// Only on reps work — `side` counts reps, and a timed hold has none to split.
|
||||
if (e.side && mode !== 'time' && mode !== 'cardio') o.side = true
|
||||
// Progression settings travel with the plan — a shared Greyskull routine that arrives
|
||||
// without its rule is just a list of weights.
|
||||
if (e.prog) o.prog = e.prog
|
||||
if (e.inc > 0) o.inc = e.inc
|
||||
if (e.repsMin != null) o.repsMin = e.repsMin
|
||||
if (e.repsMax != null) o.repsMax = e.repsMax
|
||||
if (e.sg) o.sg = e.sg
|
||||
return o
|
||||
}
|
||||
@@ -145,7 +151,9 @@ function scheme(e, unit) {
|
||||
return sets > 1 ? `${sets} × ${body}` : body
|
||||
}
|
||||
let s = mode === 'time' ? `${sets} × ${fmtSec(e.sec || 45)}` : `${sets} × ${e.reps ?? 10}`
|
||||
if (e.weight) s += ` · ${fmtNum(e.weight)} ${unit}`
|
||||
if (e.weight) s += ` · ${isBw(e) ? '+' : ''}${fmtNum(e.weight)} ${unit}`
|
||||
// A printed plan is read at the rack, so the split earns its four characters.
|
||||
if (mode !== 'time' && isPerSide(e)) s += ` · ${t('{0}/side', fmtNum(sideReps(e.reps ?? 10)))}`
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// · fewer sets than prescribed → miss
|
||||
// So a session that fell apart can never advance the load as though it had succeeded.
|
||||
|
||||
import { modeOf } from './history.js'
|
||||
import { modeOf, repStep } from './history.js'
|
||||
import { EXIDX } from './exercises.js'
|
||||
|
||||
export const POLICIES = ['off', 'linear', 'greyskull', 'double', 'time']
|
||||
@@ -60,6 +60,9 @@ export function defaultIncrement(exId, unit) {
|
||||
return heavy ? 5 : 2.5
|
||||
}
|
||||
export const DEFAULT_SEC_INCREMENT = 5
|
||||
// Where adding another set of push-ups stops being progress and starts being a way to spend
|
||||
// an evening. Past this the honest advice is load or a harder variation (issue #33).
|
||||
export const MAX_BW_SETS = 6
|
||||
|
||||
// The policy in force for one exercise: its own override, else the routine's default, else
|
||||
// the mode's default. Reps keeps behaving the way the app always did (all reps → add a step).
|
||||
@@ -117,6 +120,7 @@ export function readSession(entry, fallback) {
|
||||
return {
|
||||
mode, goal, reps,
|
||||
weight: Math.max(0, ...sets.filter(s => s.done).map(s => s.w || 0)),
|
||||
count: reps.length, // the dimension bodyweight work grows (#33)
|
||||
low: reps.length ? Math.min(...reps) : 0,
|
||||
amrap: reps.length ? reps[reps.length - 1] : 0, // Greyskull's final set
|
||||
ok: goal > 0 && enough && reps.length > 0 && reps.every(r => r >= goal)
|
||||
@@ -179,14 +183,28 @@ export function nextPrescription(S, cfg, routine) {
|
||||
|
||||
const w = last.weight
|
||||
// Bodyweight work carries no external load, so there is nothing to add or take away —
|
||||
// "deload your push-ups to 2.5 kg" is not advice. Progress in reps instead. This runs
|
||||
// ahead of the individual policies because it is true for all of them; a rep range set on
|
||||
// top of it simply gets passed once you exceed it, which is the right moment to add load
|
||||
// or move to a harder variation anyway.
|
||||
// "deload your push-ups to 2.5 kg" is not advice. Progress in reps instead. This runs ahead
|
||||
// of the individual policies because it is true for all of them. Note the trigger is the
|
||||
// *logged* weight, not the `bw` flag: a dip done with a belt has a load to progress and
|
||||
// belongs on the normal policies, and a barbell lift logged at 0 has nothing to add to.
|
||||
if (w <= 0) {
|
||||
const goal = last.goal || cfg.reps || 0
|
||||
if (last.ok && goal > 0) return { policy, kind: 'up', weight: 0, reps: goal + 1, why: ['Bodyweight — every rep last time, so go for {0} this time.', goal + 1] }
|
||||
return { policy, kind: 'hold', weight: 0, reps: goal || undefined, why: ['Bodyweight — same target again until every set is clean.'] }
|
||||
if (!last.ok || goal <= 0) return { policy, kind: 'hold', weight: 0, reps: goal || undefined, why: ['Bodyweight — same target again until every set is clean.'] }
|
||||
// A ceiling turns "+1 rep forever" into a plan (issue #33). Past the top of the range the
|
||||
// reps go back to the bottom and a set is added instead, which is how bodyweight work
|
||||
// actually progresses once a set of 30 push-ups stops being a strength stimulus.
|
||||
const top = cfg.repsMax > 0 ? cfg.repsMax : 0
|
||||
if (top > 0 && goal >= top) {
|
||||
const sets = Math.max(1, cfg.sets || last.count || 1) + 1
|
||||
const bottom = Math.max(1, Math.min(cfg.reps || top, top))
|
||||
if (sets <= MAX_BW_SETS) return { policy, kind: 'up', weight: 0, reps: bottom, sets, why: ['{0} reps in every set — add a set and go back to {1}.', goal, bottom] }
|
||||
// Out of sets worth adding: more volume is no longer the answer, load or a harder
|
||||
// variation is — and that is a decision for a person, not a policy.
|
||||
return { policy, kind: 'hold', weight: 0, reps: goal, why: ['{0} sets of {1} — time to add weight or move to a harder variation.', sets - 1, goal] }
|
||||
}
|
||||
// Unilateral work steps by two, so the total stays even and both sides get the rep.
|
||||
const next = goal + repStep(cfg)
|
||||
return { policy, kind: 'up', weight: 0, reps: next, why: ['Bodyweight — every rep last time, so go for {0} this time.', next] }
|
||||
}
|
||||
if (policy === 'double') {
|
||||
const top = cfg.reps || last.goal || 10
|
||||
@@ -196,7 +214,7 @@ export function nextPrescription(S, cfg, routine) {
|
||||
const dw = deloadTo(w, inc)
|
||||
return { policy, kind: 'deload', weight: dw, reps: bottom, why: ['Stalled {0} sessions — deload to {1} {2}.', stalls, dw, unit] }
|
||||
}
|
||||
const aim = Math.min(top, Math.max(bottom, last.low + 1))
|
||||
const aim = Math.min(top, Math.max(bottom, last.low + repStep(cfg)))
|
||||
return { policy, kind: 'hold', weight: w, reps: aim, why: ['Same weight — aim for {0} reps this time.', aim] }
|
||||
}
|
||||
|
||||
@@ -231,12 +249,20 @@ export function nextPrescription(S, cfg, routine) {
|
||||
*/
|
||||
export function applyPrescription(sets, p) {
|
||||
if (!p || p.kind === 'off' || p.kind === 'first') return sets
|
||||
return sets.map(s => {
|
||||
const out = sets.map(s => {
|
||||
if (s.done) return s
|
||||
const out = { ...s }
|
||||
if (p.weight != null) out.w = p.weight
|
||||
if (p.reps != null) out.r = p.reps
|
||||
if (p.sec != null) out.sec = p.sec
|
||||
return out
|
||||
const o = { ...s }
|
||||
if (p.weight != null) o.w = p.weight
|
||||
if (p.reps != null) o.r = p.reps
|
||||
if (p.sec != null) o.sec = p.sec
|
||||
return o
|
||||
})
|
||||
// A policy that decided on a set count gets to grow the list — bodyweight progression adds
|
||||
// a set where a barbell would have added a plate. Only ever upwards, and only by copying a
|
||||
// row that is already there: a session in progress must not lose a set it has logged.
|
||||
if (p.sets > out.length) {
|
||||
const seed = out[out.length - 1]
|
||||
while (out.length < p.sets) out.push({ ...seed, done: false })
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import {
|
||||
readSession, sessionsFor, stallCount, nextPrescription, applyPrescription,
|
||||
policyFor, defaultIncrement, POLICIES_FOR, DELOAD_AFTER
|
||||
policyFor, defaultIncrement, POLICIES_FOR, DELOAD_AFTER, MAX_BW_SETS
|
||||
} from './progression.js'
|
||||
import { EXDB } from './exercises.js'
|
||||
|
||||
@@ -189,6 +189,54 @@ describe('bodyweight exercises', () => {
|
||||
expect(p.reps).toBe(11)
|
||||
})
|
||||
|
||||
/* A ceiling turns "+1 rep forever" into a plan — issue #33. */
|
||||
it('climbs to the ceiling one rep at a time', () => {
|
||||
const p = nextPrescription(bw([[0, 10, 10, 10]]), { ...cfg, repsMax: 15 })
|
||||
expect(p.kind).toBe('up')
|
||||
expect(p.reps).toBe(11)
|
||||
expect(p.sets).toBeUndefined()
|
||||
})
|
||||
|
||||
it('adds a set and restarts the range once the ceiling is reached', () => {
|
||||
const at15 = hist(LIFT, [[0, 15, 15, 15]], { sets: 3, reps: 15 })
|
||||
const p = nextPrescription(at15, { ...cfg, reps: 10, repsMax: 15 })
|
||||
expect(p.kind).toBe('up')
|
||||
expect(p.sets).toBe(4)
|
||||
expect(p.reps).toBe(10)
|
||||
expect(p.weight).toBe(0)
|
||||
})
|
||||
|
||||
it('stops adding sets at the cap and says what to do instead', () => {
|
||||
const at15 = hist(LIFT, [[0, 15, 15, 15]], { sets: 3, reps: 15 })
|
||||
const p = nextPrescription(at15, { ...cfg, sets: MAX_BW_SETS, reps: 10, repsMax: 15 })
|
||||
expect(p.kind).toBe('hold')
|
||||
expect(p.sets).toBeUndefined()
|
||||
expect(p.why[0]).toMatch(/harder variation/)
|
||||
})
|
||||
|
||||
it('leaves a belted set to the normal policies — there is a load to add now', () => {
|
||||
const belted = hist(LIFT, [[10, 10, 10, 10]], { sets: 3, reps: 10 })
|
||||
const p = nextPrescription(belted, { ...cfg, bodyweight: true, repsMax: 15 })
|
||||
expect(p.kind).toBe('up')
|
||||
expect(p.weight).toBeGreaterThan(10)
|
||||
expect(p.sets).toBeUndefined()
|
||||
})
|
||||
|
||||
it('steps a unilateral total by two, so it lands on 16, 18, 20 (issue #31)', () => {
|
||||
const at16 = hist(LIFT, [[0, 16, 16, 16]], { sets: 3, reps: 16 })
|
||||
expect(nextPrescription(at16, { ...cfg, reps: 16, side: true }).reps).toBe(18)
|
||||
// and by one when it is not
|
||||
expect(nextPrescription(at16, { ...cfg, reps: 16 }).reps).toBe(17)
|
||||
})
|
||||
|
||||
it('keeps climbing reps forever when no ceiling was set — the old behaviour', () => {
|
||||
const at30 = hist(LIFT, [[0, 30, 30, 30]], { sets: 3, reps: 30 })
|
||||
const p = nextPrescription(at30, cfg)
|
||||
expect(p.kind).toBe('up')
|
||||
expect(p.reps).toBe(31)
|
||||
expect(p.sets).toBeUndefined()
|
||||
})
|
||||
|
||||
it('applies to every policy, not just linear', () => {
|
||||
for (const prog of ['linear', 'greyskull', 'double']) {
|
||||
const p = nextPrescription(bw([[0, 10, 10, 4], [0, 10, 10, 4], [0, 10, 10, 4]]), { ...cfg, prog })
|
||||
@@ -390,4 +438,15 @@ describe('applyPrescription', () => {
|
||||
const timed = [{ sec: 45, w: 0, done: false }]
|
||||
expect(applyPrescription(timed, { kind: 'up', sec: 50 })).toEqual([{ sec: 50, w: 0, done: false }])
|
||||
})
|
||||
|
||||
it('grows the list when the policy added a set (issue #33)', () => {
|
||||
const three = [{ w: 0, r: 10, done: false }, { w: 0, r: 10, done: false }, { w: 0, r: 10, done: false }]
|
||||
const out = applyPrescription(three, { kind: 'up', weight: 0, reps: 10, sets: 4 })
|
||||
expect(out).toHaveLength(4)
|
||||
expect(out[3]).toEqual({ w: 0, r: 10, done: false })
|
||||
})
|
||||
|
||||
it('never shrinks a session that has already logged sets', () => {
|
||||
expect(applyPrescription(sets, { kind: 'up', weight: 60, sets: 1 })).toHaveLength(sets.length)
|
||||
})
|
||||
})
|
||||
@@ -555,4 +555,20 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Die meisten Arbeitssätze gehören nah ans Muskelversagen, ohne dort zu wohnen — die Hälfte ganz unten und die Hälfte ganz oben mittelt sich zu einem gesund aussehenden Mittelwert.',
|
||||
'Average effort per workout': 'Durchschnittliche Anstrengung pro Training',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Ein vollerer Punkt heißt: weniger im Tank — dasselbe Gewicht bei niedrigerem {0} ist Fortschritt, den die Linie allein nicht zeigt.',
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Körpergewicht',
|
||||
'No weight to enter — just log the reps.': 'Kein Gewicht einzutragen — nur die Wiederholungen.',
|
||||
'Ask for a weight on every set.': 'Bei jedem Satz nach dem Gewicht fragen.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Für Dips oder Klimmzüge mit Gürtel. Die Progression folgt dann dem Gewicht.',
|
||||
'Reps per side': 'Wiederholungen pro Seite',
|
||||
'For lunges, single-arm rows and the like.': 'Für Ausfallschritte, einarmiges Rudern und Ähnliches.',
|
||||
'Top of the range': 'Oberes Ende',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Die Wiederholungen steigen um eine, sobald jeder Satz sauber war. Setz ein oberes Ende, damit irgendwann ein Satz dazukommt statt immer mehr Wiederholungen.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Die Wiederholungen steigen bis {0}, dann kommt ein Satz dazu und die Wiederholungen starten neu. Bei {1} Sätzen wird stattdessen nach Zusatzgewicht gefragt.',
|
||||
'Added ({0})': 'Zusatz ({0})',
|
||||
'{0}/side': '{0}/Seite',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '{0} Wiederholungen in jedem Satz — ein Satz kommt dazu, zurück auf {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} Sätze mit {1} — Zeit für Zusatzgewicht oder eine schwerere Variante.',
|
||||
'{0} per side': '{0} pro Seite',
|
||||
'You still log the total: {0} is {1} per side.': 'Du trägst weiterhin die Gesamtzahl ein: {0} sind {1} pro Seite.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'La mayoría de las series efectivas van cerca del fallo sin vivir allí — la mitad abajo y la mitad arriba dan una media que solo parece sana.',
|
||||
'Average effort per workout': 'Esfuerzo medio por entrenamiento',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Un punto más lleno significa menos reserva — el mismo peso con un {0} más bajo es progreso que la línea por sí sola no muestra.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Peso corporal',
|
||||
'No weight to enter — just log the reps.': 'No hay peso que introducir — solo registra las reps.',
|
||||
'Ask for a weight on every set.': 'Pedir un peso en cada serie.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Para fondos o dominadas con cinturón. La progresión sigue entonces el peso.',
|
||||
'Reps per side': 'Reps por lado',
|
||||
'For lunges, single-arm rows and the like.': 'Para zancadas, remo a una mano y similares.',
|
||||
'Top of the range': 'Tope del rango',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Las reps suben de una en una cuando todas las series salen limpias. Fija un tope para añadir series en vez de reps para siempre.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Las reps suben hasta {0}, luego se añade una serie y las reps vuelven a empezar. Con {1} series te pedirá añadir peso.',
|
||||
'Added ({0})': 'Extra ({0})',
|
||||
'{0}/side': '{0}/lado',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '{0} reps en todas las series: añade una serie y vuelve a {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} series de {1}: toca añadir peso o pasar a una variante más difícil.',
|
||||
'{0} per side': '{0} por lado',
|
||||
'You still log the total: {0} is {1} per side.': 'Sigues registrando el total: {0} son {1} por lado.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'La plupart des séries de travail se placent près de l’échec sans y vivre — la moitié tout en bas et la moitié tout en haut donnent une moyenne qui n’a l’air saine que sur le papier.',
|
||||
'Average effort per workout': 'Effort moyen par séance',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Un point plus plein veut dire moins de réserve — le même poids à un {0} plus bas, c’est un progrès que la ligne seule ne montre pas.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Poids du corps',
|
||||
'No weight to enter — just log the reps.': 'Pas de poids à saisir — note simplement les répétitions.',
|
||||
'Ask for a weight on every set.': 'Demander un poids à chaque série.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Pour les dips ou les tractions avec une ceinture. La progression suit alors le poids.',
|
||||
'Reps per side': 'Reps par côté',
|
||||
'For lunges, single-arm rows and the like.': 'Pour les fentes, les rowings à un bras et compagnie.',
|
||||
'Top of the range': 'Haut de la fourchette',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Les répétitions montent d’une dès que toutes les séries sont propres. Fixe un plafond pour ajouter une série au lieu de monter les répétitions sans fin.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Les répétitions montent jusqu’à {0}, puis une série est ajoutée et les répétitions repartent du bas. À {1} séries, c’est du poids qu’il te demande d’ajouter.',
|
||||
'Added ({0})': 'Ajouté ({0})',
|
||||
'{0}/side': '{0}/côté',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '{0} répétitions sur toutes les séries — une série en plus, retour à {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} séries de {1} — il est temps d’ajouter du poids ou de passer à une variante plus dure.',
|
||||
'{0} per side': '{0} par côté',
|
||||
'You still log the total: {0} is {1} per side.': 'Tu notes toujours le total : {0}, c’est {1} par côté.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'ज़्यादातर वर्किंग सेट फेलियर के पास होने चाहिए, पर वहीं बसे नहीं — आधे सबसे नीचे और आधे सबसे ऊपर मिलकर एक ऐसा औसत बनाते हैं जो सिर्फ़ देखने में सेहतमंद लगता है।',
|
||||
'Average effort per workout': 'हर वर्कआउट की औसत मेहनत',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'ज़्यादा भरा बिंदु मतलब टंकी में कम बचा — वही वज़न कम {0} पर उठाना वह प्रगति है जो अकेली लाइन नहीं दिखाती।',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'बॉडीवेट',
|
||||
'No weight to enter — just log the reps.': 'कोई वज़न नहीं डालना — बस रेप्स दर्ज करें।',
|
||||
'Ask for a weight on every set.': 'हर सेट पर वज़न पूछें।',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'बेल्ट के साथ डिप्स या पुल-अप्स के लिए। फिर प्रोग्रेशन वज़न के हिसाब से चलता है।',
|
||||
'Reps per side': 'प्रति तरफ़ रेप्स',
|
||||
'For lunges, single-arm rows and the like.': 'लंजेस, सिंगल-आर्म रो और ऐसे व्यायामों के लिए।',
|
||||
'Top of the range': 'रेंज का ऊपरी सिरा',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'हर सेट साफ़ रहने पर रेप्स एक-एक बढ़ते हैं। ऊपरी सीमा तय करें ताकि रेप्स हमेशा बढ़ने के बजाय एक सेट जुड़ जाए।',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'रेप्स {0} तक बढ़ते हैं, फिर एक सेट जुड़ता है और रेप्स दोबारा शुरू होते हैं। {1} सेट पर यह वज़न बढ़ाने को कहता है।',
|
||||
'Added ({0})': 'अतिरिक्त ({0})',
|
||||
'{0}/side': '{0}/तरफ़',
|
||||
'{0} reps in every set — add a set and go back to {1}.': 'हर सेट में {0} रेप्स — एक सेट जोड़ें और वापस {1} पर।',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{1} रेप्स के {0} सेट — अब वज़न बढ़ाने या किसी कठिन वैरिएशन पर जाने का समय।',
|
||||
'{0} per side': 'प्रति तरफ़ {0}',
|
||||
'You still log the total: {0} is {1} per side.': 'आप कुल ही दर्ज करते हैं: {0} यानी प्रति तरफ़ {1}।',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'La maggior parte delle serie di lavoro sta vicino al cedimento senza viverci — metà in fondo e metà in cima danno una media che sembra sana solo all’apparenza.',
|
||||
'Average effort per workout': 'Sforzo medio per allenamento',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Un punto più pieno significa meno riserva — lo stesso peso con un {0} più basso è progresso che la linea da sola non mostra.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Corpo libero',
|
||||
'No weight to enter — just log the reps.': 'Nessun peso da inserire — registra solo le ripetizioni.',
|
||||
'Ask for a weight on every set.': 'Chiedi un peso a ogni serie.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Per dip o trazioni con la cintura. La progressione segue poi il peso.',
|
||||
'Reps per side': 'Ripetizioni per lato',
|
||||
'For lunges, single-arm rows and the like.': 'Per affondi, rematori a un braccio e simili.',
|
||||
'Top of the range': 'Massimo dell\'intervallo',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Le ripetizioni salgono di una ogni volta che tutte le serie sono pulite. Imposta un massimo per aggiungere serie invece di ripetizioni all\'infinito.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Le ripetizioni salgono fino a {0}, poi viene aggiunta una serie e le ripetizioni ripartono da capo. A {1} serie ti chiede invece di aggiungere peso.',
|
||||
'Added ({0})': 'Aggiunto ({0})',
|
||||
'{0}/side': '{0}/lato',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '{0} ripetizioni in ogni serie — aggiungi una serie e torna a {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} serie da {1} — è ora di aggiungere peso o passare a una variante più difficile.',
|
||||
'{0} per side': '{0} per lato',
|
||||
'You still log the total: {0} is {1} per side.': 'Registri sempre il totale: {0} sono {1} per lato.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': '대부분의 본세트는 실패 지점 가까이에 있어야 하지만 거기 머물면 안 됩니다 — 절반은 바닥에 절반은 꼭대기에 있으면 평균만 건강해 보입니다.',
|
||||
'Average effort per workout': '운동당 평균 강도',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': '점이 진할수록 남은 여력이 적다는 뜻입니다 — 같은 무게를 더 낮은 {0}로 든 것은 선만 봐서는 알 수 없는 발전입니다.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': '맨몸 운동',
|
||||
'No weight to enter — just log the reps.': '입력할 무게 없음 — 횟수만 기록합니다.',
|
||||
'Ask for a weight on every set.': '세트마다 무게를 물어봅니다.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': '벨트를 차고 하는 딥스나 풀업용. 그러면 점진적 증가가 무게를 따라갑니다.',
|
||||
'Reps per side': '한쪽당 횟수',
|
||||
'For lunges, single-arm rows and the like.': '런지, 한팔 로우 같은 운동용.',
|
||||
'Top of the range': '범위 상한',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': '모든 세트가 깔끔하면 횟수가 하나씩 올라갑니다. 상한을 정하면 횟수를 계속 늘리는 대신 세트를 추가합니다.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': '횟수가 {0}회까지 오르면 세트가 하나 추가되고 횟수는 처음부터 다시 시작합니다. {1}세트가 되면 대신 무게를 올리라고 안내합니다.',
|
||||
'Added ({0})': '추가 ({0})',
|
||||
'{0}/side': '한쪽 {0}회',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '모든 세트 {0}회 달성 — 세트를 추가하고 {1}회로 돌아갑니다.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{1}회 {0}세트 — 이제 무게를 올리거나 더 어려운 동작으로 넘어가세요.',
|
||||
'{0} per side': '한쪽당 {0}회',
|
||||
'You still log the total: {0} is {1} per side.': '기록은 그대로 합계로 합니다: {0}회는 한쪽당 {1}회입니다.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Większość serii roboczych należy blisko upadku, ale nie na nim — połowa na dole i połowa na górze uśrednia się do zdrowo wyglądającego środka.',
|
||||
'Average effort per workout': 'Średni wysiłek na trening',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Pełniejsza kropka znaczy mniej zapasu — ten sam ciężar przy niższym {0} to postęp, którego sama linia nie pokazuje.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Masa własna',
|
||||
'No weight to enter — just log the reps.': 'Nie podajesz ciężaru — zapisujesz tylko powtórzenia.',
|
||||
'Ask for a weight on every set.': 'Pytaj o ciężar przy każdej serii.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Do dipów albo podciągania z pasem. Progresja idzie wtedy za ciężarem.',
|
||||
'Reps per side': 'Powtórzenia na stronę',
|
||||
'For lunges, single-arm rows and the like.': 'Do wykroków, wiosłowania jednorącz i podobnych.',
|
||||
'Top of the range': 'Górna granica zakresu',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Powtórzenia rosną o jedno, gdy każda seria jest czysta. Ustaw górną granicę, aby zamiast powtórzeń w nieskończoność dochodziły serie.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Powtórzenia rosną do {0}, potem dochodzi seria, a powtórzenia zaczynają od nowa. Przy {1} seriach aplikacja poprosi zamiast tego o dodanie ciężaru.',
|
||||
'Added ({0})': 'Dodane ({0})',
|
||||
'{0}/side': '{0}/str.',
|
||||
'{0} reps in every set — add a set and go back to {1}.': 'Wszystkie serie po {0} powt. — dodaj serię i wróć do {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} × {1} powt. — czas dodać ciężar albo przejść na trudniejszy wariant.',
|
||||
'{0} per side': '{0} na stronę',
|
||||
'You still log the total: {0} is {1} per side.': 'Nadal zapisujesz łączną liczbę: {0} to {1} na stronę.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'A maioria das séries de trabalho fica perto da falha sem viver lá — metade no fundo e metade no topo dão uma média que só parece saudável.',
|
||||
'Average effort per workout': 'Esforço médio por treino',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Um ponto mais cheio significa menos margem — o mesmo peso com um {0} mais baixo é progresso que a linha sozinha não mostra.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Peso do corpo',
|
||||
'No weight to enter — just log the reps.': 'Sem peso para introduzir — regista só as repetições.',
|
||||
'Ask for a weight on every set.': 'Pedir um peso em cada série.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Para dips ou pull-ups com cinto. A progressão passa então a seguir o peso.',
|
||||
'Reps per side': 'Reps por lado',
|
||||
'For lunges, single-arm rows and the like.': 'Para afundos, remadas a um braço e afins.',
|
||||
'Top of the range': 'Topo do intervalo',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'As repetições sobem uma sempre que todas as séries saem limpas. Define um limite para acrescentar séries em vez de repetições para sempre.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'As repetições sobem até {0}, depois acrescenta-se uma série e as repetições recomeçam. Com {1} séries passa a pedir-te peso extra.',
|
||||
'Added ({0})': 'Extra ({0})',
|
||||
'{0}/side': '{0}/lado',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '{0} repetições em todas as séries — acrescenta uma série e volta a {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} séries de {1} — hora de acrescentar peso ou passar a uma variação mais difícil.',
|
||||
'{0} per side': '{0} por lado',
|
||||
'You still log the total: {0} is {1} per side.': 'Continuas a registar o total: {0} são {1} por lado.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Большинство рабочих подходов должны идти близко к отказу, но не жить на нём — половина внизу и половина вверху дают среднее, которое лишь выглядит здоровым.',
|
||||
'Average effort per workout': 'Среднее усилие за тренировку',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Более плотная точка означает меньше запаса — тот же вес при меньшем {0} это прогресс, которого одна линия не показывает.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Собственный вес',
|
||||
'No weight to enter — just log the reps.': 'Вес вводить не нужно — записывай только повторения.',
|
||||
'Ask for a weight on every set.': 'Спрашивать вес в каждом подходе.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Для отжиманий на брусьях или подтягиваний с поясом. Тогда прогрессия идёт по весу.',
|
||||
'Reps per side': 'Повторения на сторону',
|
||||
'For lunges, single-arm rows and the like.': 'Для выпадов, тяг одной рукой и тому подобного.',
|
||||
'Top of the range': 'Верх диапазона',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Повторения растут на одно, когда все подходы чистые. Задай потолок, чтобы вместо бесконечного роста повторений добавлялся подход.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Повторения растут до {0}, затем добавляется подход и повторения начинаются заново. Дойдя до {1} подходов, приложение предложит вместо этого добавить вес.',
|
||||
'Added ({0})': 'Доп. ({0})',
|
||||
'{0}/side': '{0}/стор.',
|
||||
'{0} reps in every set — add a set and go back to {1}.': 'Во всех подходах {0} повт. — добавь подход и вернись к {1}.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} × {1} — пора добавить вес или перейти к более сложному варианту.',
|
||||
'{0} per side': '{0} на сторону',
|
||||
'You still log the total: {0} is {1} per side.': 'Ты по-прежнему записываешь общее число: {0} — это {1} на сторону.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Çalışma setlerinin çoğu tükenmeye yakın olmalı ama orada yaşamamalı — yarısı en altta yarısı en üstte, ortalaması sağlıklı görünür.',
|
||||
'Average effort per workout': 'Antrenman başına ortalama zorluk',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Daha dolu bir nokta depoda daha az kaldı demek — aynı ağırlığı daha düşük {0} ile kaldırmak, çizginin tek başına göstermediği bir ilerlemedir.',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': 'Vücut ağırlığı',
|
||||
'No weight to enter — just log the reps.': 'Girilecek ağırlık yok — sadece tekrarları kaydet.',
|
||||
'Ask for a weight on every set.': 'Her sette ağırlık sorulsun.',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': 'Kemerle yapılan dips veya barfiks için. İlerleme o zaman ağırlığı izler.',
|
||||
'Reps per side': 'Taraf başına tekrar',
|
||||
'For lunges, single-arm rows and the like.': 'Lunge, tek kol çekiş ve benzeri hareketler için.',
|
||||
'Top of the range': 'Aralığın üst sınırı',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Her set temiz çıktığında tekrarlar birer artar. Sonsuza kadar tekrar eklemek yerine set eklemek için bir üst sınır belirle.',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Tekrarlar {0} değerine çıkar, sonra bir set eklenir ve tekrarlar baştan başlar. {1} sette ise bunun yerine ağırlık eklemen istenir.',
|
||||
'Added ({0})': 'Ek ({0})',
|
||||
'{0}/side': '{0}/taraf',
|
||||
'{0} reps in every set — add a set and go back to {1}.': 'Her sette {0} tekrar — bir set ekle ve {1} tekrara dön.',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{1} tekrarlık {0} set — ağırlık ekleme ya da daha zor bir varyasyona geçme zamanı.',
|
||||
'{0} per side': 'Taraf başına {0}',
|
||||
'You still log the total: {0} is {1} per side.': 'Toplamı kaydetmeye devam ediyorsun: {0}, taraf başına {1} demek.',
|
||||
}
|
||||
@@ -537,4 +537,21 @@ export default {
|
||||
'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': '大多数正式组应该接近力竭,但不要一直待在那里——一半在最底、一半在最顶,平均下来只是看着健康。',
|
||||
'Average effort per workout': '每次训练的平均强度',
|
||||
'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': '点越实,油箱里剩得越少——同样的重量配上更低的 {0},是曲线本身看不出的进步。',
|
||||
|
||||
// --- bodyweight & per side ---
|
||||
'Bodyweight': '徒手动作',
|
||||
'No weight to enter — just log the reps.': '无需输入重量——只记录次数。',
|
||||
'Ask for a weight on every set.': '每组都询问重量。',
|
||||
'For dips or pull-ups with a belt. Progression then follows the weight.': '用于系负重腰带做双杠臂屈伸或引体向上。此时进阶方式跟随重量。',
|
||||
'Reps per side': '每侧次数',
|
||||
'For lunges, single-arm rows and the like.': '用于弓步蹲、单臂划船之类的动作。',
|
||||
'Top of the range': '次数上限',
|
||||
'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': '每组都做干净,次数就加一。设置上限后,达到上限会加一组,而不是一直加次数。',
|
||||
'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': '次数升到 {0} 后加一组,次数重新开始。到 {1} 组时会改为提示你加重量。',
|
||||
'Added ({0})': '负重({0})',
|
||||
'{0}/side': '{0}/侧',
|
||||
'{0} reps in every set — add a set and go back to {1}.': '每组都做到 {0} 次——加一组,次数回到 {1}。',
|
||||
'{0} sets of {1} — time to add weight or move to a harder variation.': '{0} 组 × {1} 次——该加重量或换更难的变式了。',
|
||||
'{0} per side': '每侧 {0} 次',
|
||||
'You still log the total: {0} is {1} per side.': '你记录的仍然是总数:{0} 表示每侧 {1} 次。',
|
||||
}
|
||||
+62
-10
@@ -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, sideReps } 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,24 @@ 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.
|
||||
// `bodyweight` is true of a hold as much as of a set of reps; `side` is not — it counts
|
||||
// reps, and a timed hold has none. Switching an exercise to Time therefore drops it
|
||||
// rather than carrying a flag nothing downstream can read.
|
||||
const flags = {}
|
||||
if (bw !== isBodyweightEq(ex.id)) flags.bodyweight = bw
|
||||
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 }
|
||||
// A unilateral target is stored even: the split has to divide, and a typed 15 would
|
||||
// otherwise plan seven reps on one side and eight on the other, every session.
|
||||
const typed = Math.max(1, Math.round(c.reps) || 10)
|
||||
const reps = perSide ? Math.ceil(typed / 2) * 2 : typed
|
||||
const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...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)
|
||||
}
|
||||
}
|
||||
@@ -531,13 +546,50 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
|
||||
<Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />
|
||||
</> : <>
|
||||
<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 }))} />
|
||||
<Stepper label={t('Reps')} value={c.reps} step={perSide ? 2 : 1} decimal={false} onChange={v => setC(x => ({ ...x, reps: 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>
|
||||
{mode === 'reps' && <Row icon="shuffle" iconTint="var(--blue)" title={t('Reps per side')}
|
||||
subtitle={perSide ? t('You still log the total: {0} is {1} per side.', c.reps || 0, fmtNum(sideReps(c.reps))) : t('For lunges, single-arm rows and the like.')}>
|
||||
{/* Turning it on rounds the target up to an even number, since half of an odd
|
||||
total is a rep one side does not get. */}
|
||||
<Switch checked={perSide} onChange={v => setC(x => ({ ...x, side: v || undefined, reps: v ? Math.ceil((x.reps || 0) / 2) * 2 : x.reps }))} />
|
||||
</Row>}
|
||||
</div>}
|
||||
{/* A stepper is too wide to sit in a list row next to a label — it squeezes the text to
|
||||
one word per line — so added weight gets the same full-width treatment as sets and
|
||||
reps, with its explanation underneath. */}
|
||||
{bw && <>
|
||||
<div className="row cfgrow" style={{ marginBottom: 8 }}>
|
||||
<Stepper label={t('Added ({0})', st.unit)} value={c.weight || 0} step={2.5}
|
||||
onChange={v => setC(x => ({ ...x, weight: v }))} />
|
||||
</div>
|
||||
<div className="small dim" style={{ marginBottom: 18 }}>
|
||||
{t('For dips or pull-ups with a belt. Progression then follows the weight.')}
|
||||
</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></>}
|
||||
|
||||
@@ -4,7 +4,7 @@ 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 { api, webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
|
||||
import { pushSupported, enablePush, disablePush, sendTestPush } from '../lib/push.js'
|
||||
import { wakeLockSupported } from '../lib/wakelock.js'
|
||||
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
|
||||
@@ -327,13 +327,20 @@ function PushCard({ S, update, toast }) {
|
||||
</>
|
||||
}
|
||||
|
||||
// The same registration as the sign-in screen's, reached from Settings instead. It asks for
|
||||
// the invite code on the same terms: an invite-only instance rejects a registration without
|
||||
// one, so a form that cannot collect it is a form that cannot succeed.
|
||||
function RegisterInline({ close, setUser, pushState, pullState, toast }) {
|
||||
const nameRef = useRef(null)
|
||||
const [code, setCode] = useState('')
|
||||
const [inviteOnly, setInviteOnly] = useState(false)
|
||||
useEffect(() => { api('/api/config').then(c => setInviteOnly(!!c.invite_only)).catch(() => {}) }, [])
|
||||
const go = async () => {
|
||||
const n = (nameRef.current.value || '').trim()
|
||||
if (!n) { toast(t('Enter a name')); return }
|
||||
if (inviteOnly && !code.trim()) { toast(t('An invite code is required')); return }
|
||||
try {
|
||||
const u = await passkeyRegister(n); setUser(u); close()
|
||||
const u = await passkeyRegister(n, code.trim()); setUser(u); close()
|
||||
if (hasData(useStore.getState().S)) { await pushState(); toast(t('Profile created — data moved into it')) }
|
||||
else { await pullState(); toast(t('Welcome, {0}', u.name)) }
|
||||
} catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') toast(e.message || t('Registration failed')) }
|
||||
@@ -342,6 +349,12 @@ function RegisterInline({ close, setUser, pushState, pullState, toast }) {
|
||||
<h3>{t('Create your profile')}</h3>
|
||||
<div className="muted small" style={{ marginBottom: 14 }}>{t('Pick a name, then confirm with your device.')}</div>
|
||||
<TextField ref={nameRef} placeholder={t('Your name')} maxLength={40} />
|
||||
{inviteOnly && <>
|
||||
<div style={{ height: 10 }} />
|
||||
<input className="input" placeholder={t('Invite code')} maxLength={40} value={code}
|
||||
onChange={e => setCode(e.target.value.toUpperCase())} style={{ letterSpacing: '.14em', fontWeight: 600, textAlign: 'center' }} />
|
||||
<div className="dim small" style={{ marginTop: 6 }}>{t('This app is invite-only — enter the code you were given.')}</div>
|
||||
</>}
|
||||
<div style={{ height: 12 }} /><Button variant="primary" onClick={go}>{t('Create passkey')}</Button>
|
||||
</>
|
||||
}
|
||||
@@ -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, EFFORT, effortOf, stepEffort, capEffort } from '../lib/history.js'
|
||||
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort } 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'
|
||||
@@ -69,12 +69,22 @@ 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
|
||||
// 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.
|
||||
const cfg = { ...(entry.target || {}), id: entry.id }
|
||||
const bw = !cardio && isBw(cfg)
|
||||
const added = bw && entry.sets.some(s => s.w > 0)
|
||||
const loadCol = { f: 'w', step: 2.5, dec: true, hd: bw ? t('Added ({0})', S.unit) : t('Weight ({0})', S.unit) }
|
||||
// The reps column is the total in every mode, unilateral included — the stepper walks in
|
||||
// twos there so the number you land on is one you can actually split evenly.
|
||||
const repCol = { f: 'r', step: repStep(cfg), dec: false, hd: t('Reps') }
|
||||
const col1 = cardio ? { f: 'min', step: 1, dec: false, hd: t('Duration (min)') }
|
||||
: timed ? { f: 'sec', step: 5, dec: false, hd: t('Seconds') }
|
||||
: { f: 'w', step: 2.5, dec: true, hd: t('Weight ({0})', S.unit) }
|
||||
: (bw && !added) ? repCol : loadCol
|
||||
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') }
|
||||
: timed ? ((bw && !added) ? null : loadCol)
|
||||
: (bw && !added) ? null : repCol
|
||||
// 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.
|
||||
@@ -106,6 +116,9 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
</div>
|
||||
<div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>
|
||||
{cardio && <span className="tag acc"><Icon name="figureRun" />{t('Cardio')}</span>}
|
||||
{/* You log the total; this is the split, so the set in front of you is unambiguous
|
||||
without the rep count having to mean two different things (issue #31). */}
|
||||
{!cardio && !timed && isPerSide(cfg) && <span className="tag acc nocap"><Icon name="shuffle" />{t('{0} per side', fmtNum(sideReps(entry.sets.find(s => !s.done)?.r ?? entry.sets[0]?.r)))}</span>}
|
||||
{(ex.tg || ex.bp) && <span className="tag">{t(ex.tg || ex.bp)}</span>}
|
||||
{ex.eq && <span className="tag">{t(ex.eq)}</span>}
|
||||
{best > 0 && <span className="tag nocap">{t('Best:')} {fmtNum(best)} {S.unit}</span>}
|
||||
@@ -117,11 +130,11 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
</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 */}
|
||||
<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>
|
||||
<div className={'sethead' + (col3 ? ' eff3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span>{col2 && <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')}
|
||||
{col2 && cell(s, i, col2, 'r')}
|
||||
{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. */}
|
||||
@@ -196,9 +209,11 @@ function ActiveWorkout() {
|
||||
if (isLastExInUnit && !unitDone) startRest(S.restSec)
|
||||
else if (unitDone) stopRest()
|
||||
if (unitDone && isLastUnit) workoutDone = true // last exercise's last set → done
|
||||
// Only reps training has a "working weight" worth confirming — a bodyweight plank
|
||||
// has nothing to put in that slider.
|
||||
if (e.sets.every(x => x.done)) { exJustDone = true; if (m === 'reps' && !e.asked) { e.asked = true; askTop = true } }
|
||||
// Only loaded reps training has a "working weight" worth confirming — a bodyweight
|
||||
// plank has nothing to put in that slider, and neither does a set of push-ups
|
||||
// (issue #32: the fewest taps that still record what happened).
|
||||
const loaded = m === 'reps' && !(isBw({ ...(e.target || {}), id: e.id }) && !e.sets.some(x => x.w > 0))
|
||||
if (e.sets.every(x => x.done)) { exJustDone = true; if (loaded && !e.asked) { e.asked = true; askTop = true } }
|
||||
}
|
||||
})
|
||||
// reps: topWeight first (it chains into the finish/continue prompt on the last unit).
|
||||
|
||||
Reference in new issue
Block a user