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.

workout: plate loading per set row — the plates for this weight, from the plates you own

Boris Kurktchievf438c4c578f0
diff --git a/frontend/src/index.css b/frontend/src/index.css
index da086b7ac..ed9097495 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -968,6 +968,12 @@ body.chips-dragging *{cursor:inherit}
@media (max-width:359px){
.subrow{padding-left: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 --git a/frontend/src/lib/bar.js b/frontend/src/lib/bar.js
index d7f294f65..cfd74edad 100644
--- a/frontend/src/lib/bar.js
+++ b/frontend/src/lib/bar.js
@@ -47,8 +47,9 @@ export const hasBarOverride = (S, exId) => {
/**
* Effective bar weight for one exercise, in the profile unit: the explicit
- * S.barWeights[exId] if set, else the default for the bar type. null for anything
- * that is not a bar exercise.
+ * S.barWeights[exId] if set — an explicit 0 is "no bar" (a Smith machine whose carriage is
+ * counterbalanced, issue #138) and stays 0 — else the default for the bar type. null for
+ * anything that is not a bar exercise.
*/
export function barWeightFor(S, exOrId) {
const ex = exOf(exOrId)
@@ -61,7 +62,8 @@ export function barWeightFor(S, exOrId) {
/**
* Plates per side: (total − bar) / 2, rounded to 2 decimals. null when there is nothing
- * sensible to show — a missing number, or a total at or below the bar itself.
+ * sensible to show — a missing number, or a total at or below the bar itself. A bar of 0
+ * ("no bar") splits the whole total.
*/
export function plateSplit(total, bar) {
// `bar` of 0 is a real answer, not a missing one: with no bar every kilo you logged is on the
diff --git a/frontend/src/lib/format.js b/frontend/src/lib/format.js
index fe8b040d2..ba632e6c7 100644
--- a/frontend/src/lib/format.js
+++ b/frontend/src/lib/format.js
@@ -45,6 +45,8 @@ export const fmtNum = n => {
const p = decimals === 2 ? 100 : 10
return (Math.round(n * p) / p).toLocaleString(dateLocale(), { maximumFractionDigits: decimals })
}
+// Plate sizes keep their quarter: 1.25 and 21.25 are real numbers on a plate and a bar.
+export const fmtPlate = n => (Math.round(n * 100) / 100).toLocaleString(dateLocale())
// Volume stays in the profile's unit throughout: the old shorthand turned anything over
// 10 000 into "t", which is wrong for a pound profile and made one list mix "18.8t" with
// "7'535 kg" — two numbers you can't compare at a glance.
diff --git a/frontend/src/lib/plates.js b/frontend/src/lib/plates.js
new file mode 100644
index 000000000..8b7a0e4c3
--- /dev/null
+++ b/frontend/src/lib/plates.js
@@ -0,0 +1,178 @@
+// Plate loading for a set row: which plates go on for THIS weight, from the plates you own.
+//
+// bar.js knows the bar and splits what is beyond it per side. This module turns that number
+// into plates ("45 · 5"), and does the same for a single stack (a dip belt, a landmine, a
+// plate-loaded machine, a sled). Both read the plate inventory in S.plates: pairs per
+// denomination, kept per unit like the bar weight is — a 45 lb plate is a 45 lb plate, a unit
+// switch does not turn it into a 20.4 kg one — so a profile with no inventory of its own gets
+// the standard set for its unit, six pairs of each, which is a rack, not a home gym.
+//
+// Logged weights stay the total on the bar (or the added load). Everything here is display.
+
+import { EXIDX } from './exercises.js'
+import { usesBar, defaultBarWeight } from './bar.js'
+import { isBw } from './history.js'
+
+/** The plate sizes the inventory editor lists, heaviest first, per unit. */
+export const PLATE_SIZES = {
+ kg: [25, 20, 15, 10, 5, 2.5, 1.25, 0.5],
+ lb: [45, 35, 25, 15, 10, 5, 2.5, 1.25],
+}
+/** Sizes a gym without an inventory of its own is assumed NOT to have. */
+const UNCOMMON = { kg: new Set([0.5]), lb: new Set([15, 1.25]) }
+/** Pairs of each size the default inventory holds — plenty, the way a rack is. */
+export const DEFAULT_PAIRS = 6
+
+/** Equipment that loads a single stack rather than two sides of a bar. */
+const SINGLE_EQ = new Set(['weighted', 'sled machine'])
+
+const exOf = exOrId => (typeof exOrId === 'string' ? EXIDX[exOrId] : exOrId)
+const num = v => (typeof v === 'number' && Number.isFinite(v) ? v : Number(v) || 0)
+
+/**
+ * The plates this profile can load, heaviest first: [{ w, n }] with n pairs (or plates, for a
+ * single stack) of each size. S.plates[unit] is { [size]: count }; absent → the default set.
+ */
+export function inventoryFor(S) {
+ const unit = S?.unit === 'lb' ? 'lb' : 'kg'
+ const own = S?.plates?.[unit]
+ const sizes = PLATE_SIZES[unit]
+ const out = []
+ if (own && typeof own === 'object') {
+ for (const [k, v] of Object.entries(own)) {
+ const w = num(k), n = Math.floor(num(v))
+ if (w > 0 && n > 0) out.push({ w, n })
+ }
+ } else {
+ for (const w of sizes) if (!UNCOMMON[unit].has(w)) out.push({ w, n: DEFAULT_PAIRS })
+ }
+ return out.sort((a, b) => b.w - a.w)
+}
+
+/** The count of one size in this profile's inventory (0 when it has none). */
+export const pairsOf = (S, w) => inventoryFor(S).find(p => p.w === w)?.n || 0
+
+// Everything is done in quarter-units so 1.25 and 2.5 stay exact integers.
+const Q = 4
+const q = w => Math.round(w * Q)
+
+/**
+ * Plates for `weight`, from `inv` ([{ w, n }], heaviest first). Heaviest-first greedy when that
+ * lands exactly — the way a bar is loaded in practice. When greedy misses (a home gym with one
+ * pair of each size, an odd inventory) the fewest plates that hit the weight exactly, biased to
+ * heavier plates on ties. When nothing hits it, the closest load BELOW and what is missing.
+ * → { plates: [w, …] heaviest first, missing: number } (missing 0 = exact)
+ */
+export function plateStack(weight, inv) {
+ const target = q(Math.max(0, num(weight)))
+ if (target === 0) return { plates: [], missing: 0 }
+ const items = (inv || []).filter(p => p.w > 0 && p.n > 0).sort((a, b) => b.w - a.w)
+ // 1. greedy
+ const greedy = []
+ let left = target
+ for (const p of items) {
+ const unit = q(p.w)
+ let k = Math.min(p.n, Math.floor(left / unit))
+ while (k-- > 0) { greedy.push(p.w); left -= unit }
+ }
+ if (left === 0) return { plates: greedy, missing: 0 }
+ // 2. exact fit with the fewest plates: f[i][s] = min plates using sizes i.. to make s
+ const n = items.length
+ const INF = 1e9
+ const f = Array.from({ length: n + 1 }, () => new Int32Array(target + 1).fill(INF))
+ f[n][0] = 0
+ for (let i = n - 1; i >= 0; i--) {
+ const unit = q(items[i].w), cap = items[i].n
+ for (let s = 0; s <= target; s++) {
+ let best = f[i + 1][s]
+ for (let k = 1; k <= cap && k * unit <= s; k++) {
+ const v = f[i + 1][s - k * unit]
+ if (v + k < best) best = v + k
+ }
+ f[i][s] = best
+ }
+ }
+ // The heaviest reachable sum at or below the target (the target itself when it fits).
+ let sum = target
+ while (sum > 0 && f[0][sum] >= INF) sum--
+ const plates = []
+ let s = sum
+ for (let i = 0; i < n; i++) {
+ const unit = q(items[i].w), cap = items[i].n
+ // Largest k that still leaves an optimal remainder → heavier plates on ties.
+ for (let k = Math.min(cap, Math.floor(s / unit)); k >= 0; k--) {
+ if (f[i + 1][s - k * unit] + k === f[i][s]) {
+ for (let j = 0; j < k; j++) plates.push(items[i].w)
+ s -= k * unit
+ break
+ }
+ }
+ }
+ return { plates, missing: (target - sum) / Q }
+}
+
+/**
+ * Going from one stack to the next: what comes off and what goes on (multiset difference),
+ * each heaviest first. { strip: [w…], add: [w…] } — both empty when nothing changes.
+ */
+export function plateDelta(prev, next) {
+ const count = arr => { const m = new Map(); for (const w of arr || []) m.set(w, (m.get(w) || 0) + 1); return m }
+ const a = count(prev), b = count(next)
+ const strip = [], add = []
+ for (const [w, n] of a) for (let i = 0; i < n - (b.get(w) || 0); i++) strip.push(w)
+ for (const [w, n] of b) for (let i = 0; i < n - (a.get(w) || 0); i++) add.push(w)
+ const desc = (x, y) => y - x
+ return { strip: strip.sort(desc), add: add.sort(desc) }
+}
+
+/**
+ * How an exercise's weight is loaded: 'pairs' (a bar or a two-post machine — plates split per
+ * side beyond the bar), 'single' (one stack: dip belt, landmine, plate-loaded machine, sled — all
+ * of it beyond the base weight), 'none' (dumbbells, kettlebells, cables, pin machines). The
+ * user's own choice in S.loadKind wins; otherwise bar equipment → pairs, body-weight and
+ * "weighted" exercises and sleds → single (the added load is what you hang on), the rest → none.
+ */
+export function loadKindFor(S, cfgOrId) {
+ const cfg = typeof cfgOrId === 'string' ? { id: cfgOrId } : (cfgOrId || {})
+ const ex = exOf(cfg.id)
+ const own = S?.loadKind?.[cfg.id]
+ if (own === 'pairs' || own === 'single' || own === 'none') return own
+ if (usesBar(ex)) return 'pairs'
+ if (SINGLE_EQ.has(ex?.eq) || isBw(cfg)) return 'single'
+ return 'none'
+}
+
+/**
+ * The weight that is there before any plate goes on, in the profile unit: the bar for bar
+ * exercises (S.barWeights override, 0 = "no bar", else the type's default), the explicit
+ * override for anything else (a sled's own weight), 0 otherwise.
+ */
+export function baseWeightFor(S, exOrId) {
+ const ex = exOf(exOrId)
+ if (!ex) return 0
+ const own = S?.barWeights?.[ex.id]
+ if (typeof own === 'number' && own >= 0) return own
+ return defaultBarWeight(ex.eq, S?.unit) ?? 0
+}
+
+/**
+ * The load line for one set row: null when there is nothing to load (kind none, no weight);
+ * { barOnly: true } when the weight is at or below the base; otherwise the stack for the
+ * per-side (pairs) or total (single) load plus what is missing from the inventory.
+ * → { kind, perSide, plates, missing, barOnly }
+ */
+export function rowLoad(kind, weight, base, inv) {
+ if (kind !== 'pairs' && kind !== 'single') return null
+ const w = num(weight)
+ if (!(w > 0)) return null
+ const b = Math.max(0, num(base))
+ if (w <= b) return { kind, barOnly: true, perSide: 0, plates: [], missing: 0 }
+ const perSide = Math.round(((w - b) / (kind === 'pairs' ? 2 : 1)) * 100) / 100
+ const { plates, missing } = plateStack(perSide, inv)
+ return { kind, barOnly: false, perSide, plates, missing }
+}
+
+/** Two rows load the same when their stacks match, both are (or are not) bar-only, and the same amount is missing. */
+export const sameLoad = (a, b) =>
+ !!a && !!b && a.barOnly === b.barOnly && a.missing === b.missing
+ && a.plates.length === b.plates.length && a.plates.every((w, i) => w === b.plates[i])
diff --git a/frontend/src/lib/plates.test.js b/frontend/src/lib/plates.test.js
new file mode 100644
index 000000000..aa2425f82
--- /dev/null
+++ b/frontend/src/lib/plates.test.js
@@ -0,0 +1,155 @@
+import { describe, expect, test } from 'vitest'
+import { PLATE_SIZES, DEFAULT_PAIRS, inventoryFor, pairsOf, plateStack, plateDelta, loadKindFor, baseWeightFor, rowLoad, sameLoad } from './plates.js'
+import { EXDB } from './exercises-data.js'
+
+const idOf = eq => EXDB.find(e => e.eq === eq).id
+// A home gym: one pair of each size (the coach's inventory, 2026-09-01).
+const HOME = { unit: 'lb', plates: { lb: { 45: 1, 35: 1, 25: 1, 15: 1, 10: 1, 5: 1, 2.5: 1 } } }
+const homeInv = inventoryFor(HOME)
+
+describe('inventoryFor', () => {
+ test('a profile without plates of its own gets the standard set for its unit, plenty of each', () => {
+ const lb = inventoryFor({ unit: 'lb' })
+ expect(lb.map(p => p.w)).toEqual([45, 35, 25, 10, 5, 2.5]) // no 15s, no 1.25s in a gym by default
+ expect(lb.every(p => p.n === DEFAULT_PAIRS)).toBe(true)
+ const kg = inventoryFor({ unit: 'kg' })
+ expect(kg.map(p => p.w)).toEqual([25, 20, 15, 10, 5, 2.5, 1.25])
+ expect(inventoryFor({}).map(p => p.w)).toEqual(kg.map(p => p.w)) // kg when unset
+ })
+
+ test('the editor lists every size, the inventory only what you have', () => {
+ expect(PLATE_SIZES.lb).toContain(15)
+ expect(homeInv.map(p => p.w)).toEqual([45, 35, 25, 15, 10, 5, 2.5])
+ expect(homeInv.every(p => p.n === 1)).toBe(true)
+ expect(pairsOf(HOME, 45)).toBe(1)
+ expect(pairsOf(HOME, 1.25)).toBe(0)
+ expect(pairsOf({ unit: 'lb' }, 45)).toBe(DEFAULT_PAIRS)
+ })
+
+ test('zero and junk counts drop out; the other unit\'s inventory is ignored', () => {
+ const S = { unit: 'kg', plates: { kg: { 20: 2, 10: 0, 5: 'x', 2.5: 1.9 }, lb: { 45: 9 } } }
+ expect(inventoryFor(S)).toEqual([{ w: 20, n: 2 }, { w: 2.5, n: 1 }])
+ })
+})
+
+describe('plateStack', () => {
+ test('heaviest first when that lands exactly — the way a bar is loaded', () => {
+ expect(plateStack(50, homeInv)).toEqual({ plates: [45, 5], missing: 0 })
+ expect(plateStack(60, inventoryFor({ unit: 'lb' }))).toEqual({ plates: [45, 10, 5], missing: 0 })
+ expect(plateStack(115, inventoryFor({ unit: 'lb' }))).toEqual({ plates: [45, 45, 25], missing: 0 })
+ expect(plateStack(21.25, inventoryFor({ unit: 'kg' }))).toEqual({ plates: [20, 1.25], missing: 0 })
+ })
+
+ test('the coach ramp on Monday\'s squat, one pair of each', () => {
+ expect(plateStack(12.5, homeInv).plates).toEqual([10, 2.5])
+ expect(plateStack(27.5, homeInv).plates).toEqual([25, 2.5])
+ expect(plateStack(37.5, homeInv).plates).toEqual([35, 2.5])
+ expect(plateStack(50, homeInv).plates).toEqual([45, 5])
+ expect(plateStack(137.5, homeInv)).toEqual({ plates: [45, 35, 25, 15, 10, 5, 2.5], missing: 0 })
+ })
+
+ test('when greedy misses, the fewest plates that hit the weight exactly', () => {
+ // greedy would take the 35 and be stuck 15 short; two 25s do it
+ expect(plateStack(50, [{ w: 35, n: 1 }, { w: 25, n: 2 }])).toEqual({ plates: [25, 25], missing: 0 })
+ // 100 with one pair each: 45 + 35 leaves 20 → 15 + 5
+ expect(plateStack(100, homeInv)).toEqual({ plates: [45, 35, 15, 5], missing: 0 })
+ })
+
+ test('what cannot be loaded says how much is missing, from the closest load below', () => {
+ expect(plateStack(140, homeInv)).toEqual({ plates: [45, 35, 25, 15, 10, 5, 2.5], missing: 2.5 })
+ expect(plateStack(12.5, [{ w: 10, n: 1 }, { w: 5, n: 1 }])).toEqual({ plates: [10], missing: 2.5 })
+ expect(plateStack(1, homeInv)).toEqual({ plates: [], missing: 1 })
+ })
+
+ test('nothing to load is an empty stack; an empty inventory misses everything', () => {
+ expect(plateStack(0, homeInv)).toEqual({ plates: [], missing: 0 })
+ expect(plateStack(null, homeInv)).toEqual({ plates: [], missing: 0 })
+ expect(plateStack(30, [])).toEqual({ plates: [], missing: 30 })
+ })
+})
+
+describe('plateDelta', () => {
+ test('what comes off and what goes on between two stacks', () => {
+ expect(plateDelta([10, 2.5], [25, 2.5])).toEqual({ strip: [10], add: [25] })
+ expect(plateDelta([45, 5], [45, 5])).toEqual({ strip: [], add: [] })
+ expect(plateDelta([], [45, 35])).toEqual({ strip: [], add: [45, 35] })
+ expect(plateDelta([45, 45, 10], [45, 25, 5]).strip).toEqual([45, 10])
+ expect(plateDelta([45, 45, 10], [45, 25, 5]).add).toEqual([25, 5])
+ })
+})
+
+describe('loadKindFor', () => {
+ const barbell = idOf('barbell'), smith = idOf('smith machine'), db = idOf('dumbbell')
+ const bw = idOf('body weight'), weighted = idOf('weighted'), sled = idOf('sled machine')
+
+ test('bars split per side, added weight and sleds are one stack, the rest is not plate-loaded', () => {
+ expect(loadKindFor({}, barbell)).toBe('pairs')
+ expect(loadKindFor({}, smith)).toBe('pairs')
+ expect(loadKindFor({}, bw)).toBe('single')
+ expect(loadKindFor({}, weighted)).toBe('single')
+ expect(loadKindFor({}, sled)).toBe('single')
+ expect(loadKindFor({}, db)).toBe('none')
+ expect(loadKindFor({}, 'no-such-id')).toBe('none')
+ })
+
+ test('a routine flagging an exercise as body-weight follows the flag', () => {
+ expect(loadKindFor({}, { id: db, bodyweight: true })).toBe('single')
+ expect(loadKindFor({}, { id: bw, bodyweight: false })).toBe('none')
+ })
+
+ test('the user\'s own choice wins; junk does not', () => {
+ expect(loadKindFor({ loadKind: { [db]: 'single' } }, db)).toBe('single') // a plate-loaded leg press
+ expect(loadKindFor({ loadKind: { [barbell]: 'none' } }, barbell)).toBe('none')
+ expect(loadKindFor({ loadKind: { [barbell]: 'weird' } }, barbell)).toBe('pairs')
+ })
+})
+
+describe('baseWeightFor', () => {
+ const barbell = idOf('barbell'), sled = idOf('sled machine')
+ test('the bar for bar exercises, 0 for "no bar", the override or 0 for anything else', () => {
+ expect(baseWeightFor({ unit: 'lb' }, barbell)).toBe(45)
+ expect(baseWeightFor({ unit: 'lb', barWeights: { [barbell]: 0 } }, barbell)).toBe(0)
+ expect(baseWeightFor({ unit: 'lb', barWeights: { [barbell]: 35 } }, barbell)).toBe(35)
+ expect(baseWeightFor({ unit: 'lb' }, sled)).toBe(0)
+ expect(baseWeightFor({ unit: 'lb', barWeights: { [sled]: 100 } }, sled)).toBe(100)
+ expect(baseWeightFor({ unit: 'lb' }, 'no-such-id')).toBe(0)
+ })
+})
+
+describe('rowLoad', () => {
+ test('a bar row: per side beyond the bar, as plates', () => {
+ expect(rowLoad('pairs', 145, 45, homeInv)).toEqual({ kind: 'pairs', barOnly: false, perSide: 50, plates: [45, 5], missing: 0 })
+ expect(rowLoad('pairs', 70, 45, homeInv).plates).toEqual([10, 2.5])
+ })
+
+ test('at or below the bar is "bar only"; no weight is nothing', () => {
+ expect(rowLoad('pairs', 45, 45, homeInv)).toMatchObject({ barOnly: true, plates: [] })
+ expect(rowLoad('pairs', 40, 45, homeInv)).toMatchObject({ barOnly: true })
+ expect(rowLoad('pairs', 0, 45, homeInv)).toBe(null)
+ expect(rowLoad('pairs', null, 45, homeInv)).toBe(null)
+ })
+
+ test('no bar (issue #138): the whole total is plates', () => {
+ expect(rowLoad('pairs', 90, 0, homeInv)).toMatchObject({ perSide: 45, plates: [45] })
+ })
+
+ test('a single stack takes all of it beyond the base: a belt, a sled', () => {
+ expect(rowLoad('single', 25, 0, homeInv)).toEqual({ kind: 'single', barOnly: false, perSide: 25, plates: [25], missing: 0 })
+ expect(rowLoad('single', 190, 100, homeInv).plates).toEqual([45, 35, 10])
+ })
+
+ test('kind none never loads', () => {
+ expect(rowLoad('none', 100, 20, homeInv)).toBe(null)
+ expect(rowLoad(undefined, 100, 20, homeInv)).toBe(null)
+ })
+
+ test('sameLoad compares stacks, so a run of equal weights shows its plates once', () => {
+ const a = rowLoad('pairs', 145, 45, homeInv), b = rowLoad('pairs', 145, 45, homeInv), c = rowLoad('pairs', 120, 45, homeInv)
+ expect(sameLoad(a, b)).toBe(true)
+ expect(sameLoad(a, c)).toBe(false)
+ expect(sameLoad(rowLoad('pairs', 45, 45, homeInv), rowLoad('pairs', 40, 45, homeInv))).toBe(true)
+ expect(sameLoad(a, null)).toBe(false)
+ // Same plates, different shortfall (325 vs 330 total on one pair of each): not the same line.
+ expect(sameLoad(rowLoad('pairs', 325, 45, homeInv), rowLoad('pairs', 330, 45, homeInv))).toBe(false)
+ })
+})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 05eaeab8c..8586c60c0 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -27,11 +27,11 @@ describe('Brazilian Portuguese locale', () => {
.sort(byCodeUnit)
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
- expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(645)
- expect(inherited).toHaveLength(660)
+ 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
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('a2027d64b3944dcef644b11b4d9688b88fe5cff0693acf04c73f0667e2b86825')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('d3fca1eae172e131af7e6c9e698de4ed165e5253a28e1b42f423c3ac2d27e263')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/lib/sync-merge.js b/frontend/src/lib/sync-merge.js
index 3f0ca79c1..cf475e6a1 100644
--- a/frontend/src/lib/sync-merge.js
+++ b/frontend/src/lib/sync-merge.js
@@ -14,7 +14,7 @@
* - 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: key union
+ * forgotten, whichever way it runs); exNotes, barWeights, loadKind, plates: key union
* - `_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
@@ -91,7 +91,7 @@ export function mergeStates(a, b, { prefer } = {}) {
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 f of ['exNotes', 'barWeights']) {
+ for (const f of ['exNotes', 'barWeights', 'loadKind', 'plates']) {
if (n[f] || o[f]) out[f] = clone({ ...(o[f] || {}), ...(n[f] || {}) })
}
out._ts = Math.max(a._ts || 0, b._ts || 0)
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index dc0a877ca..45c0ce2af 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1160,16 +1160,33 @@ export default {
'Finish the current workout first.': 'Beende zuerst das laufende Training.',
'Logging a past workout — no rest timers.': 'Vergangenes Training — keine Pausen-Timer.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Stangengewicht',
'Bar ({0})': 'Stange ({0})',
'Bar {0}': 'Stange {0}',
+ 'Plate loading': 'Scheiben laden',
+ 'Single stack': 'Einzelstapel',
+ 'No bar': 'Keine Stange',
+ 'Bar only': 'Nur Stange',
+ 'Load {0}': '{0} laden',
+ '{0} short': '{0} zu wenig',
+ 'Plates split over both sides of a bar.': 'Scheiben verteilt auf beide Seiten der Stange.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Ein Stapel — ein Gurt, eine Landmine, eine Scheibenmaschine, ein Schlitten.',
+ 'No plate line under the sets.': 'Keine Scheiben-Zeile unter den Sätzen.',
+ 'Base weight ({0})': 'Grundgewicht ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'Die Maschine oder der Schlitten selbst, bevor eine Scheibe aufgelegt wird. 0, wenn alles Scheiben sind.',
+ 'Plates': 'Scheiben',
+ '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.': 'Paare jeder Größe, die du besitzt. Jede Satzzeile lädt aus dieser Liste, damit ein Heimstudio mit nur einem Paar 45er-Scheiben nie aufgefordert wird, zwei zu benutzen.',
+ 'pairs': 'Paare',
+ 'Your own list for {0}.': 'Deine eigene Liste für {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'Der Standardsatz, von allem reichlich — ändere eine Anzahl, um ihn dir anzupassen.',
+ 'Back to the standard set': 'Zurück zum Standardsatz',
+ 'Standard set — tap to count the pairs you own.': 'Standardsatz — tippe, um deine Paare zu zählen.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Eingetragen wird weiterhin das Gesamtgewicht — das dient nur der Scheiben-Zeile unter jedem Satz.',
'Default for this bar type.': 'Standard für diesen Stangentyp.',
'No bar': 'Keine Stange',
'The weight you log is all plates.': 'Das eingetragene Gewicht sind nur Scheiben.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Scheiben werden ab 0 gerechnet — ausschalten fuer den Standard ({0}).',
'Set to 0 to go back to the default ({0}).': 'Auf 0 stellen, um zum Standard ({0}) zurückzukehren.',
'Applies to this exercise everywhere, not just this plan.': 'Gilt überall für diese Übung, nicht nur in diesem Plan.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Eingetragen wird weiterhin das Gesamtgewicht — die Stange zählt nur für die Scheiben-Rechnung pro Seite.',
// Gym check-in (mobile-only)
'Check in': 'Einchecken',
'At the gym': 'Im Studio',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 2393a0c16..a0099a665 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Termina primero el entrenamiento actual.',
'Logging a past workout — no rest timers.': 'Registrando un entrenamiento pasado — sin temporizadores de descanso.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Peso de la barra',
'Bar ({0})': 'Barra ({0})',
'Bar {0}': 'Barra {0}',
+ 'Plate loading': 'Carga de discos',
+ 'Single stack': 'Pila única',
+ 'No bar': 'Sin barra',
+ 'Bar only': 'Solo barra',
+ 'Load {0}': 'Cargar {0}',
+ '{0} short': '{0} de menos',
+ 'Plates split over both sides of a bar.': 'Discos repartidos entre los dos lados de la barra.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Una sola pila — un cinturón, una landmine, una máquina de discos, un trineo.',
+ 'No plate line under the sets.': 'Sin línea de discos bajo las series.',
+ 'Base weight ({0})': 'Peso base ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'La propia máquina o trineo, antes de poner ningún disco. 0 si todo son discos.',
+ 'Plates': 'Discos',
+ '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.': 'Pares de cada tamaño que tienes. Cada serie carga desde esta lista, así un gimnasio casero con un solo par de discos de 45 nunca recibe la indicación de usar dos.',
+ 'pairs': 'pares',
+ 'Your own list for {0}.': 'Tu propia lista para {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'El juego estándar, de sobra de cada uno — cambia cualquier cantidad para hacerlo tuyo.',
+ 'Back to the standard set': 'Volver al juego estándar',
+ 'Standard set — tap to count the pairs you own.': 'Juego estándar — toca para contar los pares que tienes.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Sigues registrando el peso total — esto solo alimenta la línea de discos bajo cada serie.',
'Default for this bar type.': 'Valor por defecto para este tipo de barra.',
'No bar': 'Sin barra',
'The weight you log is all plates.': 'El peso que registras son solo discos.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Los discos se cuentan desde 0 — desactívalo para el valor por defecto ({0}).',
'Set to 0 to go back to the default ({0}).': 'Pon 0 para volver al valor por defecto ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Se aplica a este ejercicio en todas partes, no solo en este plan.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Sigues registrando el peso total — la barra solo se usa para calcular los discos por lado.',
// Gym check-in (mobile-only)
'Check in': 'Registrarse',
'At the gym': 'En el gimnasio',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 15e014795..3c7124503 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Termine d’abord la séance en cours.',
'Logging a past workout — no rest timers.': 'Séance passée — pas de minuteurs de repos.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Poids de la barre',
'Bar ({0})': 'Barre ({0})',
'Bar {0}': 'Barre {0}',
+ 'Plate loading': 'Chargement des disques',
+ 'Single stack': 'Pile unique',
+ 'No bar': 'Sans barre',
+ 'Bar only': 'Barre seule',
+ 'Load {0}': 'Charger {0}',
+ '{0} short': '{0} en moins',
+ 'Plates split over both sides of a bar.': 'Disques répartis des deux côtés de la barre.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Une seule pile — une ceinture, une landmine, une machine à disques, un traîneau.',
+ 'No plate line under the sets.': 'Pas de ligne de disques sous les séries.',
+ 'Base weight ({0})': 'Poids de base ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'La machine ou le traîneau lui-même, avant d\'ajouter le moindre disque. 0 si tout est en disques.',
+ 'Plates': 'Disques',
+ '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.': 'Paires de chaque taille que tu as. Chaque série se charge à partir de cette liste, pour qu\'une salle à la maison avec une seule paire de disques de 45 ne se voie jamais dire d\'en utiliser deux.',
+ 'pairs': 'paires',
+ 'Your own list for {0}.': 'Ta propre liste pour {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'Le jeu standard, en abondance pour chaque taille — change n\'importe quel nombre pour te l\'approprier.',
+ 'Back to the standard set': 'Revenir au jeu standard',
+ 'Standard set — tap to count the pairs you own.': 'Jeu standard — touche pour compter tes paires.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Tu enregistres toujours le poids total — cela ne sert qu\'à la ligne de disques sous chaque série.',
'Default for this bar type.': 'Valeur par défaut pour ce type de barre.',
'No bar': 'Sans barre',
'The weight you log is all plates.': 'Le poids que tu notes, ce sont les disques.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Les disques sont comptés à partir de 0 — désactive pour la valeur par défaut ({0}).',
'Set to 0 to go back to the default ({0}).': 'Mets 0 pour revenir à la valeur par défaut ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'S’applique à cet exercice partout, pas seulement dans ce plan.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Tu enregistres toujours le poids total — la barre ne sert qu’au calcul des disques par côté.',
// Gym check-in (mobile-only)
'Check in': 'Enregistrement',
'At the gym': 'À la salle',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 95c35c135..b780b44e0 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'पहले मौजूदा वर्कआउट पूरा करें।',
'Logging a past workout — no rest timers.': 'पिछला वर्कआउट दर्ज हो रहा है — कोई रेस्ट टाइमर नहीं।',
// --- bar weight (plate math) ---
- 'Bar weight': 'बार का वज़न',
'Bar ({0})': 'बार ({0})',
'Bar {0}': 'बार {0}',
+ 'Plate loading': 'प्लेट लोडिंग',
+ 'Single stack': 'एक स्टैक',
+ 'No bar': 'बार नहीं',
+ 'Bar only': 'सिर्फ़ बार',
+ 'Load {0}': '{0} लोड करें',
+ '{0} short': '{0} कम',
+ 'Plates split over both sides of a bar.': 'बार के दोनों तरफ़ बंटी हुई प्लेटें।',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'एक स्टैक — एक बेल्ट, एक लैंडमाइन, प्लेट वाली कोई मशीन, एक स्लेड।',
+ 'No plate line under the sets.': 'सेट के नीचे कोई प्लेट लाइन नहीं।',
+ 'Base weight ({0})': 'आधार वज़न ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'मशीन या स्लेड का अपना वज़न, प्लेट लगाने से पहले। अगर सब कुछ प्लेट ही है तो 0।',
+ 'Plates': 'प्लेटें',
+ '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.': 'आपके पास मौजूद हर साइज़ के जोड़े। हर सेट इसी लिस्ट से लोड होता है, ताकि सिर्फ़ एक जोड़ी 45 वाली प्लेट रखने वाले होम जिम को कभी दो इस्तेमाल करने को न कहा जाए।',
+ 'pairs': 'जोड़े',
+ 'Your own list for {0}.': '{0} के लिए आपकी अपनी लिस्ट।',
+ 'The standard set, plenty of each — change any count to make it yours.': 'स्टैंडर्ड सेट, हर साइज़ में भरपूर — इसे अपना बनाने के लिए किसी भी गिनती को बदलें।',
+ 'Back to the standard set': 'स्टैंडर्ड सेट पर वापस जाएँ',
+ 'Standard set — tap to count the pairs you own.': 'स्टैंडर्ड सेट — अपने पास मौजूद जोड़ों को गिनने के लिए टैप करें।',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'आप अब भी कुल वज़न ही दर्ज करते हैं — यह सिर्फ़ हर सेट के नीचे की प्लेट लाइन में काम आता है।',
'Default for this bar type.': 'इस तरह की बार का डिफ़ॉल्ट मान।',
'No bar': 'कोई बार नहीं',
'The weight you log is all plates.': 'आप जो वज़न दर्ज करते हैं वह पूरा प्लेट है।',
'Plates are counted from 0 — turn this off for the default ({0}).': 'प्लेट 0 से गिनी जाती हैं — डिफ़ॉल्ट ({0}) के लिए इसे बंद करें।',
'Set to 0 to go back to the default ({0}).': 'डिफ़ॉल्ट ({0}) पर लौटने के लिए 0 सेट करें।',
'Applies to this exercise everywhere, not just this plan.': 'यह इस एक्सरसाइज़ पर हर जगह लागू होता है, सिर्फ़ इसी प्लान पर नहीं।',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'आप अब भी कुल वज़न ही दर्ज करते हैं — बार सिर्फ़ हर तरफ़ की प्लेट गिनती में काम आता है।',
// Gym check-in (mobile-only)
'Check in': 'चेक इन',
'At the gym': 'जिम में',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index a1cf236c0..a2cefc842 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -805,16 +805,33 @@ export default {
'Finish the current workout first.': 'Előbb fejezd be a folyó edzést.',
'Logging a past workout — no rest timers.': 'Korábbi edzés rögzítése — nincs pihenőidőzítő.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Rúd súlya',
'Bar ({0})': 'Rúd ({0})',
'Bar {0}': 'Rúd {0}',
+ 'Plate loading': 'Tárcsák felhelyezése',
+ 'Single stack': 'Egy oszlop',
+ 'No bar': 'Nincs rúd',
+ 'Bar only': 'Csak a rúd',
+ 'Load {0}': '{0} betöltése',
+ '{0} short': '{0} hiányzik',
+ 'Plates split over both sides of a bar.': 'A tárcsák a rúd mindkét oldalára oszlanak el.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Egy oszlop — egy öv, egy landmine, egy tárcsás gép, egy szán.',
+ 'No plate line under the sets.': 'Nincs tárcsasor a sorozatok alatt.',
+ 'Base weight ({0})': 'Alapsúly ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'Maga a gép vagy szán, mielőtt bármilyen tárcsa felkerülne rá. 0, ha az egész tárcsákból áll.',
+ 'Plates': 'Tárcsák',
+ '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.': 'A birtokodban lévő párok száma méretenként. Minden sorozat ebből a listából dolgozik, így egy otthoni edzőterem, amelynek csak egy pár 45-öse van, sosem kap olyan utasítást, hogy kettőt használjon.',
+ 'pairs': 'pár',
+ 'Your own list for {0}.': 'A saját listád ehhez: {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'A szabvány készlet, mindegyikből bőven — változtass meg bármelyik számot, hogy a sajátod legyen.',
+ 'Back to the standard set': 'Vissza a szabvány készlethez',
+ 'Standard set — tap to count the pairs you own.': 'Szabvány készlet — koppints, hogy megszámold a birtokodban lévő párokat.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Továbbra is a teljes súlyt rögzíted — ez csak a sorozatok alatti tárcsasor kiszámításához kell.',
'Default for this bar type.': 'Alapérték ehhez a rúdtípushoz.',
'No bar': 'Nincs rúd',
'The weight you log is all plates.': 'A beírt súly csak a tárcsák.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'A tárcsák 0-tól számítanak — kapcsold ki az alapértékhez ({0}).',
'Set to 0 to go back to the default ({0}).': 'Állítsd 0-ra az alapérték ({0}) visszaállításához.',
'Applies to this exercise everywhere, not just this plan.': 'Mindenhol érvényes erre a gyakorlatra, nem csak ebben a tervben.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Továbbra is a teljes súlyt rögzíted — a rúd csak az oldalankénti tárcsaszámításhoz kell.',
// Gym check-in (mobile-only)
'Check in': 'Bejelentkezés',
'At the gym': 'A teremben',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 89d904785..e901d28ed 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Termina prima l’allenamento in corso.',
'Logging a past workout — no rest timers.': 'Allenamento passato — nessun timer di recupero.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Peso del bilanciere',
'Bar ({0})': 'Bilanciere ({0})',
'Bar {0}': 'Bilanciere {0}',
+ 'Plate loading': 'Caricamento dischi',
+ 'Single stack': 'Pila unica',
+ 'No bar': 'Senza bilanciere',
+ 'Bar only': 'Solo bilanciere',
+ 'Load {0}': 'Carica {0}',
+ '{0} short': '{0} in meno',
+ 'Plates split over both sides of a bar.': 'Dischi distribuiti su entrambi i lati del bilanciere.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Una pila unica — una cintura, una landmine, una macchina a dischi, una slitta.',
+ 'No plate line under the sets.': 'Nessuna riga dei dischi sotto le serie.',
+ 'Base weight ({0})': 'Peso base ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'La macchina o la slitta stessa, prima di aggiungere qualsiasi disco. 0 se è tutto dischi.',
+ 'Plates': 'Dischi',
+ '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.': 'Le coppie di ciascuna misura che possiedi. Ogni serie carica da questo elenco, così una palestra di casa con una sola coppia di dischi da 45 non si sente mai dire di usarne due.',
+ 'pairs': 'coppie',
+ 'Your own list for {0}.': 'La tua lista personale per {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'Il set standard, abbondante per ciascuna misura — cambia un conteggio qualsiasi per renderlo tuo.',
+ 'Back to the standard set': 'Torna al set standard',
+ 'Standard set — tap to count the pairs you own.': 'Set standard — tocca per contare le coppie che possiedi.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Registri comunque il peso totale — questo serve solo alla riga dei dischi sotto ogni serie.',
'Default for this bar type.': 'Valore predefinito per questo tipo di bilanciere.',
'No bar': 'Senza bilanciere',
'The weight you log is all plates.': 'Il peso che registri sono solo i dischi.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'I dischi si contano da 0 — disattiva per il valore predefinito ({0}).',
'Set to 0 to go back to the default ({0}).': 'Imposta 0 per tornare al valore predefinito ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Vale per questo esercizio ovunque, non solo in questo piano.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Registri comunque il peso totale — il bilanciere serve solo al calcolo dei dischi per lato.',
// Gym check-in (mobile-only)
'Check in': 'Check-in',
'At the gym': 'In palestra',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index f36bbe008..4b2f62c08 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': '먼저 진행 중인 운동을 마치세요.',
'Logging a past workout — no rest timers.': '지난 운동 기록 중 — 휴식 타이머 없음.',
// --- bar weight (plate math) ---
- 'Bar weight': '바 무게',
'Bar ({0})': '바 ({0})',
'Bar {0}': '바 {0}',
+ 'Plate loading': '플레이트 끼우기',
+ 'Single stack': '단일 스택',
+ 'No bar': '바 없음',
+ 'Bar only': '빈 바',
+ 'Load {0}': '{0} 불러오기',
+ '{0} short': '{0} 부족',
+ 'Plates split over both sides of a bar.': '바 양쪽에 나뉘어 실리는 플레이트입니다.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': '하나의 스택 — 벨트, 랜드마인, 플레이트 머신, 슬레드.',
+ 'No plate line under the sets.': '세트 아래에 플레이트 줄 없음.',
+ 'Base weight ({0})': '기본 무게 ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': '플레이트를 끼우기 전, 머신이나 슬레드 자체의 무게입니다. 전부 플레이트라면 0으로 두세요.',
+ 'Plates': '플레이트',
+ '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.': '가지고 있는 사이즈별 쌍의 수입니다. 모든 세트 행이 이 목록에서 불러오므로, 45짜리 한 쌍만 있는 홈짐에 두 개를 쓰라고 하지 않습니다.',
+ 'pairs': '쌍',
+ 'Your own list for {0}.': '{0}용 나만의 목록입니다.',
+ 'The standard set, plenty of each — change any count to make it yours.': '표준 세트로, 각각 넉넉하게 있습니다 — 원하는 대로 만들려면 개수를 바꾸세요.',
+ 'Back to the standard set': '표준 세트로 되돌리기',
+ 'Standard set — tap to count the pairs you own.': '표준 세트 — 가지고 있는 쌍의 수를 세려면 탭하세요.',
+ 'You still log the total weight — this only feeds the plate line under each set.': '기록은 여전히 총 무게입니다 — 이 값은 각 세트 아래의 플레이트 줄에만 쓰입니다.',
'Default for this bar type.': '이 바 종류의 기본값입니다.',
'No bar': '바 없음',
'The weight you log is all plates.': '기록하는 무게가 전부 원판입니다.',
'Plates are counted from 0 — turn this off for the default ({0}).': '원판을 0부터 계산합니다 — 기본값({0})으로 돌리려면 끄세요.',
'Set to 0 to go back to the default ({0}).': '0으로 두면 기본값({0})으로 돌아갑니다.',
'Applies to this exercise everywhere, not just this plan.': '이 플랜만이 아니라 어디서든 이 운동에 적용됩니다.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': '기록은 여전히 총 무게입니다 — 바 무게는 한쪽에 끼울 원판 계산에만 쓰입니다.',
// Gym check-in (mobile-only)
'Check in': '체크인',
'At the gym': '헬스장에서',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 529d5ab92..d90ec5c5b 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Najpierw zakończ bieżący trening.',
'Logging a past workout — no rest timers.': 'Zapisywanie minionego treningu — bez minutników przerw.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Ciężar gryfu',
'Bar ({0})': 'Gryf ({0})',
'Bar {0}': 'Gryf {0}',
+ 'Plate loading': 'Dobieranie talerzy',
+ 'Single stack': 'Pojedynczy stos',
+ 'No bar': 'Bez gryfu',
+ 'Bar only': 'Sam gryf',
+ 'Load {0}': 'Załóż {0}',
+ '{0} short': 'brakuje {0}',
+ 'Plates split over both sides of a bar.': 'Talerze rozłożone na obu końcach gryfu.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Jeden stos — pas, landmine, maszyna na talerze, sanie.',
+ 'No plate line under the sets.': 'Brak linii z talerzami pod seriami.',
+ 'Base weight ({0})': 'Ciężar bazowy ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'Sama maszyna lub sanie, zanim dołożysz jakikolwiek talerz. 0, jeśli to same talerze.',
+ 'Plates': 'Talerze',
+ '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.': 'Pary każdego rozmiaru, jakie masz. Każdy wiersz serii ładuje się z tej listy, więc domowa siłownia z jedną parą 45-tek nigdy nie usłyszy, żeby użyć dwóch.',
+ 'pairs': 'par',
+ 'Your own list for {0}.': 'Twoja własna lista dla {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'Standardowy zestaw, pod dostatkiem każdego rozmiaru — zmień dowolną liczbę, aby zrobić go swoim.',
+ 'Back to the standard set': 'Wróć do standardowego zestawu',
+ 'Standard set — tap to count the pairs you own.': 'Standardowy zestaw — dotknij, aby policzyć swoje pary.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Nadal zapisujesz ciężar całkowity — to służy tylko do linii z talerzami pod każdą serią.',
'Default for this bar type.': 'Wartość domyślna dla tego typu gryfu.',
'No bar': 'Bez gryfu',
'The weight you log is all plates.': 'Zapisany ciężar to same talerze.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Talerze liczone od 0 — wyłącz, aby wrócić do domyślnego ({0}).',
'Set to 0 to go back to the default ({0}).': 'Ustaw 0, aby wrócić do wartości domyślnej ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Dotyczy tego ćwiczenia wszędzie, nie tylko w tym planie.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Nadal zapisujesz ciężar całkowity — gryf służy tylko do wyliczenia talerzy na stronę.',
// Gym check-in (mobile-only)
'Check in': 'Zamelduj się',
'At the gym': 'Na siłowni',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 087c69641..da7d41b5c 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -625,7 +625,17 @@ export const PT_BR_OVERRIDES = {
'Default for this bar type.': 'Padrão para este tipo de barra.',
'Set to 0 to go back to the default ({0}).': 'Defina 0 para voltar ao padrão ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Vale para este exercício em todos os lugares, não só neste plano.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Você continua registrando o peso total — a barra só entra no cálculo das anilhas por lado.',
+ 'Plate loading': 'Carga de anilhas',
+ 'Plates split over both sides of a bar.': 'Anilhas divididas nos dois lados da barra.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Uma pilha única — um cinto, uma landmine, uma máquina de anilhas, um trenó.',
+ 'No plate line under the sets.': 'Sem linha de anilhas embaixo das séries.',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'A própria máquina ou o trenó, antes de qualquer anilha. 0 se for tudo anilha.',
+ 'Plates': 'Anilhas',
+ '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.': 'Pares de cada tamanho que você tem. Cada linha de série carrega a partir desta lista, então uma academia em casa com apenas um par de anilhas de 45 nunca é instruída a usar duas.',
+ 'Your own list for {0}.': 'Sua lista própria para {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'O conjunto padrão, com fartura de cada — mude qualquer contagem para deixá-lo do seu jeito.',
+ 'Standard set — tap to count the pairs you own.': 'Conjunto padrão — toque para contar os pares que você tem.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Você continua registrando o peso total — isso só alimenta a linha de anilhas embaixo de cada série.',
// Gym check-in (mobile-only) — only where pt-BR differs from pt (inherited via ...pt)
'At the gym': 'Na academia',
'Show this at the gym': 'Mostre isto na academia',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index d07541e8d..2576e441a 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Termina primeiro o treino em curso.',
'Logging a past workout — no rest timers.': 'A registar um treino passado — sem temporizadores de descanso.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Peso da barra',
'Bar ({0})': 'Barra ({0})',
'Bar {0}': 'Barra {0}',
+ 'Plate loading': 'Carga de discos',
+ 'Single stack': 'Pilha única',
+ 'No bar': 'Sem barra',
+ 'Bar only': 'Só a barra',
+ 'Load {0}': 'Carregar {0}',
+ '{0} short': '{0} a menos',
+ 'Plates split over both sides of a bar.': 'Discos divididos pelos dois lados da barra.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Uma pilha única — um cinto, uma landmine, uma máquina de discos, um trenó.',
+ 'No plate line under the sets.': 'Sem linha de discos debaixo das séries.',
+ 'Base weight ({0})': 'Peso base ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'A própria máquina ou o trenó, antes de qualquer disco. 0 se for tudo discos.',
+ 'Plates': 'Discos',
+ '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.': 'Pares de cada tamanho que tens. Cada linha de série carrega a partir desta lista, por isso um ginásio em casa com um só par de 45 nunca é instruído a usar dois.',
+ 'pairs': 'pares',
+ 'Your own list for {0}.': 'A tua lista própria para {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'O conjunto padrão, com fartura de cada — muda qualquer contagem para o tornares teu.',
+ 'Back to the standard set': 'Voltar ao conjunto padrão',
+ 'Standard set — tap to count the pairs you own.': 'Conjunto padrão — toca para contares os pares que tens.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Continuas a registar o peso total — isto só alimenta a linha de discos debaixo de cada série.',
'Default for this bar type.': 'Predefinição para este tipo de barra.',
'No bar': 'Sem barra',
'The weight you log is all plates.': 'O peso que registas são só discos.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Os discos contam a partir de 0 — desliga para o valor predefinido ({0}).',
'Set to 0 to go back to the default ({0}).': 'Coloca 0 para voltar à predefinição ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Aplica-se a este exercício em todo o lado, não só neste plano.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Continuas a registar o peso total — a barra só conta para o cálculo dos discos por lado.',
// Gym check-in (mobile-only)
'Check in': 'Check-in',
'At the gym': 'No ginásio',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index accc919de..d3d083baa 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Сначала заверши текущую тренировку.',
'Logging a past workout — no rest timers.': 'Запись прошлой тренировки — без таймеров отдыха.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Вес грифа',
'Bar ({0})': 'Гриф ({0})',
'Bar {0}': 'Гриф {0}',
+ 'Plate loading': 'Загрузка блинов',
+ 'Single stack': 'В стопку',
+ 'No bar': 'Без грифа',
+ 'Bar only': 'Только гриф',
+ 'Load {0}': 'Загрузить {0}',
+ '{0} short': 'не хватает {0}',
+ 'Plates split over both sides of a bar.': 'Блины распределены по обеим сторонам грифа.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Одна стопка — пояс, лэндмайн, тренажёр под блины, сани.',
+ 'No plate line under the sets.': 'Без строки с блинами под подходами.',
+ 'Base weight ({0})': 'Базовый вес ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'Сам тренажёр или сани, до того как навешен хоть один блин. 0, если это одни блины.',
+ 'Plates': 'Блины',
+ '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.': 'Пары каждого размера, которые у тебя есть. Каждая строка подхода берёт данные из этого списка, поэтому домашнему залу с одной парой блинов по 45 никогда не предложат использовать две.',
+ 'pairs': 'пар',
+ 'Your own list for {0}.': 'Твой собственный список для {0}.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'Стандартный набор, всего с запасом — измени любое количество, чтобы сделать его своим.',
+ 'Back to the standard set': 'Вернуться к стандартному набору',
+ 'Standard set — tap to count the pairs you own.': 'Стандартный набор — нажми, чтобы посчитать свои пары.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Записывается по-прежнему общий вес — это нужно только для строки с блинами под каждым подходом.',
'Default for this bar type.': 'Значение по умолчанию для этого типа грифа.',
'No bar': 'Без грифа',
'The weight you log is all plates.': 'Записанный вес — это только блины.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Блины считаются от 0 — выключи, чтобы вернуть значение по умолчанию ({0}).',
'Set to 0 to go back to the default ({0}).': 'Поставь 0, чтобы вернуться к значению по умолчанию ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Действует для этого упражнения везде, а не только в этом плане.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Записывается по-прежнему общий вес — гриф нужен только для расчёта блинов на сторону.',
// Gym check-in (mobile-only)
'Check in': 'Отметиться',
'At the gym': 'В зале',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index e8fdc2ff5..48351d39c 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -813,16 +813,33 @@ export default {
'Finish the current workout first.': 'จบการฝึกปัจจุบันก่อน',
'Logging a past workout — no rest timers.': 'กำลังบันทึกการฝึกย้อนหลัง — ไม่มีตัวจับเวลาพัก',
// --- bar weight (plate math) ---
- 'Bar weight': 'น้ำหนักบาร์',
'Bar ({0})': 'บาร์ ({0})',
'Bar {0}': 'บาร์ {0}',
+ 'Plate loading': 'การใส่แผ่นน้ำหนัก',
+ 'Single stack': 'กองเดียว',
+ 'No bar': 'ไม่มีบาร์',
+ 'Bar only': 'บาร์เปล่า',
+ 'Load {0}': 'โหลด {0}',
+ '{0} short': 'ขาดอีก {0}',
+ 'Plates split over both sides of a bar.': 'แผ่นน้ำหนักแบ่งใส่ทั้งสองข้างของบาร์',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'กองเดียว — เข็มขัด แลนด์ไมน์ เครื่องที่ใช้แผ่นน้ำหนัก หรือสเลด',
+ 'No plate line under the sets.': 'ไม่มีแถวแผ่นน้ำหนักใต้เซ็ต',
+ 'Base weight ({0})': 'น้ำหนักพื้นฐาน ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'ตัวเครื่องหรือสเลดเอง ก่อนใส่แผ่นน้ำหนักใด ๆ ใส่ 0 ถ้าทั้งหมดเป็นแผ่นน้ำหนัก',
+ 'Plates': 'แผ่นน้ำหนัก',
+ '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.': 'จำนวนคู่ของแต่ละขนาดที่คุณมี ทุกแถวของเซ็ตจะโหลดจากรายการนี้ ดังนั้นโฮมยิมที่มีแผ่น 45 แค่คู่เดียวจะไม่มีวันถูกบอกให้ใช้สองคู่',
+ 'pairs': 'คู่',
+ 'Your own list for {0}.': 'รายการของคุณเองสำหรับ {0}',
+ 'The standard set, plenty of each — change any count to make it yours.': 'ชุดมาตรฐาน มีครบทุกขนาดแบบเหลือเฟือ — เปลี่ยนจำนวนไหนก็ได้เพื่อทำให้เป็นของคุณเอง',
+ 'Back to the standard set': 'กลับไปใช้ชุดมาตรฐาน',
+ 'Standard set — tap to count the pairs you own.': 'ชุดมาตรฐาน — แตะเพื่อนับจำนวนคู่ที่คุณมี',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'คุณยังบันทึกน้ำหนักรวมเหมือนเดิม — ค่านี้ใช้แค่กับแถวแผ่นน้ำหนักใต้แต่ละเซ็ตเท่านั้น',
'Default for this bar type.': 'ค่าเริ่มต้นสำหรับบาร์ชนิดนี้',
'No bar': 'ไม่มีบาร์',
'The weight you log is all plates.': 'น้ำหนักที่บันทึกคือแผ่นทั้งหมด',
'Plates are counted from 0 — turn this off for the default ({0}).': 'นับแผ่นจาก 0 — ปิดเพื่อกลับไปค่าเริ่มต้น ({0})',
'Set to 0 to go back to the default ({0}).': 'ตั้งเป็น 0 เพื่อกลับไปใช้ค่าเริ่มต้น ({0})',
'Applies to this exercise everywhere, not just this plan.': 'มีผลกับท่านี้ทุกที่ ไม่ใช่เฉพาะในแผนนี้',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'คุณยังบันทึกน้ำหนักรวมเหมือนเดิม — บาร์ใช้สำหรับคำนวณแผ่นน้ำหนักต่อข้างเท่านั้น',
// Gym check-in (mobile-only)
'Check in': 'เช็คอิน',
'At the gym': 'ที่ยิม',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 82f934fed..c4ad64efa 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': 'Önce mevcut antrenmanı bitir.',
'Logging a past workout — no rest timers.': 'Geçmiş antrenman kaydediliyor — dinlenme zamanlayıcısı yok.',
// --- bar weight (plate math) ---
- 'Bar weight': 'Bar ağırlığı',
'Bar ({0})': 'Bar ({0})',
'Bar {0}': 'Bar {0}',
+ 'Plate loading': 'Disk yükleme',
+ 'Single stack': 'Tek yığın',
+ 'No bar': 'Bar yok',
+ 'Bar only': 'Sadece bar',
+ 'Load {0}': '{0} yükle',
+ '{0} short': '{0} eksik',
+ 'Plates split over both sides of a bar.': 'Diskler barın iki tarafına paylaştırılır.',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': 'Tek yığın — bir kemer, bir landmine, diskli bir makine, bir kızak.',
+ 'No plate line under the sets.': 'Setlerin altında disk satırı yok.',
+ 'Base weight ({0})': 'Taban ağırlığı ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': 'Herhangi bir disk takılmadan önceki makine veya kızağın kendi ağırlığı. Tamamı diskse 0 yap.',
+ 'Plates': 'Diskler',
+ '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.': 'Sahip olduğun her ebattan çift sayısı. Her set satırı bu listeden yüklenir; bu yüzden yalnızca bir çift 45\'lik diski olan bir ev spor salonundan asla iki tane kullanması istenmez.',
+ 'pairs': 'çift',
+ 'Your own list for {0}.': '{0} için kendi listen.',
+ 'The standard set, plenty of each — change any count to make it yours.': 'Standart set, her birinden bolca — kendine göre yapmak için herhangi bir sayıyı değiştir.',
+ 'Back to the standard set': 'Standart sete dön',
+ 'Standard set — tap to count the pairs you own.': 'Standart set — sahip olduğun çiftleri saymak için dokun.',
+ 'You still log the total weight — this only feeds the plate line under each set.': 'Yine de toplam ağırlığı kaydedersin — bu yalnızca her setin altındaki disk satırına yarar.',
'Default for this bar type.': 'Bu bar türü için varsayılan.',
'No bar': 'Bar yok',
'The weight you log is all plates.': 'Girdiğin ağırlığın tamamı plaka.',
'Plates are counted from 0 — turn this off for the default ({0}).': 'Plakalar 0’dan sayılır — varsayılana ({0}) dönmek için kapat.',
'Set to 0 to go back to the default ({0}).': 'Varsayılana ({0}) dönmek için 0 yap.',
'Applies to this exercise everywhere, not just this plan.': 'Yalnızca bu planda değil, bu egzersiz için her yerde geçerli.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Yine de toplam ağırlığı kaydedersin — bar yalnızca taraf başına plaka hesabına girer.',
// Gym check-in (mobile-only)
'Check in': 'Giriş yap',
'At the gym': 'Salonda',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 7f4492b44..33bec0b0b 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1140,16 +1140,33 @@ export default {
'Finish the current workout first.': '请先完成当前训练。',
'Logging a past workout — no rest timers.': '正在补记过去的训练 — 没有休息计时器。',
// --- bar weight (plate math) ---
- 'Bar weight': '杠铃杆重量',
'Bar ({0})': '杆 ({0})',
'Bar {0}': '杆 {0}',
+ 'Plate loading': '配重',
+ 'Single stack': '单堆',
+ 'No bar': '无杆',
+ 'Bar only': '空杠',
+ 'Load {0}': '加载{0}',
+ '{0} short': '差 {0}',
+ 'Plates split over both sides of a bar.': '杠铃片分装在杆的两侧。',
+ 'One stack — a belt, a landmine, a plate-loaded machine, a sled.': '单堆——腰带、地雷杆、杠铃片机器,或雪橇。',
+ 'No plate line under the sets.': '组数下方不显示杠铃片提示行。',
+ 'Base weight ({0})': '基础重量 ({0})',
+ 'The machine or sled itself, before any plate goes on. 0 if it is all plates.': '机器或雪橇本身的重量,装上任何杠铃片之前。如果全是杠铃片,就填 0。',
+ 'Plates': '杠铃片',
+ '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.': '你拥有的每种重量的对数。每一行组数都从这份清单里取用,所以只有一对 45 的家庭健身房永远不会被要求用两片。',
+ 'pairs': '对',
+ 'Your own list for {0}.': '你自己的 {0} 清单。',
+ 'The standard set, plenty of each — change any count to make it yours.': '标准配置,每种都很充足——改动任意数量,让它变成你自己的。',
+ 'Back to the standard set': '恢复为标准配置',
+ 'Standard set — tap to count the pairs you own.': '标准配置——点按以清点你拥有的对数。',
+ 'You still log the total weight — this only feeds the plate line under each set.': '记录的仍是总重量——这只用于每组下方的杠铃片提示行。',
'Default for this bar type.': '此类杠铃杆的默认值。',
'No bar': '无杠铃杆',
'The weight you log is all plates.': '你记录的重量全部是杠铃片。',
'Plates are counted from 0 — turn this off for the default ({0}).': '杠铃片从 0 开始计算 — 关闭以使用默认值({0})。',
'Set to 0 to go back to the default ({0}).': '设为 0 即恢复默认值({0})。',
'Applies to this exercise everywhere, not just this plan.': '对这个动作处处生效,不只在此计划中。',
- 'You still log the total weight — the bar only feeds the per-side plate math.': '记录的仍是总重量——杆重只用于每侧杠铃片的计算。',
// Gym check-in (mobile-only)
'Check in': '签到',
'At the gym': '在健身房',
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index e484bdf87..990c3e2c3 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -3,9 +3,10 @@ import { useStore } from './store/useStore.js'
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 { 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'
@@ -573,17 +574,34 @@ function GoalSheet({ close }) {
}
export const goalSheet = () => ui().openSheet(close => <GoalSheet close={close} />)
-/* ============================ bar weight ============================ */
-// One editor for every place the bar weight shows up (exercise detail, exercise config,
-// mid-workout sheet): a stepper over the effective value. What it saves is per exercise
-// and lives in S.barWeights, in the profile unit (see lib/bar.js) — stepping or typing
-// down to 0 clears the override and the field falls back to the default for the bar
-// type, the same "0 drops the key" shape a nullable set field has.
-function BarWeightEditor({ ex, extra }) {
+/* ============================ plate loading ============================ */
+// One editor for every place an exercise's loading shows up (exercise detail, exercise config,
+// mid-workout sheet). Three things, all per exercise and display-only (lib/plates.js):
+// • how the weight is loaded — per side of a bar, one stack, or not plate-loaded at all
+// (S.loadKind; absent = derived from the equipment, so most exercises never store it);
+// • the base weight before any plate goes on — the bar (S.barWeights, profile unit, lib/bar.js;
+// stepping down to 0 clears the override and falls back to the bar type's default), or a
+// sled's / machine's own weight for anything else;
+// • "No bar" for a bar exercise: an explicit 0 (issue #138 — a counterbalanced Smith machine),
+// so the whole total is plates. Distinct from the stepper's 0, which means "default".
+// `cfg` is the routine/session config the caller has (its `bodyweight` flag turns a dumbbell
+// exercise into "added weight", i.e. a single stack) — the default kind is derived from the
+// same thing the workout screen derives it from, so what the editor shows as chosen is what
+// the rows do. Without one, the equipment alone decides.
+function BarWeightEditor({ ex, cfg, extra }) {
const st = useStore(s => s.S)
+ const bar = usesBar(ex)
+ const ctx = { ...(cfg || {}), id: ex.id }
+ const kind = loadKindFor(st, ctx)
const explicit = hasBarOverride(st, ex.id)
+ const noBar = bar && isNoBar(st, ex.id)
const def = defaultBarWeight(ex.eq, st.unit)
- const noBar = isNoBar(st, ex.id)
+ const base = baseWeightFor(st, ex)
+ const setKind = k => update(s => {
+ s.loadKind = s.loadKind || {}
+ // Picking what the equipment already implies stores nothing.
+ if (k === loadKindFor(null, ctx)) delete s.loadKind[ex.id]; else s.loadKind[ex.id] = k
+ })
const setBar = v => update(s => {
s.barWeights = s.barWeights || {}
const n = Math.max(0, Math.round((v || 0) * 100) / 100)
@@ -597,34 +615,76 @@ function BarWeightEditor({ ex, extra }) {
if (on) s.barWeights[ex.id] = 0; else delete s.barWeights[ex.id]
})
return <>
- {!noBar && <div className="row cfgrow" style={{ marginBottom: 6 }}>
- <Stepper label={t('Bar ({0})', st.unit)} value={barWeightFor(st, ex) || 0} step={2.5} onChange={setBar} />
- </div>}
- <div className="list menu-list" style={{ marginBottom: 6 }}>
- <Row icon="barbell" title={t('No bar')} subtitle={t('The weight you log is all plates.')}>
- <Switch checked={noBar} onChange={setNoBar} />
- </Row>
- </div>
- <div className="small dim" style={{ marginBottom: 18 }}>
- {noBar ? t('Plates are counted from 0 — turn this off for the default ({0}).', fmtNum(def) + ' ' + st.unit)
- : explicit ? t('Set to 0 to go back to the default ({0}).', fmtNum(def) + ' ' + st.unit)
- : t('Default for this bar type.')}
- {extra ? ' ' + extra : ''}
+ <Segmented className="seg-inline" value={kind} onChange={setKind}
+ options={[{ value: 'pairs', label: t('Per side') }, { value: 'single', label: t('Single stack') }, { value: 'none', label: t('Off') }]} />
+ <div className="small dim" style={{ margin: '8px 0 12px' }}>
+ {kind === 'pairs' ? t('Plates split over both sides of a bar.')
+ : kind === 'single' ? t('One stack — a belt, a landmine, a plate-loaded machine, a sled.')
+ : t('No plate line under the sets.')}
</div>
+ {kind !== 'none' && <>
+ {bar && <div className="list menu-list" style={{ marginBottom: 6 }}>
+ <Row icon="barbell" title={t('No bar')} subtitle={t('The weight you log is all plates.')}>
+ <Switch checked={noBar} onChange={setNoBar} />
+ </Row>
+ </div>}
+ {!noBar && <div className="row cfgrow" style={{ marginBottom: 6 }}>
+ <Stepper label={bar ? t('Bar ({0})', st.unit) : t('Base weight ({0})', st.unit)} value={base} step={2.5} onChange={setBar} />
+ </div>}
+ <div className="small dim" style={{ marginBottom: 18 }}>
+ {noBar ? t('Plates are counted from 0 — turn this off for the default ({0}).', fmtNum(def) + ' ' + st.unit)
+ : bar ? (explicit ? t('Set to 0 to go back to the default ({0}).', fmtNum(def) + ' ' + st.unit) : t('Default for this bar type.'))
+ : t('The machine or sled itself, before any plate goes on. 0 if it is all plates.')}
+ {extra ? ' ' + extra : ''}
+ </div>
+ </>}
</>
}
-// 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>
- <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 => ui().openSheet(close => <BarWeightSheet exId={exId} close={close} />)
+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>
+ </>
+}
+export const plateInventorySheet = () => ui().openSheet(close => <PlateInventorySheet close={close} />)
/* ============================ exercise detail ============================ */
// Estimated 1RM for one exercise (issue #18): what the log already implies, plus a calculator
@@ -688,9 +748,9 @@ function ExerciseDetail({ ex, close }) {
<Button icon="pencil" style={{ flex: 1 }} onClick={() => { close(); customExSheet(ex) }}>{t('Edit')}</Button>
<Button variant="danger" icon="trash" style={{ flex: 1 }} onClick={() => deleteCustomEx(ex, close)}>{t('Delete')}</Button>
</div>}
- {usesBar(ex) && <>
- <h4 className="sec">{t('Bar weight')}</h4>
- <BarWeightEditor ex={ex} extra={t('You still log the total weight — the bar only feeds the per-side plate math.')} />
+ {modeOf({ id: ex.id }) === 'reps' && <>
+ <h4 className="sec">{t('Plate loading')}</h4>
+ <BarWeightEditor ex={ex} extra={t('You still log the total weight — this only feeds the plate line under each set.')} />
</>}
{/* No one-rep max on an assistance machine: the load is the help you were given, so the
calculator would answer "your 1RM is 23 kg" about a number that gets smaller as you get
@@ -1404,11 +1464,11 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
: t('Every set becomes rest-pause: {0} reps to start, then {1} more split into short bursts, {2}s rest before each, roughly halving each time.', c.reps || 0, c.intensifier.totalReps, c.intensifier.restSec)}
</div>}
</>}
- {/* The bar's own weight, for the plate math — per exercise, not per plan, so it sits
- apart from the config fields above and writes straight to S.barWeights. */}
- {usesBar(ex) && <>
- <h4 className="sec">{t('Bar weight')}</h4>
- <BarWeightEditor ex={ex} extra={t('Applies to this exercise everywhere, not just this plan.')} />
+ {/* How the weight is plate-loaded and what the bar weighs — per exercise, not per plan, so
+ it sits apart from the config fields above and writes straight to S.barWeights/S.loadKind. */}
+ {mode === 'reps' && <>
+ <h4 className="sec">{t('Plate loading')}</h4>
+ <BarWeightEditor ex={ex} cfg={c} extra={t('Applies to this exercise everywhere, not just this plan.')} />
</>}
<ProgressionFields ex={ex} mode={mode} c={c} setC={setC} routine={routine} unit={st.unit} perSide={perSide} />
<textarea className="input" rows={3} maxLength={500} style={{ marginBottom: 18 }}
diff --git a/frontend/src/sheets.plates.test.jsx b/frontend/src/sheets.plates.test.jsx
new file mode 100644
index 000000000..6f4dff3a4
--- /dev/null
+++ b/frontend/src/sheets.plates.test.jsx
@@ -0,0 +1,159 @@
+// @vitest-environment happy-dom
+// The plate-loading editor (barWeightSheet) and the plate inventory sheet write S.loadKind,
+// S.barWeights and S.plates the way lib/plates.js reads them.
+import React, { act } from 'react'
+import { afterEach, beforeEach, describe, expect, it } from 'vitest'
+import { createRoot } from 'react-dom/client'
+import { useStore, DEF } from './store/useStore.js'
+import { useUI } from './store/useUI.js'
+import { barWeightSheet, plateInventorySheet } from './sheets.jsx'
+import { EXIDX } from './lib/exercises.js'
+
+const SQUAT = '0043' // barbell
+const COCOONS = '0260' // body weight
+const LEG_PRESS = EXIDX['0585'] ? '0585' : Object.values(EXIDX).find(e => e.eq === 'leverage machine').id
+
+const mounted = []
+function mountTopSheet() {
+ const sheet = useUI.getState().sheets.at(-1)
+ const host = document.createElement('div')
+ document.body.appendChild(host)
+ const root = createRoot(host)
+ mounted.push(root)
+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
+ return host
+}
+const S = () => useStore.getState().S
+const segButton = (host, text) => [...host.querySelectorAll('.seg button')].find(b => b.textContent.trim() === text)
+const button = (host, text) => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === text)
+// A labelled Stepper is .stp-w > .stp-l (label) + .stp (Decrease, value input, Increase).
+const stepperOf = (host, label) => [...host.querySelectorAll('.stp-w')].find(el => el.querySelector('.stp-l')?.textContent.trim() === label)
+const valueOf = st => st.querySelector('input').value
+const dec = st => st.querySelector('[aria-label="Decrease"]')
+const inc = st => st.querySelector('[aria-label="Increase"]')
+
+describe('plate loading editor', () => {
+ beforeEach(() => {
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true
+ useUI.setState({ sheets: [], toasts: [] })
+ useStore.setState({ S: { ...JSON.parse(JSON.stringify(DEF)), unit: 'lb' }, user: null })
+ document.body.innerHTML = ''
+ })
+ afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })
+
+ it('the exercises used here are what the test assumes', () => {
+ expect(EXIDX[SQUAT].eq).toBe('barbell')
+ expect(EXIDX[LEG_PRESS].eq).toBe('leverage machine')
+ expect(EXIDX[COCOONS].eq).toBe('body weight')
+ })
+
+ it('the editor derives its default from the same config the workout rows use', () => {
+ // A body-weight exercise a routine runs as a weighted lift (bodyweight: false): the rows
+ // show no line, so the editor must show Off — and picking Single stack must stick.
+ act(() => barWeightSheet(COCOONS, { id: COCOONS, bodyweight: false }))
+ const host = mountTopSheet()
+ expect(segButton(host, 'Off').classList.contains('on')).toBe(true)
+ act(() => segButton(host, 'Single stack').click())
+ expect(S().loadKind[COCOONS]).toBe('single')
+ // Without a config the equipment decides: body weight → single stack by default.
+ useStore.setState(s => ({ S: { ...s.S, loadKind: {} } }))
+ act(() => barWeightSheet(COCOONS))
+ const host2 = mountTopSheet()
+ expect(segButton(host2, 'Single stack').classList.contains('on')).toBe(true)
+ })
+
+ it('a barbell defaults to per side and stores nothing until you pick something else', () => {
+ act(() => barWeightSheet(SQUAT))
+ const host = mountTopSheet()
+ expect(host.querySelector('h3').textContent).toBe('Plate loading')
+ expect(segButton(host, 'Per side').classList.contains('on')).toBe(true)
+ expect(S().loadKind).toEqual({})
+ act(() => segButton(host, 'Single stack').click())
+ expect(S().loadKind[SQUAT]).toBe('single')
+ act(() => segButton(host, 'Per side').click())
+ expect(S().loadKind[SQUAT]).toBeUndefined() // back to what the equipment implies → key dropped
+ act(() => segButton(host, 'Off').click())
+ expect(S().loadKind[SQUAT]).toBe('none')
+ expect(host.textContent).toContain('No plate line under the sets.')
+ })
+
+ it('"No bar" is an explicit 0 in barWeights; off again deletes it', () => {
+ act(() => barWeightSheet(SQUAT))
+ const host = mountTopSheet()
+ const sw = host.querySelector('.switch, [role="switch"], input[type="checkbox"]')
+ expect(sw).toBeTruthy()
+ act(() => sw.click())
+ expect(S().barWeights[SQUAT]).toBe(0)
+ expect(host.textContent).toContain('Plates are counted from 0')
+ expect(host.textContent).not.toContain('Bar (lb)') // the stepper is gone while there is no bar
+ act(() => host.querySelector('.switch, [role="switch"], input[type="checkbox"]').click())
+ expect(S().barWeights[SQUAT]).toBeUndefined()
+ })
+
+ it('the bar stepper writes the override; stepping to 0 falls back to the default', () => {
+ act(() => barWeightSheet(SQUAT))
+ const host = mountTopSheet()
+ const st = stepperOf(host, 'Bar (lb)')
+ expect(st).toBeTruthy()
+ expect(valueOf(st)).toBe('45')
+ act(() => inc(st).click())
+ expect(S().barWeights[SQUAT]).toBe(47.5)
+ for (let i = 0; i < 19; i++) act(() => dec(stepperOf(host, 'Bar (lb)')).click())
+ expect(S().barWeights[SQUAT]).toBeUndefined()
+ expect(valueOf(stepperOf(host, 'Bar (lb)'))).toBe('45')
+ expect(host.textContent).toContain('Default for this bar type.')
+ })
+
+ it('a machine can be made a single stack with its own base weight', () => {
+ act(() => barWeightSheet(LEG_PRESS))
+ const host = mountTopSheet()
+ expect(segButton(host, 'Off').classList.contains('on')).toBe(true)
+ act(() => segButton(host, 'Single stack').click())
+ expect(S().loadKind[LEG_PRESS]).toBe('single')
+ const st = stepperOf(host, 'Base weight (lb)')
+ expect(st).toBeTruthy()
+ expect(host.textContent).not.toContain('No bar')
+ expect(valueOf(st)).toBe('0')
+ act(() => inc(st).click())
+ expect(S().barWeights[LEG_PRESS]).toBe(2.5)
+ })
+})
+
+describe('plate inventory sheet', () => {
+ beforeEach(() => {
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true
+ useUI.setState({ sheets: [], toasts: [] })
+ useStore.setState({ S: { ...JSON.parse(JSON.stringify(DEF)), unit: 'lb' }, user: null })
+ document.body.innerHTML = ''
+ })
+ afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })
+
+ it('lists every lb size with the standard count; the first edit copies the set and changes one count', () => {
+ act(() => plateInventorySheet())
+ const host = mountTopSheet()
+ expect(host.querySelector('h3').textContent).toBe('Plates')
+ for (const w of ['45 lb', '35 lb', '25 lb', '15 lb', '10 lb', '5 lb', '2.5 lb', '1.25 lb']) expect(stepperOf(host, w), w).toBeTruthy()
+ expect(valueOf(stepperOf(host, '45 lb'))).toBe('6')
+ expect(valueOf(stepperOf(host, '15 lb'))).toBe('0') // not in the standard set
+ expect(stepperOf(host, '45 lb').textContent).toContain('pairs')
+ expect(S().plates).toEqual({})
+ for (let i = 0; i < 5; i++) act(() => dec(stepperOf(host, '45 lb')).click())
+ expect(S().plates.lb[45]).toBe(1)
+ expect(S().plates.lb[35]).toBe(6) // the rest of the standard set came along
+ expect(S().plates.lb[15]).toBeUndefined()
+ act(() => inc(stepperOf(host, '15 lb')).click())
+ expect(S().plates.lb[15]).toBe(1)
+ expect(valueOf(stepperOf(host, '45 lb'))).toBe('1')
+ expect(S().plates.kg).toBeUndefined() // the other unit is untouched
+ expect(host.textContent).toContain('Your own list for lb.')
+ })
+
+ it('"Back to the standard set" drops the unit\'s own list', () => {
+ useStore.setState(s => ({ S: { ...s.S, plates: { lb: { 45: 1 }, kg: { 20: 2 } } } }))
+ act(() => plateInventorySheet())
+ const host = mountTopSheet()
+ act(() => button(host, 'Back to the standard set').click())
+ expect(S().plates).toEqual({ kg: { 20: 2 } })
+ expect(button(host, 'Back to the standard set')).toBeUndefined()
+ })
+})
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index 00fc90d83..a2891efd5 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -62,6 +62,15 @@ export const DEF = {
// lib/bar.js). Personal equipment, so it syncs with the account but never travels in a
// shared plan. Logged weights stay the total — this only feeds the plate math.
barWeights: {},
+ // Plate inventory, per unit: { lb: { 45: 1, 35: 1, … }, kg: { … } } — pairs of each size you
+ // own (lib/plates.js). Kept per unit like the bar weight: a 45 lb plate is not a 20.4 kg
+ // one, so a unit switch shows the other unit's inventory instead of converting this one.
+ // Absent for a unit = the standard set, plenty of each. Display only, like barWeights.
+ plates: {},
+ // How an exercise is plate-loaded when the equipment does not say: 'pairs' | 'single' |
+ // 'none', keyed by exercise id (lib/plates.js loadKindFor). A plate-loaded leg press is
+ // 'single'; a barbell you never load plates on is 'none'. Absent = derived from equipment.
+ loadKind: {},
// Gym check-in cards (see views/CheckIn.jsx). Each is a membership
// code shown as a QR/barcode at the gym's turnstile — added by typing it, importing a photo
// of the card, or scanning it. We only ever keep the code's VALUE, never a photo: the image
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index 993c0373d..6dc4dd733 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -4,7 +4,8 @@ import { useStore, DEF, hasData } from '../store/useStore.js'
import { workoutControls } from '../lib/workout-controls.js'
import { convertStateUnit } from '../lib/units.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'
@@ -16,7 +17,7 @@ import { MOBILE, isAndroid, shareExport, syncReminder } from '../lib/mobile.js'
import { checkForUpdate, downloadAndInstall } from '../lib/update.js'
import { forgetCoach } from '../lib/coach-api.js'
import { ConnectSheet } from './MobileOnboarding.jsx'
-import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, menuSheet, askAddDeviceData } from '../sheets.jsx'
+import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, menuSheet, askAddDeviceData } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Section, Row, SelectRow, Switch, Segmented, Button, TextField } from '../components/ui.jsx'
@@ -642,7 +643,14 @@ function EquipmentCard({ S, update }) {
if (s.activeEquipId === p.id) s.activeEquipId = (s.equipProfiles[0] && s.equipProfiles[0].id) || null
}),
})
+ // The plates you own, per unit (lib/plates.js) — what the set rows' plate lines load from.
+ const unit = S.unit === 'lb' ? 'lb' : 'kg'
+ const ownPlates = !!S.plates?.[unit]
+ const plateSummary = ownPlates
+ ? inventoryFor(S).map(p => fmtPlate(p.w) + '×' + p.n).join(' · ') || t('None')
+ : t('Standard set — tap to count the pairs you own.')
return <Section title={t('Equipment')} footer={t('Filters the exercise library and picker, and flags routine exercises that need something you don’t have in the active profile.')}>
+ <Row icon="plate" iconTint="var(--orange)" title={t('Plates')} subtitle={plateSummary} accessory="chevron" onClick={() => plateInventorySheet()} />
{profiles.length > 0 && <Row icon="dumbbell" iconTint="var(--acc)" title={t('Filter by equipment')}>
<Switch checked={!!S.equipFilterOn} onChange={v => update(s => { s.equipFilterOn = v })} />
</Row>}
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index bed11c5e8..ef952388d 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -1,12 +1,13 @@
-import { useEffect, useRef, useState } from 'react'
+import { Fragment, useEffect, useRef, useState } from 'react'
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 { fmtNum, capWords, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
+import { fmtNum, fmtPlate, capWords, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
import { beep, vibrate, unlock } from '../lib/sound.js'
import { t, exerciseNameFor } from '../lib/i18n.js'
import { api, appBase } from '../lib/api.js'
@@ -202,18 +203,49 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
// 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 = (!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
+ // 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 and gets
+ // no line. Only reps mode has a weight to load. 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 base = baseWeightFor(S, entry.id)
+ const loadSeq = loadKind === 'none' ? [] : (() => {
+ const inv = inventoryFor(S)
+ const out = []
+ entry.sets.forEach((s, i) => {
+ if (perSide && isSideSet(s)) return
+ out.push({ key: String(i), load: rowLoad(loadKind, s.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
+ 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>
+ }
const openMore = () => menuSheet({
title: exerciseNameFor(ex),
items: [
@@ -221,7 +253,7 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
{ 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 },
- barInfo && { icon: 'barbell', label: t('Bar weight'), sub: barInfo.text, onClick: () => barWeightSheet(entry.id) },
+ mode === 'reps' && { 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 },
@@ -404,13 +436,6 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
</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>}
- {/* 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 && <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'} />
@@ -455,6 +480,7 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
<Check checked={s.done} onChange={() => onToggle(i)} />
</div>
)}
+ {loadLine(String(i))}
{/* Drop-sets and rest-pause bursts extend this same row — no long rest, no new set.
A planned exercise arrives with these already filled in (applyIntensifierPlan);
every value here is just as editable as the main row's own weight/reps. */}
@@ -466,7 +492,7 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
{miniStepper(d.r, 1, false, v => setDropField(i, di, 'r', v))}
<button className="iconbtn" aria-label={t('Remove drop')} onClick={() => removeDrop(i, di)}><Icon name="xmark" /></button>
</div>
- ))}
+ )).flatMap((el, di) => [el, <Fragment key={'dl' + di}>{loadLine(i + ':d' + di)}</Fragment>])}
{clustersOf(s).map((c, ci) => (
<div className="subrow" key={'c' + ci}>
<span className="subn">{t('Burst {0}', ci + 1)}</span>
diff --git a/frontend/src/views/Workout.plates.test.jsx b/frontend/src/views/Workout.plates.test.jsx
new file mode 100644
index 000000000..f14d4af61
--- /dev/null
+++ b/frontend/src/views/Workout.plates.test.jsx
@@ -0,0 +1,153 @@
+// @vitest-environment happy-dom
+// The plate line under a set row (lib/plates.js via Workout.jsx loadLine): which plates make
+// this row's weight, shown where the stack changes and once for a run of equal weights.
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { MemoryRouter } from 'react-router-dom'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import Workout from './Workout.jsx'
+import { DEF, useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { EXIDX } from '../lib/exercises.js'
+
+vi.mock('../lib/sound.js', () => ({ beep: vi.fn(), vibrate: vi.fn(), unlock: vi.fn(), restOver: vi.fn() }))
+vi.mock('../lib/api.js', () => ({ api: vi.fn(() => Promise.resolve({})) }))
+
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+const clone = value => JSON.parse(JSON.stringify(value))
+
+const SQUAT = '0043' // barbell full squat
+const DB_BENCH = '0289' // dumbbell bench press
+const COCOONS = '0260' // body weight, done here with +25
+// One pair of each — the home gym the coach plans for.
+const HOME = { 45: 1, 35: 1, 25: 1, 15: 1, 10: 1, 5: 1, 2.5: 1 }
+
+const warm = w => ({ w, r: 6, done: false, phase: 'warmup' })
+const work = w => ({ w, r: 6, done: false })
+const entry = (id, sets, target = {}) => ({ id, target: { sets: sets.length, reps: 6, ...target }, sets })
+
+let root, container
+
+beforeEach(() => {
+ useUI.setState({ sheets: [], toastMsg: '', timer: null, work: null })
+})
+afterEach(() => {
+ if (root) act(() => root.unmount())
+ if (container) container.remove()
+ root = container = null
+})
+
+function mount(entries, patch = {}) {
+ const S = clone(DEF)
+ S.unit = 'lb'
+ S.plates = { lb: HOME }
+ S.workoutView = 'list'
+ Object.assign(S, patch)
+ S.active = { id: 'plates-test', d: '2026-09-14', start: Date.now(), routineId: null, name: 'Plates', bw: null, cur: 0, entries, workoutView: S.workoutView }
+ useStore.setState({ S, user: null })
+ container = document.createElement('div')
+ document.body.appendChild(container)
+ root = createRoot(container)
+ act(() => root.render(<MemoryRouter><Workout /></MemoryRouter>))
+}
+
+const lines = () => [...container.querySelectorAll('.plateline')].map(el => ({
+ text: el.querySelector('span').textContent,
+ moves: el.querySelector('.moves')?.textContent ?? null,
+}))
+
+describe('plate line under set rows', () => {
+ it('the exercises used here are what the test assumes', () => {
+ expect(EXIDX[SQUAT].eq).toBe('barbell')
+ expect(EXIDX[DB_BENCH].eq).toBe('dumbbell')
+ expect(EXIDX[COCOONS].eq).toBe('body weight')
+ })
+
+ it("Monday's squat ramp: a line where the stack changes, once for the three work sets", () => {
+ mount([entry(SQUAT, [warm(70), warm(100), warm(120), work(145), work(145), work(145)], { w: 145 })])
+ expect(lines()).toEqual([
+ { text: '10 · 2.5 per side', moves: null },
+ { text: '25 · 2.5 per side', moves: '−10 +25' },
+ { text: '35 · 2.5 per side', moves: '−25 +35' },
+ { text: '45 · 5 per side', moves: '−35 −2.5 +45 +5' },
+ ])
+ // The line sits under its own row: six set rows, four lines, the last two rows bare.
+ expect(container.querySelectorAll('.setrow').length).toBe(6)
+ })
+
+ it('the empty bar is "Bar only"; the first plates after it are all adds', () => {
+ mount([entry(SQUAT, [warm(45), work(95), work(95)], { w: 95 })])
+ expect(lines()).toEqual([
+ { text: 'Bar only', moves: null },
+ { text: '25 per side', moves: '+25' },
+ ])
+ })
+
+ it('what the inventory cannot make says how much is short', () => {
+ mount([entry(SQUAT, [work(70)], { w: 70 })], { plates: { lb: { 45: 1, 10: 1 } } })
+ expect(lines()).toEqual([{ text: '10 per side · 2.5 lb short', moves: null }])
+ expect(container.querySelector('.plateline .short').textContent).toBe('2.5 lb short')
+ })
+
+ it('"no bar" (an explicit 0) loads the whole total', () => {
+ mount([entry(SQUAT, [work(90)], { w: 90 })], { barWeights: { [SQUAT]: 0 } })
+ expect(lines()).toEqual([{ text: '45 per side', moves: null }])
+ })
+
+ it('a body-weight exercise with added weight is one stack; a dumbbell gets no line', () => {
+ mount([
+ entry(COCOONS, [work(25), work(25)], { w: 25 }),
+ entry(DB_BENCH, [work(25), work(25)], { w: 25 }),
+ ])
+ expect(lines()).toEqual([{ text: 'Load 25', moves: null }])
+ })
+
+ it('a body-weight exercise without added weight has no line at all', () => {
+ mount([entry(COCOONS, [work(0), work(0)])])
+ expect(lines()).toEqual([])
+ })
+
+ it('a drop set is a weight change too: its line sits under the drop row and the next set restacks', () => {
+ const dropped = { w: 145, r: 6, done: false, type: 'dropset', drops: [{ w: 115, r: 8 }] }
+ mount([entry(SQUAT, [dropped, work(145)], { w: 145 })])
+ expect(lines()).toEqual([
+ { text: '45 · 5 per side', moves: null },
+ { text: '35 per side', moves: '−45 −5 +35' },
+ { text: '45 · 5 per side', moves: '−35 +45 +5' },
+ ])
+ // The drop's line follows its sub-row, not the main row.
+ const sub = container.querySelector('.subrow')
+ expect(sub.nextElementSibling.classList.contains('plateline')).toBe(true)
+ })
+
+ it('a single stack the inventory cannot make says how much is short', () => {
+ mount([entry(COCOONS, [work(30)], { w: 30 })], { plates: { lb: { 25: 1 } } })
+ expect(lines()).toEqual([{ text: 'Load 25 · 5 lb short', moves: null }])
+ })
+
+ it('the compact view keeps the stacks and drops the strip/add moves', () => {
+ mount([entry(SQUAT, [warm(70), warm(100), work(145)], { w: 145 })], { workoutView: 'compact' })
+ expect(lines()).toEqual([
+ { text: '10 · 2.5 per side', moves: null },
+ { text: '25 · 2.5 per side', moves: null },
+ { text: '45 · 5 per side', moves: null },
+ ])
+ })
+
+ it('the ⋯ menu offers Plate loading with the bar as its summary', () => {
+ mount([entry(SQUAT, [work(145)], { w: 145 })])
+ const more = [...container.querySelectorAll('button')].find(b => (b.getAttribute('aria-label') || b.title || '') === 'More' && !b.classList.contains('n'))
+ expect(more).toBeTruthy()
+ act(() => more.click())
+ const sheet = useUI.getState().sheets.at(-1)
+ expect(sheet).toBeTruthy()
+ const sc = document.createElement('div')
+ document.body.appendChild(sc)
+ const sr = createRoot(sc)
+ act(() => sr.render(sheet.render(() => {})))
+ const item = [...sc.querySelectorAll('.menu-item')].find(b => b.textContent.includes('Plate loading'))
+ expect(item).toBeTruthy()
+ expect(item.textContent).toContain('Bar 45 lb')
+ act(() => sr.unmount()); sc.remove()
+ })
+})