Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Merge #194: Workout: plate loading per set row — the plates for each row's weight, from the plates you own (No bar for Smith machines, #138) (kurktchiev)

Duarte Santoscb9ea3aee0a6
diff --cc frontend/src/index.css
index 143f0048e,ed9097495..0e464b55a
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@@ -1028,8 -966,14 +1028,14 @@@ body.chips-dragging *{cursor:inherit
/* label 46, two minis at their floors 70 + 60, the ✕ and three gaps: 252 px with the indent — the
whole row at 320 px. The label starts under the number circle's inner edge there instead. */
@media (max-width:359px){
- .subrow{padding-left:24px}
+ .subrow{padding-inline-start:24px}
}
+ /* Plate line under a set row (Workout.jsx loadLine): the stack for this row's weight, what is
+ missing from the inventory, and what to strip/add from the row above. */
+ .plateline{display:flex;align-items:center;gap:6px;padding:0 0 5px 32px;font-size:12px;color:var(--dim);line-height:1.3}
+ .plateline .icn{font-size:12px;flex:none;opacity:.8}
+ .plateline .short{color:var(--orange)}
+ .plateline .moves{margin-left:auto;color:var(--label-3);font-variant-numeric:tabular-nums;white-space:nowrap}
/* The number is the set's menu (drop / burst / remove); a 24px circle needs a finger-sized hit area. */
.setrow .n::before{content:'';position:absolute;inset:-10px}
/* No +/- buttons: the number field takes the whole cell and is the tap target. */
diff --cc frontend/src/lib/pt-br-locale.test.js
index 8aafbe551,8586c60c0..d074b905f
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@@ -27,21 -27,11 +27,21 @@@ describe('Brazilian Portuguese locale'
.sort(byCodeUnit)
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
- expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(655)
- expect(inherited).toHaveLength(666)
- // If this fails, review the changed keys and wording before accepting a new hash. From
+ // Every override names a real source string, so the two sets partition pt-PT's keys between
+ // them and the fingerprint below covers everything not overridden. A typo'd override key
+ // would otherwise sit in the file translating nothing.
+ const stray = Object.keys(PT_BR_OVERRIDES).filter(key => !(key in pt))
+ expect(stray, 'override keys that are not pt-PT keys').toEqual([])
+ expect(Object.keys(PT_BR_OVERRIDES).length + inherited.length).toBe(Object.keys(pt).length)
+ // …and each one really reaches the pack, whatever the spread order does.
+ for (const [key, value] of Object.entries(PT_BR_OVERRIDES)) expect(ptBR[key], key).toBe(value)
+
+ // The counts themselves are read off the pack rather than pinned here: a new UI string lands
+ // in pt.js and pt-BR.js together and moves both, and a number in a test that every new string
+ // has to be taught is a number nobody reads. What the numbers stood for is asserted above.
+ // If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('f0c4ce10b8f883ab04b9bfb37590a4fd4efd27732fa15ade1cb4619fe01ac3c9')
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('d3fca1eae172e131af7e6c9e698de4ed165e5253a28e1b42f423c3ac2d27e263')
++ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('8a78402841d4c137840dadd3a1dd5a2bc6af4de533d4586cb84566f83b14243a')
})
test('does not leak European Portuguese UI terms', () => {
diff --cc frontend/src/lib/sync-merge.js
index afcb5f03d,cf475e6a1..5727a5e11
--- a/frontend/src/lib/sync-merge.js
+++ b/frontend/src/lib/sync-merge.js
@@@ -20,12 -14,7 +20,12 @@@
* - favEx: ordered set union, the newer copy first
* - exWeights: union by exercise, the better `w` for that exercise — larger for an ordinary
* lift, smaller on an assistance machine (a PR logged on the other device must not be
- * forgotten, whichever way it runs); exNotes, barWeights, loadKind, plates: key union
+ * forgotten, whichever way it runs). An exercise in a workout whose edited version was kept
+ * is the exception: the edit may have taken away the set the kept weight came from, so it
+ * is the best of the merged history and of the editing copy's own, and the other copy's
- * can no longer bring a corrected typo back. exNotes, barWeights: key union
++ * can no longer bring a corrected typo back. exNotes, barWeights, loadKind, plates: key union
+ * - balanceOverrides: key union; of a key both have, the entry set last by its own `_ts`, a
+ * clear included (mergeStampedMap), the newer copy's on a tie
* - `_ts`: the later of the two; `_rev` dropped (the server sets it); `active` left to the caller
*
* Known limit: with no record of what each side deleted, an entry removed on one device inside
@@@ -183,15 -91,9 +183,15 @@@ export function mergeStates(a, b, { pre
out.bodyweight = mergeBodyweight(n.bodyweight, o.bodyweight).map(clone)
if (list(n.favEx).length || list(o.favEx).length) out.favEx = [...new Set([...list(n.favEx), ...list(o.favEx)])]
out.exWeights = clone(mergeExWeights(n.exWeights, o.exWeights))
+ for (const [id, sources] of editedBy) {
+ const kept = correctedExWeight(id, out.workouts, sources)
+ if (kept) out.exWeights[id] = clone(kept)
+ else delete out.exWeights[id]
+ }
- for (const f of ['exNotes', 'barWeights']) {
+ for (const f of ['exNotes', 'barWeights', 'loadKind', 'plates']) {
if (n[f] || o[f]) out[f] = clone({ ...(o[f] || {}), ...(n[f] || {}) })
}
+ if (n.balanceOverrides || o.balanceOverrides) out.balanceOverrides = clone(mergeStampedMap(n.balanceOverrides, o.balanceOverrides, prefer))
out._ts = Math.max(a._ts || 0, b._ts || 0)
delete out._rev
return out
diff --cc frontend/src/lib/units.test.js
index fdb9be1cd,c54985c74..6fb9c808c
--- a/frontend/src/lib/units.test.js
+++ b/frontend/src/lib/units.test.js
@@@ -24,9 -24,9 +24,9 @@@ describe('convertWeight', () =>
describe('convertStateUnit', () => {
const S = {
unit: 'kg', targetW: 80, bodyweight: [{ d: '2026-01-01', w: 82.4, t: 1 }],
- exWeights: { '0025': { w: 80, d: '2026-01-01' }, legacy: 100 }, barWeights: { '0025': 20 },
+ exWeights: { '0025': { w: 80, d: '2026-01-01' }, legacy: 100 }, barWeights: { '0025': 15 },
routines: [{ id: 'r', ex: [{ id: '0025', sets: 3, reps: 5, weight: 80, inc: 2.5, warmup: [{ weight: 40, reps: 8 }] }, { id: 'plank', mode: 'time', sec: 30, inc: 5 }] }],
- workouts: [{ id: 'w', entries: [{ id: '0025', topW: 80, target: { weight: 80 }, sets: [{ w: 80, r: 5, done: true, drops: [{ w: 60, r: 5 }] }] }] }],
+ workouts: [{ id: 'w', entries: [{ id: '0025', topW: 80, target: { weight: 80 }, planned: { sets: 3, reps: 5, weight: 80 }, sets: [{ w: 80, r: 5, done: true, drops: [{ w: 60, r: 5 }] }] }] }],
active: { id: 'a', entries: [{ id: '0025', sets: [{ w: 82.5, r: 5, done: false }] }] },
workoutView: 'list',
}
@@@ -37,10 -37,10 +37,10 @@@
expect(out.bodyweight[0]).toEqual({ d: '2026-01-01', w: 181.7, t: 1 })
expect(out.exWeights['0025'].w).toBe(176.5)
expect(out.exWeights.legacy).toBe(220.5)
- expect(out.barWeights['0025']).toBe(44)
+ expect(out.barWeights['0025']).toBe(33) // a custom 15 kg bar is the 33 lb bar
expect(out.routines[0].ex[0]).toMatchObject({ weight: 176.5, inc: 5.5, warmup: [{ weight: 88, reps: 8 }] })
expect(out.routines[0].ex[1]).toEqual({ id: 'plank', mode: 'time', sec: 30, inc: 5 }) // seconds stay seconds
- expect(out.workouts[0].entries[0]).toMatchObject({ topW: 176.5, target: { weight: 176.5 } })
+ expect(out.workouts[0].entries[0]).toMatchObject({ topW: 176.5, target: { weight: 176.5 }, planned: { sets: 3, reps: 5, weight: 176.5 } })
expect(out.workouts[0].entries[0].sets[0]).toMatchObject({ w: 176.5, done: true, drops: [{ w: 132.5, r: 5 }] })
expect(out.active.entries[0].sets[0].w).toBe(182)
expect(out.workoutView).toBe('list')
diff --cc frontend/src/sheets.jsx
index c1aea72b4,990c3e2c3..9f78feadc
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@@ -3,12 -3,13 +3,13 @@@ import { useStore } from './store/useSt
import { useUI } from './store/useUI.js'
import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf, searchExercises, exOr, isAssisted, betterWeight, beatsWeight } from './lib/exercises.js'
import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'
- import { fmtDate, fmtNum, capWords, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, routineCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'
+ import { fmtDate, fmtNum, fmtPlate, capWords, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, routineCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'
-import { lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, effectiveRoutineIds, workoutVolume, setsDone, setsDoneActive, setUnitsTotal, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, stepEffort, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
+import { lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, effectiveRoutineIds, workoutDay, workoutVolume, setsDone, setsDoneActive, setUnitsTotal, lastBW, supersetUnits, sessionSections, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, stepEffort, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
- import { usesBar, barWeightFor, defaultBarWeight, hasBarOverride, isNoBar } from './lib/bar.js'
+ import { usesBar, defaultBarWeight, hasBarOverride, isNoBar } from './lib/bar.js'
+ import { PLATE_SIZES, inventoryFor, pairsOf, loadKindFor, baseWeightFor } from './lib/plates.js'
import { toScale, rirOf, EFFORT_PRESETS, effortColor } from './lib/effort.js'
import { beep, vibrate } from './lib/sound.js'
-import { t, dateLocale, instrFor, exerciseNameFor, getLang, INSTR_LANGS } from './lib/i18n.js'
+import { t, dateLocale, instrFor, exerciseNameFor, exerciseNameClass, getLang, INSTR_LANGS } from './lib/i18n.js'
import { nav } from './lib/nav.js'
import { buildStarterPlan, starterPlanDays, starterPlanOptions } from './lib/starter.js'
import Media, { Thumb } from './components/Media.jsx'
@@@ -681,13 -641,46 +708,46 @@@ function BarWeightEditor({ ex, cfg, ext
</>
}
- // Tiny mid-workout sheet behind the "Bar … · … per side" chip — same value, same editor.
- function BarWeightSheet({ exId, close }) {
+ // Mid-workout sheet behind the ⋯ menu's "Plate loading" — same values, same editor.
+ function BarWeightSheet({ exId, cfg, close }) {
const ex = exOr(exId)
return <>
- <h3>{t('Bar weight')}</h3>
+ <h3>{t('Plate loading')}</h3>
- <div className="muted small capitalize" style={{ marginBottom: 12 }}>{exerciseNameFor(ex)}</div>
+ <div className={`muted small ${exerciseNameClass(ex)}`} style={{ marginBottom: 12 }}>{exerciseNameFor(ex)}</div>
- <BarWeightEditor ex={ex} extra={t('Applies to this exercise everywhere, not just this plan.')} />
+ <BarWeightEditor ex={ex} cfg={cfg} extra={t('Applies to this exercise everywhere, not just this plan.')} />
+ <Button variant="primary" onClick={close}>{t('Done')}</Button>
+ </>
+ }
+ export const barWeightSheet = (exId, cfg) => ui().openSheet(close => <BarWeightSheet exId={exId} cfg={cfg} close={close} />)
+
+ // The plates you own, as pairs per size, for the profile's unit (Settings → Equipment → Plates).
+ // The first edit copies the standard set into S.plates[unit] and changes one count in it, so the
+ // list you see is always the list the set rows load from. "Back to the standard set" drops the
+ // unit's entry again.
+ function PlateInventorySheet({ close }) {
+ const st = useStore(s => s.S)
+ const unit = st.unit === 'lb' ? 'lb' : 'kg'
+ const own = !!st.plates?.[unit]
+ const setPairs = (w, n) => update(s => {
+ s.plates = s.plates || {}
+ if (!s.plates[unit]) s.plates[unit] = Object.fromEntries(inventoryFor(s).map(p => [p.w, p.n]))
+ s.plates[unit][w] = Math.max(0, Math.round(n || 0))
+ })
+ const reset = () => update(s => { if (s.plates) delete s.plates[unit] })
+ return <>
+ <h3>{t('Plates')}</h3>
+ <div className="muted small" style={{ marginBottom: 14 }}>
+ {t('Pairs of each size you own. Every set row loads from this list, so a home gym with one pair of 45s is never told to use two.')}
+ </div>
+ {PLATE_SIZES[unit].map(w => (
+ <div className="row cfgrow" key={w} style={{ marginBottom: 6 }}>
+ <Stepper label={fmtPlate(w) + ' ' + unit} value={pairsOf(st, w)} step={1} decimal={false} unit={t('pairs')} onChange={n => setPairs(w, n)} />
+ </div>
+ ))}
+ <div className="small dim" style={{ margin: '4px 0 14px' }}>
+ {own ? t('Your own list for {0}.', unit) : t('The standard set, plenty of each — change any count to make it yours.')}
+ </div>
+ {own && <Button onClick={reset} style={{ marginBottom: 8 }}>{t('Back to the standard set')}</Button>}
<Button variant="primary" onClick={close}>{t('Done')}</Button>
</>
}
diff --cc frontend/src/views/Settings.jsx
index 5617a816e,6dc4dd733..adb374932
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@@ -3,24 -3,22 +3,25 @@@ import { useNavigate } from 'react-rout
import { useStore, DEF, hasData } from '../store/useStore.js'
import { workoutControls } from '../lib/workout-controls.js'
import { convertStateUnit } from '../lib/units.js'
+import { speedUnitOf } from '../lib/speed.js'
+import { copyText } from '../lib/clipboard.js'
import { useUI } from '../store/useUI.js'
- import { ACCENTS, todayISO, localTZ, weekStartOf, MONDAY, SUNDAY } from '../lib/format.js'
+ import { ACCENTS, todayISO, localTZ, weekStartOf, MONDAY, SUNDAY, fmtPlate } from '../lib/format.js'
+ import { inventoryFor } from '../lib/plates.js'
import { effortOf } from '../lib/history.js'
-import { unlock, playOnSilentSupported } from '../lib/sound.js'
-import { api, webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
+import { unlock, playOnSilentSupported, vibrateSupported } from '../lib/sound.js'
+import { api, webauthnOK, passkeyRegister, IS_ANDROID } from '../lib/api.js'
import { pushSupported, enablePush, disablePush, sendTestPush, syncPushSubscription } from '../lib/push.js'
import { wakeLockSupported } from '../lib/wakelock.js'
-import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
+import { t, LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, baseLang } from '../lib/i18n.js'
import { DEMO, REPO } from '../lib/demo.js'
import { MOBILE, isAndroid, shareExport, syncReminder } from '../lib/mobile.js'
import { checkForUpdate, downloadAndInstall } from '../lib/update.js'
import { forgetCoach } from '../lib/coach-api.js'
- import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, menuSheet } from '../sheets.jsx'
-import { ConnectSheet } from './MobileOnboarding.jsx'
-import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, menuSheet, askAddDeviceData } from '../sheets.jsx'
++import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, menuSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
+import { ServerSyncSection, KeptChangesRows, leaveServer, connectServer, passkeySignIn } from '../components/ServerSync.jsx'
+import { passwordOn, PasswordRow, openPasswordSignIn, openPasswordRegister } from '../components/PasswordAuth.jsx'
import { Section, Row, SelectRow, Switch, Segmented, Button, TextField } from '../components/ui.jsx'
export default function Settings() {
diff --cc frontend/src/views/Workout.jsx
index e7b95d000,0e05c6fb5..12d91ee76
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@@ -1,16 -1,15 +1,17 @@@
- import { useEffect, useRef, useState } from 'react'
+ import { Fragment, useEffect, useRef, useState } from 'react'
+import SwipeCards from '../components/SwipeCards.jsx'
import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { workoutControls } from '../lib/workout-controls.js'
import { useUI } from '../store/useUI.js'
import { exOr, betterWeight } from '../lib/exercises.js'
- import { usesBar, barWeightFor, plateSplit } from '../lib/bar.js'
+ import { usesBar } from '../lib/bar.js'
+ import { loadKindFor, baseWeightFor, inventoryFor, rowLoad, sameLoad, plateDelta } from '../lib/plates.js'
-import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from '../lib/history.js'
+import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor, setsRepsOf } from '../lib/history.js'
- import { fmtNum, capWords, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
+ import { fmtNum, fmtPlate, capWords, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
+import { speedUnitOf, toSpeed, fromSpeed } from '../lib/speed.js'
import { beep, vibrate, unlock } from '../lib/sound.js'
-import { t, exerciseNameFor } from '../lib/i18n.js'
+import { t, exerciseNameFor, exerciseNameClass } from '../lib/i18n.js'
import { api, appBase } from '../lib/api.js'
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
@@@ -272,31 -200,68 +273,72 @@@ function ExerciseBlock({ entryIdx, comp
{wc.steppers && <button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>}
</div>
)
- // Everything about this exercise that is not a set you are logging right now lives behind one
- // button. What used to be a row of buttons in the header, a chip under the bar, a strip of
- // three under the sets and four more below the card is a single list you open once a session.
+ // Plate loading, per set row (lib/plates.js): which plates make THIS row's weight, from the
+ // plates you own. 'pairs' splits what is beyond the bar per side, 'single' is one stack (a
+ // belt, a sled), 'none' shows nothing. A unilateral row logs each side's own weight; a bar is
+ // the same bar for both legs, so the line uses the sides' weight while they agree (or only one
- // side has a number yet) and stays away once they differ. Only reps mode has a weight to load.
++ // side has a number yet) and stays away once they differ. Only reps mode has a weight to load,
++ // and a saved workout being corrected (#203) has nothing left to load, so its rows stay bare.
+ // The rows and their drop-set sub-rows form one sequence in the order the bar sees them, keyed
+ // `i` for a set and `i:dN` for its N-th drop; a rest-pause burst keeps the set's weight, so it
+ // is not in the sequence.
- const loadKind = mode === 'reps' ? loadKindFor(S, cfg) : 'none'
++ const plateLoading = mode === 'reps' && !editing
++ const loadKind = plateLoading ? loadKindFor(S, cfg) : 'none'
+ const base = baseWeightFor(S, entry.id)
+ const loadSeq = loadKind === 'none' ? [] : (() => {
+ const inv = inventoryFor(S)
+ const out = []
+ entry.sets.forEach((s, i) => {
+ let w = s.w
+ if (perSide && isSideSet(s)) {
+ const L = s.sides.L?.w || 0, R = s.sides.R?.w || 0
+ if (L && R && L !== R) return
+ w = L || R
+ }
+ out.push({ key: String(i), load: rowLoad(loadKind, w, base, inv) })
+ dropsOf(s).forEach((d, di) => out.push({ key: i + ':d' + di, load: rowLoad(loadKind, d.w, base, inv) }))
+ })
+ return out
+ })()
+ const loadSummary = loadKind === 'none' ? t('Off')
+ : loadKind === 'single' ? t('Single stack')
+ : base > 0 ? t('Bar {0}', fmtNum(base) + ' ' + S.unit) : usesBar(ex) ? t('No bar') : t('Per side')
+ // The line under a set row (or a drop sub-row): shown on the first loaded row and whenever the
+ // stack changes from the loaded row before it, so a run of equal weights shows its plates once.
+ // What to strip and what to add rides along, except in the compact view.
+ const loadLine = key => {
+ const at = loadSeq.findIndex(x => x.key === key)
+ const L = at >= 0 ? loadSeq[at].load : null
+ if (!L) return null
+ let p = at - 1
+ while (p >= 0 && !loadSeq[p].load) p--
+ const prev = p >= 0 ? loadSeq[p].load : null
+ if (prev && sameLoad(prev, L)) return null
+ // "+" between plates: "45 + 5 per side" reads as a sum, a dot did not (Boris, 2026-09-13).
+ const stack = L.plates.map(w => fmtPlate(w)).join(' + ')
+ const text = L.barOnly ? t('Bar only')
+ : L.kind === 'pairs' ? t('{0} per side', stack || '—') : t('Load {0}', stack || '—')
+ const d = prev && !dense ? plateDelta(prev.plates, L.plates) : null
+ const moves = d ? [...d.strip.map(w => '−' + fmtPlate(w)), ...d.add.map(w => '+' + fmtPlate(w))] : []
+ return <div className="plateline">
+ <Icon name="plate" />
+ <span>{text}{L.missing > 0 && <> · <span className="short">{t('{0} short', fmtPlate(L.missing) + ' ' + S.unit)}</span></>}</span>
+ {moves.length > 0 && <span className="moves">{moves.join(' ')}</span>}
+ </div>
+ }
+ // Everything about this exercise that is not a set you are logging right now lives behind one
+ // button. What used to be a row of buttons in the header, a chip under the bar, a strip of
+ // three under the sets and four more below the card is a single list you open once a session.
- const barInfo = (!editing && !cardio && !(bw && !added) && usesBar(ex)) ? (() => {
- const bar = barWeightFor(S, entry.id)
- if (bar == null || bar < 0) return null
- const nextW = entry.sets.find(s => !s.done)?.w
- const refW = nextW > 0 ? nextW : Math.max(0, ...entry.sets.map(s => s.w || 0))
- const split = plateSplit(refW, bar)
- const perSide = split != null ? t('{0} per side', fmtNum(split) + ' ' + S.unit) : null
- // With no bar there is no bar weight worth naming — the chip is then just the plate math,
- // and it still opens the same sheet to turn it back on (issue #138).
- if (bar === 0) return perSide ? { bar, text: perSide } : null
- return { bar, text: t('Bar {0}', fmtNum(bar) + ' ' + S.unit) + (perSide ? ' · ' + perSide : '') }
- })() : null
const openMore = () => menuSheet({
title: exerciseNameFor(ex),
+ titleClass: exerciseNameClass(ex),
items: [
{ icon: 'pencil', label: entry.note ? t('Edit note') : t('Add note'), sub: entry.note || undefined, onClick: () => exerciseNoteSheet(entryIdx) },
{ icon: 'info', label: t('Details'), onClick: () => exerciseDetailSheet(ex) },
{ icon: 'history', label: t('History'), sub: last ? t('Last time') + ' ' + fmtDate(last.d) : undefined, onClick: () => exerciseHistorySheet(entry.id) },
onProgressionSettings && { icon: 'chartLine', label: t('Progression settings'), sub: guidance ? t(guidance.policyLabel) : undefined, onClick: onProgressionSettings },
- mode === 'reps' && { icon: 'plate', label: t('Plate loading'), sub: loadSummary, onClick: () => barWeightSheet(entry.id, cfg) },
+ onNoProg && { icon: 'pause', label: t('Don’t count for progression'), sub: t('This exercise, this session only'), on: entry.noProg === true, onClick: () => onNoProg(entry.noProg !== true) },
- barInfo && { icon: 'barbell', label: t('Bar weight'), sub: barInfo.text, onClick: () => barWeightSheet(entry.id) },
++ plateLoading && { icon: 'plate', label: t('Plate loading'), sub: loadSummary, onClick: () => barWeightSheet(entry.id, cfg) },
{ icon: 'flame', label: t('Add warm-up set'), onClick: onAddWarmup },
onPairPrev && { icon: 'link', label: t('Make superset with previous'), onClick: onPairPrev },
onPairNext && { icon: 'link', label: t('Make superset with next'), onClick: onPairNext },
@@@ -487,16 -443,8 +529,9 @@@
{t('From {0}:', fmtDate(pinnedNote.d, true))} {pinnedNote.note}
</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>}
- {guidance && <button type="button" className={'progline' + (plan.kind === 'deload' ? ' warn' : '')}
+ {planLine}
+ {refLine}
- {/* Bar + plates for barbell work: what to load per side for the set in front of you
- (first undone set; the heaviest row once everything is checked). The logged number
- stays the total — this chip is the split, and tapping it edits the bar's own weight
- (S.barWeights, per exercise) mid-workout. Weight ≤ bar leaves just the bar. */}
- {barInfo && <div className="small dim" style={{ marginBottom: 6, display: 'flex', alignItems: 'center', gap: 5 }}>
- <Icon name="dumbbell" style={{ fontSize: 12 }} />{barInfo.text}
- </div>}
+ {guidance && onProgressionSettings && <button type="button" className={'progline' + (plan.kind === 'deload' ? ' warn' : '')}
aria-label={t('Open progression settings')} onClick={onProgressionSettings}>
<Icon name={plan.kind === 'up' ? 'arrowUp' : plan.kind === 'deload' ? 'arrowDown' : 'lightbulb'} />
<span><strong>{t(guidance.policyLabel)}</strong> · {t(...guidance.why)}</span>