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.

feat(dumbbells): progression, deloads, warm-ups and the stepper snap to the dumbbells you own (#376)

Duarte Santos5f90381ff079
diff --git a/api/sync-stamps.js b/api/sync-stamps.js
index 40537ab6c..a8303b1dd 100644
--- a/api/sync-stamps.js
+++ b/api/sync-stamps.js
@@ -64,7 +64,7 @@ const capStamps = m => {
const OWN_MERGE = new Set([
'_ts', '_rev', '_wid', '_wids', '_unstamped', '_prior', 'active', 'unit', 'unitSet', 'resetAt', 'resetIds', 'deleted', 'edited', 'undone', 'routineOrder',
'workouts', 'routines', 'customEx', 'equipProfiles', 'gymCards', 'bodyweight', 'measurements', 'favEx',
- 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad',
+ 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells',
]);
const PER_KEY = new Set(['week', 'dayPlan', 'exNotes', 'barWeights']);
const ENTRY_META = new Set(['id', '_ts', '_f', '_u']);
@@ -111,7 +111,7 @@ export function highestStamp(S) {
if (isMap(x._f)) for (const v of Object.values(x._f)) see(v);
}
}
- for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad']) {
+ for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']) {
if (isMap(S[f])) for (const v of Object.values(S[f])) see(isMap(v) ? v._ts : 0);
}
return m;
diff --git a/frontend/src/lib/dumbbell-inventory.test.js b/frontend/src/lib/dumbbell-inventory.test.js
new file mode 100644
index 000000000..9af7f6327
--- /dev/null
+++ b/frontend/src/lib/dumbbell-inventory.test.js
@@ -0,0 +1,193 @@
+// The dumbbells you own (issue #376): a per-unit list that progression, deloads, warm-ups, drops
+// and the stepper of dumbbell lifts snap to. Without one, everything stays on the increment.
+import { describe, expect, it } from 'vitest'
+import {
+ presetWeights, cleanWeights, dumbbellsOf, ownsDumbbells, withDumbbells, ownedWeightsFor,
+ ownedUp, ownedDown, ownedFloor, stepOwned, ownedDeload, ownedAround, withDbLoad,
+} from './dumbbells.js'
+import { nextPrescription, selectDeloadCandidate } from './progression.js'
+import { buildPlannedEntry } from './session-start.js'
+import { dropGrid } from './plates.js'
+import { nextDropWeight } from './workout-model.js'
+import { mergeStates } from './sync-merge.js'
+import { EXIDX } from './exercises.js'
+
+const CURL = '0294' // dumbbell biceps curl
+const BENCH = '0289' // dumbbell bench press
+const ROW = '0292' // dumbbell one arm bent-over row
+const KB = '0517' // kettlebell
+const SQUAT = '0043' // barbell
+// The adjustable set from the issue: irregular steps no increment fits.
+const RACK = [3, 6, 8, 9, 11, 13, 15, 17, 18, 19, 21, 24]
+
+const state = (workouts = [], extra = {}) => ({ unit: 'kg', workouts, routines: [], exWeights: {}, dumbbells: { kg: { weights: RACK, _ts: 1 } }, ...extra })
+const session = (d, id, w, reps, target = {}) => ({
+ id: 'w' + d, d, start: new Date(d + 'T10:00:00').getTime(),
+ entries: [{ id, target: { sets: 2, reps: 8, mode: 'reps', ...target }, sets: reps.map(r => ({ w, r, done: true })) }],
+})
+const cfg = (id, extra = {}) => ({ id, sets: 2, reps: 8, weight: 0, mode: 'reps', inc: 2, ...extra })
+
+describe('the inventory', () => {
+ it('the exercises used here are what the test assumes', () => {
+ expect(EXIDX[CURL].eq).toBe('dumbbell')
+ expect(EXIDX[BENCH].eq).toBe('dumbbell')
+ expect(EXIDX[ROW].n).toMatch(/one arm/)
+ expect(EXIDX[KB].eq).toBe('kettlebell')
+ expect(EXIDX[SQUAT].eq).toBe('barbell')
+ })
+
+ it('offers the usual racks as quick fills', () => {
+ const kg = presetWeights('kg')
+ expect(kg[0]).toBe(2)
+ expect(kg.at(-1)).toBe(50)
+ expect(kg).toHaveLength(25)
+ const lb = presetWeights('lb')
+ expect([lb[0], lb[1], lb.at(-1)]).toEqual([5, 10, 100])
+ })
+
+ it('is kept per unit, sorted, without doubles or junk, and stamped', () => {
+ expect(cleanWeights([9, '3', 9, -1, 0, 'x', 6.5])).toEqual([3, 6.5, 9])
+ const S = { unit: 'kg', dumbbells: { lb: { weights: [5, 10], _ts: 1 } } }
+ const next = withDumbbells(S, [21, 3, 9], 7)
+ expect(next.kg).toEqual({ weights: [3, 9, 21], _ts: 7 })
+ expect(next.lb).toEqual({ weights: [5, 10], _ts: 1 })
+ expect(dumbbellsOf({ ...S, dumbbells: next })).toEqual([3, 9, 21])
+ // An empty list is no inventory again, stamped so the clear wins a sync too.
+ const cleared = withDumbbells({ ...S, dumbbells: next }, [], 8)
+ expect(cleared.kg).toEqual({ weights: [], _ts: 8 })
+ expect(ownsDumbbells({ unit: 'kg', dumbbells: cleared })).toBe(false)
+ // A profile switched to lb sees its lb list, not a conversion of the kg one.
+ expect(dumbbellsOf({ unit: 'lb', dumbbells: next })).toEqual([5, 10])
+ })
+
+ it('applies to loaded dumbbell lifts only', () => {
+ const S = state()
+ expect(ownedWeightsFor(S, { id: CURL })).toEqual(RACK)
+ expect(ownedWeightsFor(state([], { dumbbells: {} }), { id: CURL })).toBe(null)
+ expect(ownedWeightsFor(S, { id: SQUAT })).toBe(null)
+ expect(ownedWeightsFor(S, { id: KB })).toBe(null)
+ expect(ownedWeightsFor(S, { id: CURL, bodyweight: true })).toBe(null)
+ })
+
+ it('moves in pairs when two bells are logged together', () => {
+ const S = state([], { dbLoad: withDbLoad({}, BENCH, 'total', 1) })
+ expect(ownedWeightsFor(S, { id: BENCH })).toEqual(RACK.map(w => w * 2))
+ expect(ownedWeightsFor(S, { id: BENCH, dbLoad: 'each' })).toEqual(RACK)
+ // One arm holds one bell, whatever the meaning.
+ expect(ownedWeightsFor(S, { id: ROW, dbLoad: 'total' })).toEqual(RACK)
+ })
+})
+
+describe('walking the list', () => {
+ it('finds the neighbours, from on and off the list', () => {
+ expect(ownedUp(RACK, 21)).toBe(24)
+ expect(ownedUp(RACK, 10)).toBe(11)
+ expect(ownedUp(RACK, 9, 2)).toBe(13)
+ expect(ownedUp(RACK, 24)).toBe(null)
+ expect(ownedDown(RACK, 9)).toBe(8)
+ expect(ownedDown(RACK, 3)).toBe(null)
+ expect(ownedFloor(RACK, 10.5)).toBe(9)
+ expect(ownedFloor(RACK, 1)).toBe(3)
+ })
+
+ it('steps like a stepper and stops at either end', () => {
+ expect(stepOwned(RACK, 6, 1)).toBe(8)
+ expect(stepOwned(RACK, 6, -1)).toBe(3)
+ expect(stepOwned(RACK, 24, 1)).toBe(24)
+ expect(stepOwned(RACK, 3, -1)).toBe(3)
+ expect(stepOwned(RACK, 10, 1)).toBe(11)
+ expect(stepOwned(RACK, 10, -1)).toBe(9)
+ })
+
+ it('deloads to the owned bell nearest the target, below the current one', () => {
+ expect(ownedDeload(RACK, 21, 0.9)).toBe(19)
+ expect(ownedDeload(RACK, 3, 0.9)).toBe(3)
+ expect(ownedAround(10, RACK, 21, true)).toEqual([9, 11])
+ expect(ownedAround(22, RACK, 21, true)).toEqual([19])
+ })
+})
+
+describe('progression over owned dumbbells', () => {
+ it('raises to the next bell, not to the next step of the increment', () => {
+ const S = state([session('2026-10-01', CURL, 21, [8, 8])])
+ const p = nextPrescription(S, cfg(CURL), null)
+ expect(p.kind).toBe('up')
+ expect(p.weight).toBe(24)
+ expect(p.why[1]).toBe(3)
+ })
+
+ it('without a list, the increment decides as before', () => {
+ const S = state([session('2026-10-01', CURL, 21, [8, 8])], { dumbbells: {} })
+ expect(nextPrescription(S, cfg(CURL), null).weight).toBe(23)
+ })
+
+ it('goes from an off-list weight to the nearest bell up', () => {
+ const S = state([session('2026-10-01', CURL, 10, [8, 8])])
+ expect(nextPrescription(S, cfg(CURL), null).weight).toBe(11)
+ })
+
+ it('holds at the heaviest bell and says so', () => {
+ const S = state([session('2026-10-01', CURL, 24, [8, 8])])
+ const p = nextPrescription(S, cfg(CURL), null)
+ expect(p.kind).toBe('hold')
+ expect(p.weight).toBe(24)
+ expect(p.why[0]).toMatch(/heaviest dumbbell/)
+ })
+
+ it('double progression raises to the next bell at the top of the range, holds at the last', () => {
+ const at = w => state([session('2026-10-01', CURL, w, [12, 12], { reps: 12, repsMin: 8 })])
+ const up = nextPrescription(at(18), cfg(CURL, { prog: 'double', reps: 12, repsMin: 8 }), null)
+ expect([up.kind, up.weight, up.reps]).toEqual(['up', 19, 8])
+ const top = nextPrescription(at(24), cfg(CURL, { prog: 'double', reps: 12, repsMin: 8 }), null)
+ expect([top.kind, top.weight]).toEqual(['hold', 24])
+ })
+
+ it('a deload lands on a bell you own', () => {
+ // Greyskull deloads after one miss, by its factor, onto the list.
+ const grey = state([session('2026-10-01', CURL, 21, [8, 5])])
+ const g = nextPrescription(grey, cfg(CURL, { prog: 'greyskull' }), null)
+ expect(g.kind).toBe('deload')
+ expect(RACK).toContain(g.weight)
+ expect(g.weight).toBe(19)
+ // Linear's Epley deload after three stalls picks its candidates from the list too.
+ const lin = state(['2026-10-01', '2026-10-03', '2026-10-05'].map(d => session(d, CURL, 21, [8, 5])))
+ const l = nextPrescription(lin, cfg(CURL), null)
+ expect(l.kind).toBe('deload')
+ expect(RACK).toContain(l.weight)
+ expect(l.weight).toBeLessThan(21)
+ })
+
+ it('the Epley selector keeps to the list when given one', () => {
+ const c = selectDeloadCandidate({ currentWeight: 21, targetWeight: 21, targetReps: 8, step: 2, owned: RACK })
+ expect(RACK).toContain(c.weight)
+ const grid = selectDeloadCandidate({ currentWeight: 21, targetWeight: 21, targetReps: 8, step: 2 })
+ expect(grid.weight % 2).toBe(0)
+ })
+})
+
+describe('warm-ups and drops over owned dumbbells', () => {
+ it('ramps the warm-up onto the heaviest bell under the rung', () => {
+ const S = state([session('2026-10-01', CURL, 21, [8, 6])])
+ const built = buildPlannedEntry(S, cfg(CURL, { warmupSets: 1 }), null)
+ const warm = built.sets.find(s => s.phase === 'warmup')
+ expect(built.sets.at(-1).w).toBe(21)
+ expect(warm.w).toBe(9)
+ })
+
+ it('drops onto a bell you own', () => {
+ const grid = dropGrid(state(), cfg(CURL))
+ expect(nextDropWeight(21, 20, grid)).toBe(15)
+ // A barbell keeps its own rule.
+ expect(typeof dropGrid(state(), cfg(SQUAT))).not.toBe('function')
+ })
+})
+
+describe('sync', () => {
+ it('keeps the list of a unit last edited on either device, whole', () => {
+ const a = { ...state(), _ts: 10, dumbbells: { kg: { weights: [3, 6], _ts: 10 } } }
+ const b = { ...state(), _ts: 20, dumbbells: { kg: { weights: [9, 11], _ts: 5 }, lb: { weights: [10], _ts: 4 } } }
+ const merged = mergeStates(a, b)
+ expect(merged.dumbbells.kg).toEqual({ weights: [3, 6], _ts: 10 })
+ expect(merged.dumbbells.lb).toEqual({ weights: [10], _ts: 4 })
+ })
+})
diff --git a/frontend/src/lib/dumbbells.js b/frontend/src/lib/dumbbells.js
index b18b0f44f..ed16572d0 100644
--- a/frontend/src/lib/dumbbells.js
+++ b/frontend/src/lib/dumbbells.js
@@ -21,12 +21,18 @@
// entered are never converted — nothing says which they meant — so they compare as they always
// did.
//
+// The dumbbell inventory (issue #376) is here too: the weights you own, per unit like the plate
+// inventory (S.dumbbells[unit] = { weights, _ts }). With one, a dumbbell exercise's progression,
+// deloads, warm-ups, drops and stepper land on bells you have instead of on the increment's grid;
+// without one nothing changes.
+//
// Only lib/exercises.js is imported, so history.js, progression.js and plates.js can all use
// this file without a cycle.
-import { EXIDX } from './exercises.js'
+import { EXIDX, isBodyweightEq } from './exercises.js'
const exOf = exOrId => (typeof exOrId === 'string' ? EXIDX[exOrId] : exOrId)
+const unitOf = S => (S?.unit === 'lb' ? 'lb' : 'kg')
const isMap = v => !!v && typeof v === 'object' && !Array.isArray(v)
const tidy = w => Math.round(w * 1000) / 1000
@@ -160,3 +166,93 @@ export function currentDbLoad(S, exId) {
}
return 'as'
}
+
+// ---- dumbbell inventory (issue #376) ---------------------------------------------------------
+
+/** The quick lists the inventory editor offers, per unit: 2–50 kg in 2s, 5–100 lb in 5s. */
+export const DB_PRESETS = { kg: { from: 2, to: 50, step: 2 }, lb: { from: 5, to: 100, step: 5 } }
+export const presetWeights = unit => {
+ const p = DB_PRESETS[unit === 'lb' ? 'lb' : 'kg']
+ const out = []
+ for (let w = p.from; w <= p.to + 1e-9; w += p.step) out.push(tidy(w))
+ return out
+}
+/** Sorted, de-duplicated, positive weights out of anything list-shaped. */
+export const cleanWeights = list => [...new Set((Array.isArray(list) ? list : [])
+ .map(Number).filter(w => Number.isFinite(w) && w > 0 && w < 10000).map(tidy))].sort((a, b) => a - b)
+
+/** The dumbbells this profile owns for its unit, lightest first; [] when it has not said. */
+export const dumbbellsOf = S => cleanWeights(S?.dumbbells?.[unitOf(S)]?.weights)
+/** Whether this profile has listed its dumbbells for its unit. */
+export const ownsDumbbells = S => dumbbellsOf(S).length > 0
+
+/**
+ * S.dumbbells with the profile's unit set to `weights`, stamped. An empty list is "no inventory"
+ * again, kept as a stamped entry (like the standard plate set) so it wins a sync too. Kept per
+ * unit and never converted: a 20 lb bell is not a 9.07 kg one.
+ */
+export const withDumbbells = (S, weights, now = Date.now()) =>
+ ({ ...(isMap(S?.dumbbells) ? S.dumbbells : {}), [unitOf(S)]: { weights: cleanWeights(weights), _ts: now } })
+
+/**
+ * The loads this exercise can be done at with the bells you own, lightest first, in the unit and
+ * meaning the sets are logged in; null when the inventory does not apply and the increment's grid
+ * stays in charge. Only dumbbell exercises with a load of their own: an added-weight (bodyweight)
+ * entry or a kettlebell keeps its grid. An exercise logged as both bells together on two bells
+ * moves in pairs (2 × each weight); every other meaning moves one bell at a time.
+ */
+export function ownedWeightsFor(S, cfg) {
+ const ex = exOf(cfg?.id)
+ if (ex?.eq !== 'dumbbell') return null
+ const bw = cfg?.bodyweight != null ? !!cfg.bodyweight : isBodyweightEq(cfg?.id)
+ if (bw) return null
+ const ws = dumbbellsOf(S)
+ if (!ws.length) return null
+ return dbLoadFor(S, cfg) === 'total' && bellsIn(cfg) === 2 ? ws.map(w => tidy(w * 2)) : ws
+}
+
+const EPS = 1e-6
+/** The `n`-th owned weight above `w` (the nearest one for an off-list weight); null past the heaviest. */
+export function ownedUp(ws, w, n = 1) {
+ const above = (ws || []).filter(x => x > (Number(w) || 0) + EPS)
+ if (!above.length) return null
+ return above[Math.min(n, above.length) - 1]
+}
+/** The nearest owned weight below `w`; null under the lightest. */
+export function ownedDown(ws, w) {
+ const below = (ws || []).filter(x => x < (Number(w) || 0) - EPS)
+ return below.length ? below[below.length - 1] : null
+}
+/** The heaviest owned weight at or under `x`, else the lightest you have. */
+export function ownedFloor(ws, x) {
+ const list = ws || []
+ const under = list.filter(v => v <= x + EPS)
+ return under.length ? under[under.length - 1] : (list[0] ?? 0)
+}
+/** One tap of a stepper over owned weights: the neighbour in that direction, or where it is at either end. */
+export function stepOwned(ws, v, dir) {
+ const next = dir > 0 ? ownedUp(ws, v) : ownedDown(ws, v)
+ return next ?? (Number(v) || 0)
+}
+/**
+ * A deload over owned weights: the owned weight nearest `w × factor` that is lighter than `w`,
+ * the heavier of two equally near. With nothing lighter it holds `w`.
+ */
+export function ownedDeload(ws, w, factor) {
+ const below = (ws || []).filter(x => x < w - EPS)
+ if (!below.length) return w
+ const ideal = w * factor
+ return below.reduce((best, x) => (Math.abs(x - ideal) < Math.abs(best - ideal) - EPS || (Math.abs(x - ideal) <= Math.abs(best - ideal) + EPS && x > best) ? x : best), below[0])
+}
+/**
+ * The owned weights either side of an ideal load, for the Epley deload (progression.js
+ * selectDeloadCandidate): the nearest at or under it and the nearest at or over it, never above
+ * `max` (or at it, when `strict`).
+ */
+export function ownedAround(ideal, ws, max, strict) {
+ if (!(ideal > 0) || !(max > 0)) return []
+ const ok = (ws || []).filter(x => x > 0 && x <= max + 1e-9 && (!strict || x < max - 1e-9))
+ const low = ok.filter(x => x <= ideal + EPS).pop()
+ const high = ok.find(x => x >= ideal - EPS)
+ return [...new Set([low, high].filter(x => x != null))].sort((a, b) => a - b)
+}
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index 4ceec94f7..bfdbae8de 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -6,7 +6,7 @@ import { isCardio, isBodyweightEq, isAssisted, betterWeight } from './exercises.
import { barWeightFor } from './bar.js'
import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, isDropSet, isRestPauseSet, normalizeMode, completedVolumeOf, hasCompletedWork, nextDropWeight, splitBurstReps, makeSideSet, isSideSet, syncSideAggregate, WEIGHT_ORIGIN_MANUAL, dropsOf, clustersOf } from './workout-model.js'
import { backoffAt, backoffStepOf, backoffWeights } from './backoff.js'
-import { dbLoadOf, bellsIn, volumeFactor, historyAs } from './dumbbells.js'
+import { dbLoadOf, bellsIn, volumeFactor, historyAs, ownedFloor } from './dumbbells.js'
const objectOf = value => value && typeof value === 'object' && !Array.isArray(value) ? value : {}
// Completed-state-independent work rows whose authoritative mode matches the requested mode.
const workRowsForMode = (entry = {}, mode = 'reps') => {
@@ -947,6 +947,11 @@ export function cascadeWeight(rows, from, value, side, backoffStep = 0) {
* — cardio, bodyweight, an unloaded hold — are returned untouched. `floor` is the lift's bar
* (barFloor): no open warm-up is ramped under it.
*/
+// A warm-up rung rounded down to something loadable: the step's grid, or — when `step` is the
+// list of dumbbells the profile owns (lib/dumbbells.js ownedWeightsFor, issue #376) — the
+// heaviest bell at or under it.
+const rungDown = (x, step) => (Array.isArray(step) ? ownedFloor(step, x) : Math.floor(x / step) * step)
+
export function rerampWarmups(rows, step = 2.5, floor = 0) {
const firstWork = rows.findIndex(x => !isWarmupRow(x))
if (firstWork <= 0) return rows
@@ -957,7 +962,7 @@ export function rerampWarmups(rows, step = 2.5, floor = 0) {
for (let i = 0; i < firstWork; i++) {
if (out[i].done) { from = out[i].w || 0; continue }
const w = target > from
- ? Math.min(target, Math.max(0, floor, Math.floor((from + (target - from) / 2) / step) * step))
+ ? Math.min(target, Math.max(0, floor, rungDown(from + (target - from) / 2, step)))
: target
// A per-side warm-up ramps the same bar for both limbs: set each side's weight and resync
// the aggregate, so the L/R rows and the row's own `w` agree. A straight row sets `w` alone.
@@ -985,7 +990,7 @@ export function insertWarmupRow(rows, mode, target, step = 2.5, floor = 0) {
// Rounded DOWN to the step: a warm-up that lands a notch light costs nothing, one that
// lands a notch heavy is a set you have to strip plates off before you can use it. Never
// under `floor` (barFloor), and never over the work weight even when the bar is heavier.
- return Math.min(to, Math.max(0, floor, Math.floor((from + (to - from) / 2) / step) * step))
+ return Math.min(to, Math.max(0, floor, rungDown(from + (to - from) / 2, step)))
}
const warm = mode === 'cardio'
? {
diff --git a/frontend/src/lib/plates.js b/frontend/src/lib/plates.js
index a53b5c1db..86e6b4b2a 100644
--- a/frontend/src/lib/plates.js
+++ b/frontend/src/lib/plates.js
@@ -13,6 +13,7 @@ import { EXIDX } from './exercises.js'
import { usesBar, defaultBarWeight } from './bar.js'
import { isBw } from './history.js'
import { weightIncrement } from './progression.js'
+import { ownedWeightsFor, ownedFloor } from './dumbbells.js'
/** The plate sizes the inventory editor lists, heaviest first, per unit. */
export const PLATE_SIZES = {
@@ -236,12 +237,17 @@ export const sameLoad = (a, b) =>
&& a.plates.length === b.plates.length && a.plates.every((w, i) => w === b.plates[i])
/**
- * Where a drop-set's next weight may land (lib/workout-model.js nextDropWeight): on the plates
+ * Where a drop-set's next weight may land (lib/workout-model.js nextDropWeight): on the dumbbells
+ * this profile owns for a dumbbell lift, on the plates
* this profile owns when it has counted them and the exercise is plate-loaded — the heaviest load
* at or below the drop that those plates make — else on the exercise's own weight step. A drop
* rounded to .5 read 48.5 kg on a bar that loads in 2.5s (QA 1.3.9).
*/
export function dropGrid(S, cfg) {
+ // A dumbbell lift with the bells you own listed (issue #376) drops to the heaviest one at or
+ // under the drop: a 20% drop from 21 kg is 16.8, and the rack holds a 15.
+ const owned = ownedWeightsFor(S, cfg)
+ if (owned) return w => ownedFloor(owned, w)
const kind = loadKindFor(S, cfg)
if (ownsPlates(S) && (kind === 'pairs' || kind === 'single')) {
const base = baseWeightFor(S, cfg?.id)
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js
index ba4eb3947..35a0cb61f 100644
--- a/frontend/src/lib/progression.js
+++ b/frontend/src/lib/progression.js
@@ -22,6 +22,7 @@ import { isWarmupRow, isSideSet, syncSideAggregate, makeSideSet } from './workou
import { normalizeRepRange } from './rep-range.js'
import { isPyramid } from './pyramid.js'
import { backoffAt } from './backoff.js'
+import { ownedWeightsFor, ownedUp, ownedDeload, ownedAround } from './dumbbells.js'
export const POLICIES = ['off', 'linear', 'greyskull', 'double', 'time']
@@ -148,7 +149,9 @@ const positiveGridAround = (ideal, step, maxWeight, strictLower) => {
* hard constraints first, then closest estimated 1RM, fewer rep changes, and greater load. That
* makes a grid tie predictable without hiding a product decision in arbitrary score weights.
*/
-export function selectDeloadCandidate({ currentWeight, targetWeight, targetReps, step, factor = DELOAD_FACTOR, reps, repsMin, perSide = false }) {
+// `owned`, when given, is the sorted list of weights the lifter can load (a dumbbell inventory,
+// lib/dumbbells.js): candidates come from it instead of from the step's grid.
+export function selectDeloadCandidate({ currentWeight, targetWeight, targetReps, step, factor = DELOAD_FACTOR, reps, repsMin, perSide = false, owned = null }) {
const current = Number(currentWeight)
const baseWeight = Number(targetWeight)
const baseReps = Number(targetReps)
@@ -166,7 +169,7 @@ export function selectDeloadCandidate({ currentWeight, targetWeight, targetReps,
repValues.forEach(candidateReps => {
const ideal = target1RM / (1 + (perSide ? candidateReps / 2 : candidateReps) / 30)
const allowCurrent = repsMin != null && candidateReps < upper
- const grid = positiveGridAround(ideal, step, current, !allowCurrent)
+ const grid = owned ? ownedAround(ideal, owned, current, !allowCurrent) : positiveGridAround(ideal, step, current, !allowCurrent)
if (allowCurrent && !grid.includes(current)) grid.push(current)
grid.forEach(candidateWeight => {
const epley = epley1RM(candidateWeight, perSide ? candidateReps / 2 : candidateReps)
@@ -396,8 +399,18 @@ export function nextPrescription(S, cfg, routine) {
// reward for a clean session is less help, and a stall means taking more (issue #232). Only
// the direction changes — the step, the grid and the stall counting are the same.
const assisted = isAssisted(cfg)
- const harder = (weight, step) => (assisted ? Math.max(0, addStep(weight, -step, inc)) : addStep(weight, step, inc))
- const easier = weight => (assisted ? addStep(weight, inc, inc) : deloadTo(weight, inc))
+ // The dumbbells you own (issue #376, lib/dumbbells.js), when the profile has listed them and
+ // this is a dumbbell lift: a raise goes to the next bell up (a double jump two up), a deload
+ // to the owned bell nearest the deload target, and at the heaviest bell the weight holds.
+ // Without a list, null, and the increment's grid decides as it always did.
+ const owned = mode === 'reps' && !assisted ? ownedWeightsFor(S, cfg) : null
+ const harder = (weight, step) => (assisted ? Math.max(0, addStep(weight, -step, inc))
+ : owned ? ownedUp(owned, weight, step > inc ? 2 : 1) ?? weight
+ : addStep(weight, step, inc))
+ const easier = weight => (assisted ? addStep(weight, inc, inc) : owned ? ownedDeload(owned, weight, DELOAD_FACTOR) : deloadTo(weight, inc))
+ // At the heaviest bell there is nothing to raise to: the weight holds and the line says why.
+ const topped = weight => !!owned && ownedUp(owned, weight) == null
+ const toppedOut = (weight, extra = {}) => ({ policy, kind: 'hold', weight, ...extra, why: ['You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.', weight, unit] })
// The routine's own sessions of this exercise, or the exercise's whole history when the
@@ -523,7 +536,8 @@ export function nextPrescription(S, cfg, routine) {
factor: deloadFactorOf(cfg),
reps: target.reps,
repsMin: policy === 'double' ? target.repsMin : undefined,
- perSide: isPerSide(target)
+ perSide: isPerSide(target),
+ owned
})
if (!candidate) return null
const held = candidate.weight >= w
@@ -550,11 +564,17 @@ export function nextPrescription(S, cfg, routine) {
// from before the exercise moved to double progression. Hitting it is compliance with that
// session, not "reached the top". Double progression must not add weight until every set
// actually reaches the top of the range (issue #278).
- if (last.ok && last.low >= top) return {
- policy, kind: 'up', weight: harder(w, inc), reps: bottom,
- why: assisted
- ? ['Top of the rep range in every set. {0} {1} less help, back to {2} reps.', inc, unit, bottom]
- : ['Top of the rep range in every set. {0} {1} more, back to {2} reps.', inc, unit, bottom]
+ if (last.ok && last.low >= top) {
+ if (topped(w)) return toppedOut(w, { reps: top })
+ const up = harder(w, inc)
+ // Over owned bells the step is whatever the next one is: 9 → 11 is 2 kg, 18 → 19 is 1.
+ const by = owned ? Math.round((up - w) * 100) / 100 : inc
+ return {
+ policy, kind: 'up', weight: up, reps: bottom,
+ why: assisted
+ ? ['Top of the rep range in every set. {0} {1} less help, back to {2} reps.', inc, unit, bottom]
+ : ['Top of the rep range in every set. {0} {1} more, back to {2} reps.', by, unit, bottom]
+ }
}
if (stalls >= deloadAt) {
const selected = epleyDeload()
@@ -576,9 +596,12 @@ export function nextPrescription(S, cfg, routine) {
// Greyskull's final set is taken to failure: double the target reps there and you have
// earned a double jump.
const dbl = policy === 'greyskull' && last.goal > 0 && last.amrap >= last.goal * 2
- const step = dbl ? inc * 2 : inc
+ if (topped(w)) return toppedOut(w)
+ const up = harder(w, dbl ? inc * 2 : inc)
+ // Over owned bells the jump is the distance to the bell it lands on.
+ const step = owned ? Math.round((up - w) * 100) / 100 : dbl ? inc * 2 : inc
return {
- policy, kind: 'up', weight: harder(w, step),
+ policy, kind: 'up', weight: up,
why: dbl
? ['Last set hit {0} reps, twice the target! Take a double jump of {1} {2}.', last.amrap, step, unit]
: assisted
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 2722523ad..5a6844c10 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1522e74abfb1a3335b95586d7bd6d3e52e4e4dc02dccb895a757d00f06e4ca8a')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('39b223418b62ec9ad1fb8746cf5c33e914dbabcff615cad9c0d83cfa1c2d9035')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/lib/session-start.js b/frontend/src/lib/session-start.js
index a2ae62f28..09bbac286 100644
--- a/frontend/src/lib/session-start.js
+++ b/frontend/src/lib/session-start.js
@@ -8,7 +8,7 @@ import { isWarmupRow } from './workout-model.js'
import { nextPrescription, applyPrescription, defaultIncrement, weightIncrement, plannedOf } from './progression.js'
import { dropGrid } from './plates.js'
import { backoffStepOf, applyBackoff } from './backoff.js'
-import { dbLoadFor, historyAs } from './dumbbells.js'
+import { dbLoadFor, historyAs, ownedWeightsFor } from './dumbbells.js'
/**
* Where a planned session's reps come from (Settings → During a workout). 'plan', the default:
@@ -40,9 +40,12 @@ export function buildPlannedEntry(stored, cfg, routine, { noProg = false } = {})
// default for its optional load.
const step = modeOf(cfg) === 'reps' ? weightIncrement(cfg, st.unit) : defaultIncrement(cfg.id, st.unit)
const planReps = !startsFromLast(st)
+ // Warm-ups ramp over the dumbbells you own when the profile lists them (issue #376): a rung
+ // lands on the heaviest bell under it, never on a weight in between that no rack holds.
+ const ramp = (modeOf(cfg) === 'reps' && ownedWeightsFor(st, cfg)) || step
// Back-off sets step down from the top set by the exercise's own step (lib/backoff.js).
const backoffStep = modeOf(cfg) === 'reps' && backoffStepOf(cfg, st.unit) ? step : 0
- const built = applyPrescription(buildSets(st, cfg, { step, rid: routine?.id, useTarget: plan.kind === 'off', planReps }), plan, step, barFloor(st, cfg.id))
+ const built = applyPrescription(buildSets(st, cfg, { step: ramp, rid: routine?.id, useTarget: plan.kind === 'off', planReps }), plan, ramp, barFloor(st, cfg.id))
const rows = backoffStep ? applyBackoff(built, backoffStep) : built
const sets = applyIntensifierPlan(rows, cfg, dropGrid(st, cfg))
const target = { ...cfg }
diff --git a/frontend/src/lib/sync-merge.js b/frontend/src/lib/sync-merge.js
index e6cae5a2d..eab2dd387 100644
--- a/frontend/src/lib/sync-merge.js
+++ b/frontend/src/lib/sync-merge.js
@@ -36,9 +36,10 @@
* is the exception: the edit may have taken away the set the kept weight came from, so it
* is the best of the merged history and of the editing copy's own, and the other copy's
* can no longer bring a corrected typo back. exNotes, barWeights: key union
- * - balanceOverrides, loadKind, plates, dbLoad: key union; of a key both have, the entry set last by
- * its own `_ts`, a clear included (mergeStampedMap), the newer copy's on a tie. For plates the
- * key is the unit, so the inventory of one unit is kept whole, as last edited
+ * - balanceOverrides, loadKind, plates, dbLoad, dumbbells: key union; of a key both have, the
+ * entry set last by its own `_ts`, a clear included (mergeStampedMap), the newer copy's on a
+ * tie. For plates and dumbbells the key is the unit, so the inventory of one unit is kept
+ * whole, as last edited
* - `_ts`: the later of the two; `_rev` dropped (the server sets it); `active` left to the caller
*
* Two rules come before all of these:
@@ -397,7 +398,7 @@ const RESET_LISTS = {
workouts: workoutKey, routines: x => x?.id, customEx: x => x?.id, bodyweight: bodyweightKey,
measurements: bodyweightKey, gymCards: x => x?.id, equipProfiles: x => x?.id, favEx: x => x,
}
-const RESET_MAPS = ['exNotes', 'barWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad']
+const RESET_MAPS = ['exNotes', 'barWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']
/** An entry's name in resetIds: a workout's id (or day and start), a weigh-in's day and time, … */
export const entryKey = (field, x) => String(RESET_LISTS[field](x))
// Per field, the most names a reset keeps — far more workouts than anyone logs, and a bound on
@@ -457,7 +458,7 @@ export function sinceReset(S, at, ids) {
out.favEx = []
out.exNotes = {}
out.barWeights = {}
- for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad']) {
+ for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']) {
out[f] = Object.fromEntries(Object.entries(isMap(S[f]) ? S[f] : {}).filter(([, v]) => after(stampOf(v))))
}
}
@@ -607,7 +608,7 @@ function applyDeletions(S, deleted) {
const OWN_MERGE = new Set([
'_ts', '_rev', '_wid', '_wids', '_unstamped', '_prior', 'active', 'unit', 'unitSet', 'resetAt', 'resetIds', 'deleted', 'edited', 'undone', 'routineOrder',
'workouts', 'routines', 'customEx', 'equipProfiles', 'gymCards', 'bodyweight', 'measurements', 'favEx',
- 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad',
+ 'exWeights', 'balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells',
])
// Stamped per key instead of whole: one day of the plan, one exercise's note or bar.
const PER_KEY = new Set(['week', 'dayPlan', 'exNotes', 'barWeights'])
@@ -844,7 +845,7 @@ export function mergeStates(a0, b0, { prefer } = {}) {
// The plate-loading choices (lib/plates.js) are stamped the same way: an exercise's loading and
// a unit's plate inventory are each one choice, made on one device, that a later set logged on
// the other must not undo.
- for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad']) {
+ for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']) {
if (n[f] || o[f]) out[f] = clone(mergeStampedMap(n[f], o[f], prefer))
}
// Each stamped setting and plan day from the copy that changed it last (the `edited` section
@@ -967,7 +968,7 @@ export function stampReplace(next, others = [], now = Date.now()) {
x._ts = Math.max(Number(x._ts) || 0, now)
}
}
- for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad']) {
+ for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']) {
if (!isMap(next[f])) continue
for (const [k, v] of Object.entries(next[f])) {
if (!isMap(v)) continue
@@ -1003,7 +1004,7 @@ export function highestStamp(S) {
if (isMap(x._f)) for (const v of Object.values(x._f)) see(v)
}
}
- for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad']) if (isMap(S[f])) for (const v of Object.values(S[f])) see(stampOf(v))
+ for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']) if (isMap(S[f])) for (const v of Object.values(S[f])) see(stampOf(v))
for (const e of [...list(S.bodyweight), ...list(S.measurements)]) if (e && typeof e === 'object') see(e.t)
return m
}
@@ -1025,7 +1026,7 @@ export function stampChange(prev, next, wall = Date.now()) {
}
// Settings maps whose entries carry their own stamp (mergeStampedMap): an entry the change
// re-stamped takes the change's time.
- for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad']) {
+ for (const f of ['balanceOverrides', 'loadKind', 'plates', 'dbLoad', 'dumbbells']) {
const p = isMap(prev?.[f]) ? prev[f] : {}, n = isMap(next[f]) ? next[f] : null
if (!n) continue
for (const [k, v] of Object.entries(n)) if (isMap(v) && v._ts != null && stampOf(v) !== stampOf(p[k])) v._ts = now
diff --git a/frontend/src/lib/units.js b/frontend/src/lib/units.js
index 5f6c78426..ac8e3dc1a 100644
--- a/frontend/src/lib/units.js
+++ b/frontend/src/lib/units.js
@@ -100,7 +100,9 @@ export function convertStateUnit(S, to) {
// The plate inventory (S.plates) is carried over as it is, not converted: it is kept per unit
// (lib/plates.js), because a 45 lb plate does not become a 20.4 kg one. After the switch the
// rows load from the new unit's own list, or the standard set until you count yours, and
- // switching back finds the old list as you left it. The load kinds (S.loadKind) hold no weight.
+ // switching back finds the old list as you left it. The dumbbell list (S.dumbbells) is kept per
+ // unit the same way. The load kinds (S.loadKind) and what a dumbbell weight means (S.dbLoad)
+ // hold no weight.
if (Array.isArray(S.routines)) out.routines = S.routines.map(r => ({ ...r, ex: (r.ex || []).map(cfg => convTarget(cfg, from, to)) }))
if (Array.isArray(S.workouts)) out.workouts = S.workouts.map(convSession)
if (S.active) out.active = convSession(S.active)
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index b00abc287..8b69a8512 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -2226,4 +2226,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'وزن الواحد، أي أن 20 تعني 20 في كل يد. الحجم يحسب الاثنين.',
'Both together, so 40 means two 20s.': 'الاثنان معًا، أي أن 40 تعني اثنين بوزن 20.',
'Counted as you type it, the way it always was.': 'يُحسب كما تكتبه، كما كان دائمًا.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'تجاوزت الرف: أثقل دمبل لديك {0} {1}، لذا يبقى الوزن كما هو.',
+ 'Dumbbells': 'الدمبلز',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'الأوزان التي تملكها، دمبل واحد لكل وزن. التدرج والتخفيف والإحماء وزرّا + و − في تمارين الدمبل تقع على هذه فقط.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'لا قائمة بعد، لذا تتقدم تمارين الدمبل بزيادتها المعتادة.',
+ 'Fill in {0} to {1} {2}, every {3}': 'املأ من {0} إلى {1} {2}، كل {3}',
+ 'Clear the list': 'امسح القائمة',
+ 'Any weight. Tap to list the ones you own.': 'أي وزن. اضغط لإدراج ما تملكه.',
}
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 68e1e7659..7c4616463 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -2250,4 +2250,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'একটির ওজন, তাই 20 মানে প্রতি হাতে 20। ভলিউমে দুটোই গোনা হয়।',
'Both together, so 40 means two 20s.': 'দুটো মিলে, তাই 40 মানে দুটো 20।',
'Counted as you type it, the way it always was.': 'যেমন লেখেন তেমনই গোনা হয়, আগের মতোই।',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'র‍্যাক ছাড়িয়ে গেছেন: আপনার সবচেয়ে ভারী ডাম্বেল {0} {1}, তাই ওজন একই থাকছে।',
+ 'Dumbbells': 'ডাম্বেল',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'আপনার যে ওজনগুলো আছে, প্রতিটি একটি ডাম্বেল। ডাম্বেল ব্যায়ামে প্রগ্রেশন, ডিলোড, ওয়ার্ম-আপ আর + ও − বোতাম শুধু এগুলোতেই পড়ে।',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'এখনো তালিকা নেই, তাই ডাম্বেল ব্যায়াম আগের মতো নিজের ধাপে বাড়ে।',
+ 'Fill in {0} to {1} {2}, every {3}': '{0} থেকে {1} {2} পর্যন্ত পূরণ করুন, প্রতি {3}',
+ 'Clear the list': 'তালিকা মুছুন',
+ 'Any weight. Tap to list the ones you own.': 'যেকোনো ওজন। আপনারগুলো তালিকায় দিতে ট্যাপ করুন।',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index fbdb5adf5..501bfdcc4 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -2191,4 +2191,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Das Gewicht einer Hantel: 20 heißt 20 in jeder Hand. Das Volumen zählt beide.',
'Both together, so 40 means two 20s.': 'Beide zusammen: 40 heißt zwei 20er.',
'Counted as you type it, the way it always was.': 'Gezählt, wie du es eintippst, so wie immer.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Du bist dem Hantelständer entwachsen: {0} {1} ist deine schwerste Kurzhantel, also bleibt das Gewicht.',
+ 'Dumbbells': 'Kurzhanteln',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Die Gewichte, die du hast, je eine Hantel. Progression, Deloads, Aufwärmsätze und die Tasten + und − bei Kurzhantelübungen landen nur auf diesen.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Noch keine Liste, also steigen Kurzhantelübungen wie gewohnt in ihrem Schritt.',
+ 'Fill in {0} to {1} {2}, every {3}': '{0} bis {1} {2} eintragen, alle {3}',
+ 'Clear the list': 'Liste leeren',
+ 'Any weight. Tap to list the ones you own.': 'Jedes Gewicht. Tippe, um deine aufzulisten.',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index fd7bcb87a..51c8c5415 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'El peso de una, así que 20 son 20 en cada mano. El volumen cuenta las dos.',
'Both together, so 40 means two 20s.': 'Las dos juntas, así que 40 son dos de 20.',
'Counted as you type it, the way it always was.': 'Se cuenta tal como lo escribes, como siempre.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Se te quedó corto el rack: {0} {1} es tu mancuerna más pesada, así que el peso se queda.',
+ 'Dumbbells': 'Mancuernas',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Los pesos que tienes, uno por mancuerna. La progresión, las descargas, el calentamiento y los botones + y − de los ejercicios con mancuernas solo usan estos.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Aún no hay lista, así que los ejercicios con mancuernas suben con su incremento de siempre.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Rellenar de {0} a {1} {2}, cada {3}',
+ 'Clear the list': 'Vaciar la lista',
+ 'Any weight. Tap to list the ones you own.': 'Cualquier peso. Toca para apuntar los que tienes.',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index ea564b212..77d437adb 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Le poids d’un seul, donc 20 veut dire 20 dans chaque main. Le volume compte les deux.',
'Both together, so 40 means two 20s.': 'Les deux ensemble, donc 40 veut dire deux de 20.',
'Counted as you type it, the way it always was.': 'Compté comme tu le tapes, comme toujours.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Tu as dépassé ton rack : {0} {1} est ton haltère le plus lourd, donc le poids reste.',
+ 'Dumbbells': 'Haltères',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Les poids que tu possèdes, un haltère chacun. La progression, les décharges, l’échauffement et les boutons + et − des exercices aux haltères ne tombent que sur ceux-ci.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Pas encore de liste, donc les exercices aux haltères avancent par leur incrément habituel.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Remplir de {0} à {1} {2}, tous les {3}',
+ 'Clear the list': 'Vider la liste',
+ 'Any weight. Tap to list the ones you own.': 'N’importe quel poids. Touche pour lister les tiens.',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index e303c4c14..ceb87dcfa 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'एक का वज़न, यानी 20 मतलब हर हाथ में 20। वॉल्यूम दोनों को गिनता है।',
'Both together, so 40 means two 20s.': 'दोनों मिलाकर, यानी 40 मतलब दो 20 वाले।',
'Counted as you type it, the way it always was.': 'जैसा आप लिखते हैं वैसा ही गिना जाता है, हमेशा की तरह।',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'आप रैक से आगे निकल चुके हैं: आपका सबसे भारी डम्बल {0} {1} है, इसलिए वज़न वही रहेगा।',
+ 'Dumbbells': 'डम्बल',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'आपके पास जो वज़न हैं, हर एक डम्बल। डम्बल एक्सरसाइज़ में प्रोग्रेशन, डीलोड, वॉर्म-अप और + और − बटन सिर्फ़ इन्हीं पर आते हैं।',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'अभी कोई सूची नहीं, इसलिए डम्बल एक्सरसाइज़ हमेशा की तरह अपने स्टेप से बढ़ती हैं।',
+ 'Fill in {0} to {1} {2}, every {3}': '{0} से {1} {2} तक भरें, हर {3}',
+ 'Clear the list': 'सूची खाली करें',
+ 'Any weight. Tap to list the ones you own.': 'कोई भी वज़न। अपने वाले लिखने के लिए टैप करें।',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 3b75fbb9e..b00e04cc3 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -2174,4 +2174,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Egy darab súlya, tehát a 20 kezenként 20-at jelent. A volumen mindkettőt számolja.',
'Both together, so 40 means two 20s.': 'A kettő együtt, tehát a 40 két 20-ast jelent.',
'Counted as you type it, the way it always was.': 'Úgy számít, ahogy beírod, mint eddig mindig.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Kinőtted az állványt: a legnehezebb kézisúlyzód {0} {1}, így a súly marad.',
+ 'Dumbbells': 'Kézisúlyzók',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'A súlyok, amelyek megvannak, darabonként. A kézisúlyzós gyakorlatoknál a progresszió, a deload, a bemelegítés és a + és − gomb csak ezekre esik.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Még nincs lista, így a kézisúlyzós gyakorlatok a szokásos lépésükkel haladnak.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Kitöltés {0} és {1} {2} között, {3} lépésközzel',
+ 'Clear the list': 'Lista törlése',
+ 'Any weight. Tap to list the ones you own.': 'Bármilyen súly. Koppints, és sorold fel a sajátjaidat.',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index f8338fcc5..adb6bc45a 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Il peso di uno, quindi 20 vuol dire 20 in ogni mano. Il volume li conta entrambi.',
'Both together, so 40 means two 20s.': 'Entrambi insieme, quindi 40 vuol dire due da 20.',
'Counted as you type it, the way it always was.': 'Contato come lo scrivi, come sempre.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Hai superato la rastrelliera: {0} {1} è il tuo manubrio più pesante, quindi il peso resta.',
+ 'Dumbbells': 'Manubri',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'I pesi che hai, un manubrio ciascuno. Progressione, scarichi, riscaldamento e i tasti + e − degli esercizi con manubri cadono solo su questi.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Ancora nessuna lista, quindi gli esercizi con manubri salgono col loro incremento solito.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Compila da {0} a {1} {2}, ogni {3}',
+ 'Clear the list': 'Svuota la lista',
+ 'Any weight. Tap to list the ones you own.': 'Qualsiasi peso. Tocca per elencare i tuoi.',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 46f237edf..94c793a64 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': '하나의 무게라서 20은 양손에 20씩이에요. 볼륨은 두 개를 셉니다.',
'Both together, so 40 means two 20s.': '두 개를 합친 무게라서 40은 20짜리 두 개예요.',
'Counted as you type it, the way it always was.': '입력한 그대로 계산해요. 늘 그랬듯이.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': '랙을 졸업했어요: 가장 무거운 덤벨이 {0} {1}이라 무게는 그대로예요.',
+ 'Dumbbells': '덤벨',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': '가지고 있는 무게를 하나씩 적어요. 덤벨 운동의 증량, 디로드, 워밍업, + 와 − 버튼은 이 무게에만 맞춰져요.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': '아직 목록이 없어서 덤벨 운동은 평소 증량 단위대로 올라가요.',
+ 'Fill in {0} to {1} {2}, every {3}': '{0}부터 {1} {2}까지 {3} 간격으로 채우기',
+ 'Clear the list': '목록 비우기',
+ 'Any weight. Tap to list the ones you own.': '아무 무게나 가능해요. 눌러서 가진 덤벨을 적어 보세요.',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 06d07145f..5f14a1312 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Ciężar jednej sztuki: 20 to 20 w każdej dłoni. Objętość liczy obie.',
'Both together, so 40 means two 20s.': 'Obie razem: 40 to dwie po 20.',
'Counted as you type it, the way it always was.': 'Liczone tak, jak wpisano, jak zawsze.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Stojak już nie wystarcza: {0} {1} to najcięższa hantla, więc ciężar zostaje.',
+ 'Dumbbells': 'Hantle',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Ciężary, które masz, po jednej hantli. Progresja, deloady, rozgrzewka i przyciski + i − w ćwiczeniach z hantlami trafiają tylko na nie.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Brak listy, więc ćwiczenia z hantlami rosną jak zwykle o swój krok.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Wpisz od {0} do {1} {2}, co {3}',
+ 'Clear the list': 'Wyczyść listę',
+ 'Any weight. Tap to list the ones you own.': 'Dowolny ciężar. Dotknij, aby wpisać posiadane.',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 546076cf0..a36a01654 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1337,6 +1337,12 @@ export const PT_BR_OVERRIDES = {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'O peso de um, então 20 significa 20 em cada mão. O volume conta os dois.',
'Both together, so 40 means two 20s.': 'Os dois juntos, então 40 significa dois de 20.',
'Counted as you type it, the way it always was.': 'Contado como você digita, como sempre foi.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Você já superou o rack: {0} {1} é o seu halter mais pesado, então o peso fica.',
+ 'Dumbbells': 'Halteres',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Os pesos que você tem, um halter cada. A progressão, as descargas, o aquecimento e os botões + e − dos exercícios com halteres só caem nestes.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Ainda sem lista, então os exercícios com halteres sobem pelo incremento de sempre.',
+ 'Any weight. Tap to list the ones you own.': 'Qualquer peso. Toque para listar os seus.',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index ab4d75bae..8587a1060 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'O peso de um, por isso 20 quer dizer 20 em cada mão. O volume conta os dois.',
'Both together, so 40 means two 20s.': 'Os dois juntos, por isso 40 quer dizer dois de 20.',
'Counted as you type it, the way it always was.': 'Contado como o escreves, como sempre foi.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Já superaste o suporte: {0} {1} é o teu haltere mais pesado, por isso o peso fica.',
+ 'Dumbbells': 'Halteres',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Os pesos que tens, um haltere cada. A progressão, as descargas, o aquecimento e os botões + e − dos exercícios com halteres só caem nestes.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Ainda sem lista, por isso os exercícios com halteres sobem pelo incremento de sempre.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Preencher de {0} a {1} {2}, a cada {3}',
+ 'Clear the list': 'Limpar a lista',
+ 'Any weight. Tap to list the ones you own.': 'Qualquer peso. Toca para listar os teus.',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 8692e1f38..15c1a8e1b 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -2175,4 +2175,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Вес одной: 20 значит по 20 в каждой руке. В объём идут обе.',
'Both together, so 40 means two 20s.': 'Обе вместе: 40 значит две по 20.',
'Counted as you type it, the way it always was.': 'Считается так, как вы вводите, как и всегда.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Стойка вам уже мала: ваша самая тяжёлая гантель весит {0} {1}, так что вес остаётся.',
+ 'Dumbbells': 'Гантели',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Веса, которые у вас есть, по одной гантели. Прогрессия, разгрузки, разминка и кнопки + и − в упражнениях с гантелями попадают только на них.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Списка пока нет, так что упражнения с гантелями растут на свой обычный шаг.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Заполнить от {0} до {1} {2}, шаг {3}',
+ 'Clear the list': 'Очистить список',
+ 'Any weight. Tap to list the ones you own.': 'Любой вес. Нажмите, чтобы перечислить свои.',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index e1e879e8e..72403855d 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -2182,4 +2182,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'น้ำหนักของหนึ่งอัน 20 คือมือละ 20 ปริมาณรวมนับทั้งสองอัน',
'Both together, so 40 means two 20s.': 'ทั้งสองอันรวมกัน 40 คือ 20 สองอัน',
'Counted as you type it, the way it always was.': 'นับตามที่คุณกรอก เหมือนที่ผ่านมา',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'ชั้นวางเล็กไปแล้ว: ดัมเบลที่หนักที่สุดของคุณคือ {0} {1} น้ำหนักจึงคงเดิม',
+ 'Dumbbells': 'ดัมเบล',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'น้ำหนักที่คุณมี อันละหนึ่งค่า การเพิ่มน้ำหนัก การดีโหลด วอร์มอัพ และปุ่ม + กับ − ของท่าดัมเบลจะใช้แค่ค่าเหล่านี้',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'ยังไม่มีรายการ ท่าดัมเบลจึงเพิ่มตามขั้นปกติ',
+ 'Fill in {0} to {1} {2}, every {3}': 'เติม {0} ถึง {1} {2} ทุก {3}',
+ 'Clear the list': 'ล้างรายการ',
+ 'Any weight. Tap to list the ones you own.': 'น้ำหนักใดก็ได้ แตะเพื่อใส่น้ำหนักที่คุณมี',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 00c7432dc..e5d5ce013 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Bir tanesinin ağırlığı, yani 20 her elde 20 demek. Hacim ikisini de sayar.',
'Both together, so 40 means two 20s.': 'İkisi birlikte, yani 40 iki tane 20 demek.',
'Counted as you type it, the way it always was.': 'Yazdığın gibi sayılır, her zamanki gibi.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Rafı aştın: en ağır dambılın {0} {1}, bu yüzden ağırlık aynı kalıyor.',
+ 'Dumbbells': 'Dambıllar',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Sahip olduğun ağırlıklar, her biri tek dambıl. Dambıl hareketlerinde progresyon, deload, ısınma ve + ile − düğmeleri yalnızca bunlara düşer.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Henüz liste yok, bu yüzden dambıl hareketleri her zamanki artışla ilerler.',
+ 'Fill in {0} to {1} {2}, every {3}': '{0} ile {1} {2} arasını doldur, {3} arayla',
+ 'Clear the list': 'Listeyi temizle',
+ 'Any weight. Tap to list the ones you own.': 'Her ağırlık. Sahip olduklarını listelemek için dokun.',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 662b252b6..1d4159b17 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -2168,4 +2168,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': 'Вага однієї: 20 означає 20 у кожній руці. В обсяг ідуть обидві.',
'Both together, so 40 means two 20s.': 'Обидві разом: 40 означає дві по 20.',
'Counted as you type it, the way it always was.': 'Рахується так, як ти вводиш, як завжди.',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': 'Стійка тобі вже замала: твоя найважча гантель важить {0} {1}, тож вага лишається.',
+ 'Dumbbells': 'Гантелі',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': 'Ваги, які в тебе є, по одній гантелі. Прогресія, розвантаження, розминка і кнопки + та − у вправах з гантелями потрапляють тільки на них.',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': 'Списку ще немає, тож вправи з гантелями ростуть на свій звичний крок.',
+ 'Fill in {0} to {1} {2}, every {3}': 'Заповнити від {0} до {1} {2}, крок {3}',
+ 'Clear the list': 'Очистити список',
+ 'Any weight. Tap to list the ones you own.': 'Будь-яка вага. Торкнися, щоб перелічити свої.',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index fc0156148..278759f57 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -2164,4 +2164,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': '一支的重量,20 就是每隻手 20。訓練量會算兩支。',
'Both together, so 40 means two 20s.': '兩支加起來,40 就是兩支 20。',
'Counted as you type it, the way it always was.': '照你輸入的算,一直都是這樣。',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': '架子已經不夠用了:你最重的啞鈴是 {0} {1},所以重量不變。',
+ 'Dumbbells': '啞鈴',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': '你擁有的重量,每個一支。啞鈴動作的加重、減量、熱身以及 + 和 − 按鈕都只會落在這些重量上。',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': '還沒有清單,所以啞鈴動作照常按增量遞增。',
+ 'Fill in {0} to {1} {2}, every {3}': '填入 {0} 到 {1} {2},每隔 {3}',
+ 'Clear the list': '清空清單',
+ 'Any weight. Tap to list the ones you own.': '任意重量。點一下列出你有的啞鈴。',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 5fff2bf2c..4d4a660ef 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -2171,4 +2171,12 @@ export default {
'The weight of one, so 20 means 20 in each hand. Volume counts both.': '一只的重量,20 就是每只手 20。容量会算两只。',
'Both together, so 40 means two 20s.': '两只加起来,40 就是两只 20。',
'Counted as you type it, the way it always was.': '按你输入的算,一直都是这样。',
+ // --- dumbbell inventory (#376) ---
+ 'You’ve outgrown the rack: {0} {1} is your heaviest dumbbell, so the weight stays.': '架子已经不够用了:你最重的哑铃是 {0} {1},所以重量不变。',
+ 'Dumbbells': '哑铃',
+ 'The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.': '你拥有的重量,每个一只。哑铃动作的加重、减载、热身以及 + 和 − 按钮都只会落在这些重量上。',
+ 'No list yet, so dumbbell lifts step by their increment as usual.': '还没有列表,所以哑铃动作照常按增量递增。',
+ 'Fill in {0} to {1} {2}, every {3}': '填入 {0} 到 {1} {2},每隔 {3}',
+ 'Clear the list': '清空列表',
+ 'Any weight. Tap to list the ones you own.': '任意重量。点一下列出你有的哑铃。',
}
diff --git a/frontend/src/sheets.dumbbells.test.jsx b/frontend/src/sheets.dumbbells.test.jsx
new file mode 100644
index 000000000..3cc7a6950
--- /dev/null
+++ b/frontend/src/sheets.dumbbells.test.jsx
@@ -0,0 +1,70 @@
+// @vitest-environment happy-dom
+// The dumbbell inventory sheet (Settings → Equipment → Dumbbells, issue #376) writes the list of
+// bells for the profile's unit, stamped, the way lib/dumbbells.js reads it.
+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 { dumbbellInventorySheet } from './sheets.jsx'
+
+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 button = (host, text) => [...host.querySelectorAll('button')].find(b => b.textContent.trim().startsWith(text))
+const chips = host => [...host.querySelectorAll('.chip')].map(c => c.textContent.trim())
+
+describe('dumbbell inventory sheet', () => {
+ beforeEach(() => {
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true
+ useUI.setState({ sheets: [], toasts: [] })
+ useStore.setState({ S: { ...JSON.parse(JSON.stringify(DEF)), unit: 'kg' }, user: null })
+ document.body.innerHTML = ''
+ })
+ afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })
+
+ it('starts empty, fills the usual rack, and a tap takes a bell off', () => {
+ act(() => dumbbellInventorySheet())
+ const host = mountTopSheet()
+ expect(host.textContent).toContain('No list yet')
+ act(() => button(host, 'Fill in 2 to 50 kg, every 2').click())
+ expect(S().dumbbells.kg.weights).toHaveLength(25)
+ expect(S().dumbbells.kg._ts).toEqual(expect.any(Number))
+ expect(chips(host)[0]).toBe('2')
+ act(() => host.querySelector('[aria-label="Remove 2 kg"]').click())
+ expect(S().dumbbells.kg.weights[0]).toBe(4)
+ act(() => button(host, 'Clear the list').click())
+ expect(S().dumbbells.kg.weights).toEqual([])
+ })
+
+ it('adds a typed weight in order and keeps the other unit alone', () => {
+ useStore.setState(s => ({ S: { ...s.S, dumbbells: { kg: { weights: [3, 9], _ts: 1 }, lb: { weights: [10], _ts: 1 } } } }))
+ act(() => dumbbellInventorySheet())
+ const host = mountTopSheet()
+ const input = host.querySelector('input')
+ act(() => {
+ const set = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set
+ set.call(input, '6')
+ input.dispatchEvent(new Event('input', { bubbles: true }))
+ })
+ act(() => button(host, 'Add').click())
+ expect(S().dumbbells.kg.weights).toEqual([3, 6, 9])
+ expect(S().dumbbells.lb).toEqual({ weights: [10], _ts: 1 })
+ })
+
+ it('offers the lb rack to a lb profile', () => {
+ useStore.setState(s => ({ S: { ...s.S, unit: 'lb' } }))
+ act(() => dumbbellInventorySheet())
+ const host = mountTopSheet()
+ act(() => button(host, 'Fill in 5 to 100 lb, every 5').click())
+ expect(S().dumbbells.lb.weights.slice(0, 3)).toEqual([5, 10, 15])
+ })
+})
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 5b29561dd..830e0a96d 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -35,7 +35,7 @@ import { importHevyData, HevyApiError, HEVY_DEV_SETTINGS, mergeHevyRoutines } fr
import { buildPlanBundle, parsePlan, mergePlan, printPlan, planPrintHTML } from './lib/plan-share.js'
import { estimate1RM, best1RM, is1RMRecord, REP_CAP, formulaOf, FORMULA_NAMES } from './lib/onerm.js'
import { exerciseHistory } from './lib/exercise-history.js'
-import { isBellEx, dbLoadOf, dbLoadFor, withDbLoad, withMeaning, historyAs, entryDbLoad, currentDbLoad, isOneArm } from './lib/dumbbells.js'
+import { isBellEx, dbLoadOf, dbLoadFor, withDbLoad, withMeaning, historyAs, entryDbLoad, currentDbLoad, isOneArm, ownedWeightsFor, dumbbellsOf, ownsDumbbells, withDumbbells, presetWeights, cleanWeights } from './lib/dumbbells.js'
import { policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC, MAX_BW_SETS, weightIncrement } from './lib/progression.js'
import { normalizeRepRange } from './lib/rep-range.js'
import { isBackoff, backoffWeights } from './lib/backoff.js'
@@ -866,6 +866,49 @@ function PlateInventorySheet({ close }) {
}
export const plateInventorySheet = () => ui().openSheet(close => <PlateInventorySheet close={close} />)
+// The dumbbells you own, for the profile's unit (Settings → Equipment → Dumbbells, issue #376):
+// a list of single bells, kept per unit like the plates (lib/dumbbells.js). With one, progression,
+// deloads, warm-ups, drops and the stepper of every dumbbell lift land on these; an empty list
+// puts them back on the increment. Tapping a weight takes it off, the field adds one, and the
+// quick fill writes the usual rack for the unit to edit from. Every change is stamped.
+function DumbbellInventorySheet({ close }) {
+ const st = useStore(s => s.S)
+ const unit = st.unit === 'lb' ? 'lb' : 'kg'
+ const list = dumbbellsOf(st)
+ const [draft, setDraft] = useState(null)
+ const save = ws => update(s => { s.dumbbells = withDumbbells(s, ws) })
+ const preset = presetWeights(unit)
+ const add = () => {
+ const w = cleanWeights([draft])[0]
+ if (!w) { toast(t('Enter a valid weight')); return }
+ save([...list, w])
+ setDraft(null)
+ }
+ return <>
+ <h3>{t('Dumbbells')}</h3>
+ <div className="muted small" style={{ marginBottom: 14 }}>
+ {t('The weights you own, one bell each. Progression, deloads, warm-ups and the + and − buttons of dumbbell lifts land only on these.')}
+ </div>
+ {list.length > 0
+ ? <div className="chips" style={{ flexWrap: 'wrap', overflow: 'visible', touchAction: 'auto', marginBottom: 12 }}>
+ {list.map(w => <button key={w} className="chip on nocap" aria-label={t('Remove {0}', fmtPlate(w) + ' ' + unit)}
+ onClick={() => save(list.filter(x => x !== w))}>{fmtPlate(w)} <Icon name="xmark" /></button>)}
+ </div>
+ : <div className="small dim" style={{ marginBottom: 12 }}>{t('No list yet, so dumbbell lifts step by their increment as usual.')}</div>}
+ <div className="row" style={{ gap: 8, marginBottom: 12 }}>
+ <NumberField className="input" decimal value={draft ?? ''} onChange={v => setDraft(v)}
+ aria-label={t('Weight ({0})', unit)} placeholder={t('Weight ({0})', unit)} onKeyDown={e => { if (e.key === 'Enter') add() }} />
+ <Button icon="plus" onClick={add} style={{ flex: '0 0 auto', width: 'auto' }}>{t('Add')}</Button>
+ </div>
+ <Button onClick={() => save(preset)} style={{ marginBottom: 8 }}>
+ {t('Fill in {0} to {1} {2}, every {3}', fmtPlate(preset[0]), fmtPlate(preset.at(-1)), unit, fmtPlate(preset[1] - preset[0]))}
+ </Button>
+ {list.length > 0 && <Button variant="danger" onClick={() => save([])} style={{ marginBottom: 8 }}>{t('Clear the list')}</Button>}
+ <Button variant="primary" onClick={close}>{t('Done')}</Button>
+ </>
+}
+export const dumbbellInventorySheet = () => ui().openSheet(close => <DumbbellInventorySheet close={close} />)
+
/* ============================ exercise detail ============================ */
// Estimated 1RM for one exercise (issue #18): what the log already implies, plus a calculator
// for a set you have not done — so the number is reachable before there is any history.
@@ -1379,7 +1422,7 @@ export function swapActiveWorkoutExercise(index) {
// A freestyle swap logs dumbbell weights the way the exercise means them now, and starts
// from last time read in that meaning (lib/dumbbells.js), as a planned one does.
const built = freestyle
- ? { target: withMeaning(st, cfg, ex.id), plan: null, sets: applyIntensifierPlan(buildSets(historyAs(past, ex.id, dbLoadFor(st, full)), full, { step, preferLast: true }), full, dropGrid(st, full)) }
+ ? { target: withMeaning(st, cfg, ex.id), plan: null, sets: applyIntensifierPlan(buildSets(historyAs(past, ex.id, dbLoadFor(st, full)), full, { step: (modeOf(full) === 'reps' && ownedWeightsFor(st, full)) || step, preferLast: true }), full, dropGrid(st, full)) }
: buildPlannedEntry(past, full, slotRoutine, { noProg: builtOutOfProgression(current, slotRoutine) })
const replacement = {
id: ex.id,
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index 9a99a9029..0e95f2895 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -166,6 +166,10 @@ export const DEF = {
// null, _ts } (lib/dumbbells.js). Absent or null = as entered, counted once, which is how every
// set was read before the choice existed. A routine slot can say its own (cfg.dbLoad).
dbLoad: {},
+ // The dumbbells you own, per unit: { kg: { weights: [3, 6, 8, …], _ts }, lb: { … } }
+ // (lib/dumbbells.js). Single bells, lightest first. Kept per unit and stamped like the plates;
+ // absent or empty = no list, and dumbbell lifts step by their increment as before.
+ dumbbells: {},
// 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/FocusView.jsx b/frontend/src/views/FocusView.jsx
index 9239056c7..49a88fdfa 100644
--- a/frontend/src/views/FocusView.jsx
+++ b/frontend/src/views/FocusView.jsx
@@ -15,6 +15,7 @@ import {
import { weightIncrement, stepWeight } from '../lib/progression.js'
import { effortPickerSheet, exerciseDetailSheet, exerciseHistorySheet, exerciseNoteSheet, menuSheet, barWeightSheet } from '../sheets.jsx'
import { baseWeightFor, inventoryFor, loadKindFor, rowLoad } from '../lib/plates.js'
+import { ownedWeightsFor, stepOwned } from '../lib/dumbbells.js'
import Icon from '../components/Icon.jsx'
import { Button, Stepper } from '../components/ui.jsx'
import './FocusView.css'
@@ -125,6 +126,9 @@ export default function FocusView({
const effortValue = effortField ? set[effortField] ?? null : null
const effortTint = effortValue == null ? null : effortColor(rirOf({ [effortField]: effortValue }))
const loadStep = weightIncrement({ ...(entry.target || {}), id: entry.id }, S.unit)
+ // Bell to bell over the dumbbells you own, when the profile lists them (issue #376).
+ const owned = mode === 'reps' ? ownedWeightsFor(S, { ...(entry.target || {}), id: entry.id }) : null
+ const stepLoad = owned ? (v, _step, dir) => stepOwned(owned, v, dir) : stepWeight
const selectSet = index => setPointerState(current => {
const next = new Map(current.epoch === pointerEpoch ? current.pointers : [])
next.set(entryIdx, clampSet(entry, index))
@@ -165,14 +169,14 @@ export default function FocusView({
onClick={() => onToggleSide(setIdx, side,
!sideSet.done && (set.sides.L.done || set.sides.R.done) ? onProgress : undefined)}><Icon name="check" /></button>
</div>
- <Stepper label={t('Load ({0})', S.unit)} ariaLabel="load" value={sideSet.w || 0} step={loadStep} onStep={stepWeight} disabled={readOnly || sideSet.done}
+ <Stepper label={t('Load ({0})', S.unit)} ariaLabel="load" value={sideSet.w || 0} step={loadStep} onStep={stepLoad} disabled={readOnly || sideSet.done}
onChange={value => change('w', value)} />
<Stepper label={t('Reps')} ariaLabel="reps" value={sideSet.r || 0} step={1} decimal={false} disabled={readOnly || sideSet.done}
onChange={value => change('r', value)} />
<div className="focus-extras">
{sideDrops.map((drop, index) => <div className="focus-extra" key={`drop-${index}`}>
<span>{t('Drop {0}', index + 1)}</span>
- <Stepper label={t('Load')} ariaLabel="load" value={drop.w || 0} step={loadStep} onStep={stepWeight} disabled={readOnly || sideSet.done}
+ <Stepper label={t('Load')} ariaLabel="load" value={drop.w || 0} step={loadStep} onStep={stepLoad} disabled={readOnly || sideSet.done}
onChange={value => onMutateSet(setIdx, row => setSideDropAt(row, side, index, { w: value }))} />
<Stepper label={t('Reps')} ariaLabel="reps" value={drop.r || 0} step={1} decimal={false} disabled={readOnly || sideSet.done}
onChange={value => onMutateSet(setIdx, row => setSideDropAt(row, side, index, { r: value }))} />
@@ -280,7 +284,7 @@ export default function FocusView({
<Stepper label={t('Speed (km/h)')} ariaLabel="speed" value={set.speed || 0} step={0.5} disabled={readOnly}
onChange={value => onField(setIdx, 'speed', value)} />
</> : <>
- <Stepper label={t('Load ({0})', S.unit)} ariaLabel="load" value={set.w || 0} step={loadStep} onStep={stepWeight} disabled={readOnly}
+ <Stepper label={t('Load ({0})', S.unit)} ariaLabel="load" value={set.w || 0} step={loadStep} onStep={stepLoad} disabled={readOnly}
onChange={value => onField(setIdx, 'w', value)} />
{mode === 'time' ? <div className="focus-timed">
<strong>{t('{0}s hold', set.sec || entry.target?.sec || 45)}</strong>
@@ -292,7 +296,7 @@ export default function FocusView({
<div className="focus-extras">
{drops.map((drop, index) => <div className="focus-extra" key={`drop-${index}`}>
<span>{t('Drop {0}', index + 1)}</span>
- <Stepper label={t('Load')} ariaLabel="load" value={drop.w || 0} step={loadStep} onStep={stepWeight} disabled={readOnly}
+ <Stepper label={t('Load')} ariaLabel="load" value={drop.w || 0} step={loadStep} onStep={stepLoad} disabled={readOnly}
onChange={value => onMutateSet(setIdx, row => setDropAt(row, index, { w: value }))} />
<Stepper label={t('Reps')} ariaLabel="reps" value={drop.r || 0} step={1} decimal={false} disabled={readOnly}
onChange={value => onMutateSet(setIdx, row => setDropAt(row, index, { r: value }))} />
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index f2eb01a06..93322ffc1 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -9,6 +9,7 @@ import { copyText } from '../lib/clipboard.js'
import { useUI } from '../store/useUI.js'
import { ACCENTS, ACCENT_NAMES, todayISO, localTZ, weekStartOf, MONDAY, SUNDAY, fmtPlate } from '../lib/format.js'
import { inventoryFor, ownsPlates } from '../lib/plates.js'
+import { dumbbellsOf } from '../lib/dumbbells.js'
import { effortOf } from '../lib/history.js'
import { figureOf } from '../lib/exercises.js'
import { unlock, playOnSilentSupported, vibrateSupported, appleTouchDevice } from '../lib/sound.js'
@@ -32,7 +33,7 @@ import { CUSTOM, accentKey, adjustedIn, applyAccent, cleanHex, inkOn, isGrey } f
import { checkForUpdate, downloadAndInstall } from '../lib/update.js'
import { forgetCoach } from '../lib/coach-api.js'
import { REST_MAX, REST_PAUSE_MIN, REST_PAUSE_MAX, fmtRest, fmtDuration } from '../lib/duration.js'
-import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, menuSheet } from '../sheets.jsx'
+import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, plateInventorySheet, dumbbellInventorySheet, menuSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { durationSheet } from '../components/DurationWheel.jsx'
import { showsConnection, showsLocalLine } from '../components/SyncBanner.jsx'
@@ -1255,8 +1256,14 @@ function EquipmentCard({ S, update }) {
const plateSummary = ownsPlates(S)
? inventoryFor(S).map(p => fmtPlate(p.w) + '×' + p.n).join(' · ') || t('None')
: t('Standard set. Tap to count the pairs you own.')
+ // The dumbbells you own, per unit (lib/dumbbells.js): what dumbbell lifts step and progress over.
+ const bells = dumbbellsOf(S)
+ const dumbbellSummary = bells.length
+ ? bells.map(fmtPlate).join(' · ')
+ : t('Any weight. Tap to list the ones 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()} />
+ <Row icon="dumbbell" iconTint="var(--teal)" title={t('Dumbbells')} subtitle={dumbbellSummary} accessory="chevron" onClick={() => dumbbellInventorySheet()} />
{profiles.length > 0 && <Row icon="kettlebell" 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.dumbbells.test.jsx b/frontend/src/views/Workout.dumbbells.test.jsx
index 6ea334bb4..2f53d34c3 100644
--- a/frontend/src/views/Workout.dumbbells.test.jsx
+++ b/frontend/src/views/Workout.dumbbells.test.jsx
@@ -1,6 +1,7 @@
// @vitest-environment happy-dom
// Dumbbells on the workout screen: the weight column says what the number means when the exercise
-// said (issue #474), and stays "Weight" for one-arm work and for everything as entered.
+// said (issue #474), and stays "Weight" for one-arm work and for everything as entered. With the
+// dumbbells you own listed (#376), + and − walk from bell to bell.
import React, { act } from 'react'
import { createRoot } from 'react-dom/client'
import { MemoryRouter } from 'react-router-dom'
@@ -60,3 +61,36 @@ describe('dumbbell weight column', () => {
expect(heads()).toEqual(['Weight (kg)', 'Weight (kg)'])
})
})
+
+describe('stepper over owned dumbbells', () => {
+ const RACK = [3, 6, 8, 9, 11, 13, 15, 17, 18, 19, 21, 24]
+ const weightOf = () => container.querySelector('.stp input').value
+ const tap = label => act(() => container.querySelector('.stp [aria-label="' + label + '"]').click())
+
+ it('walks the bells you own', () => {
+ mount([entry('0294', [work(9)], { inc: 2 })], { dumbbells: { kg: { weights: RACK, _ts: 1 } } })
+ tap('Increase')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(11)
+ tap('Increase')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(13)
+ tap('Decrease')
+ tap('Decrease')
+ tap('Decrease')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(8)
+ expect(weightOf()).toBe('8')
+ })
+
+ it('keeps the increment without a list', () => {
+ mount([entry('0294', [work(9)], { inc: 2 })], {})
+ tap('Increase')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(11)
+ tap('Increase')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(13)
+ tap('Decrease')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(11)
+ // From an even weight the grid takes over again: 10 + 2 = 12, which no rack above holds.
+ act(() => useStore.setState(st => { const S = clone(st.S); S.active.entries[0].sets[0].w = 10; return { S } }))
+ tap('Increase')
+ expect(useStore.getState().S.active.entries[0].sets[0].w).toBe(12)
+ })
+})
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 344a95400..1e62d5c86 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -43,7 +43,7 @@ import { canMoveActiveWorkoutUnit, moveActiveWorkoutUnit, canMoveActiveWorkoutEn
import { nextOpenSet, workoutKeyAction } from '../lib/workout-keys.js'
import { MUSCLE_NAME } from '../lib/muscles.js'
import FocusView from './FocusView.jsx'
-import { withMeaning, historyAs, dbLoadFor, entryDbLoad, bellsIn } from '../lib/dumbbells.js'
+import { withMeaning, historyAs, dbLoadFor, entryDbLoad, bellsIn, ownedWeightsFor, stepOwned } from '../lib/dumbbells.js'
// How long after a key starts a hold the same key is not yet its "Done" (#133). A USB button
// that bounces, or a double press, sends two presses a moment apart: the first starts the hold,
@@ -259,6 +259,10 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
// R sub-row, each with its own weight/reps/effort and done tick. Warm-ups stay single.
const perSide = mode === 'reps' && isPerSide(cfg)
const loadStep = mode === 'reps' ? weightIncrement(cfg, S.unit) : 2.5
+ // With the dumbbells you own listed (issue #376), + and − walk from bell to bell — 9, 11, 13 —
+ // instead of along the increment's grid; an off-list weight goes to the nearest bell that way.
+ const owned = mode === 'reps' ? ownedWeightsFor(S, cfg) : null
+ const stepLoad = (v, step, dir) => (owned ? stepOwned(owned, v, dir) : stepWeight(v, step, dir))
// The weight column says what a dumbbell weight means when the exercise has said (#474): one
// bell or both together. A one-arm exercise holds one bell, so its plain heading is already true.
const bells = !bw && bellsIn(cfg) === 2 ? meaning : 'as'
@@ -294,7 +298,7 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
// closure problem entirely and keeps every tap operating on the real current value.
const fresh = useStore.getState().S.active?.entries[entryIdx]?.sets[i]
const cur = fresh ? fresh[col.f] : s[col.f]
- if (mode === 'reps' && col.f === 'w') return onField(i, col.f, stepWeight(cur, col.step, dir))
+ if (mode === 'reps' && col.f === 'w') return onField(i, col.f, stepLoad(cur, col.step, dir))
// The step is in the unit on screen: +0.5 mph, not +0.5 km/h shown as +0.31.
const next = Math.max(0, Math.round(((viewOf(col, cur) || 0) + dir * col.step) * 100) / 100)
onField(i, col.f, col.store ? col.store(next) : next)
@@ -481,7 +485,7 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
const sideBump = (i, side, col, dir) => {
const fresh = useStore.getState().S.active?.entries[entryIdx]?.sets[i]?.sides?.[side]
const cur = fresh ? fresh[col.f] : 0
- if (col.f === 'w') return setSide(i, side, col.f, stepWeight(cur, col.step, dir))
+ if (col.f === 'w') return setSide(i, side, col.f, stepLoad(cur, col.step, dir))
// Reps step by one per side: repCol's step of two keeps the *combined* total evenly
// splittable, but here each side is logged directly, so one tap is one rep.
const step = col.f === 'r' ? 1 : col.step
@@ -555,9 +559,9 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
// live "+ Drop"/"+ Burst" tap) already put on the row, not typing into a fresh field.
const miniStepper = (value, step, dec, onChange, snapWeightStep = false) => (
<div className="stp mini">
- <button aria-label={t('Decrease')} onClick={() => onChange(snapWeightStep ? stepWeight(value, step, -1) : Math.max(0, Math.round(((value || 0) - step) * 100) / 100))}><Icon name="minus" /></button>
+ <button aria-label={t('Decrease')} onClick={() => onChange(snapWeightStep ? stepLoad(value, step, -1) : Math.max(0, Math.round(((value || 0) - step) * 100) / 100))}><Icon name="minus" /></button>
<span className="val"><NumberField decimal={dec} value={value ?? ''} onChange={onChange} /></span>
- <button aria-label={t('Increase')} onClick={() => onChange(snapWeightStep ? stepWeight(value, step, 1) : Math.max(0, Math.round(((value || 0) + step) * 100) / 100))}><Icon name="plus" /></button>
+ <button aria-label={t('Increase')} onClick={() => onChange(snapWeightStep ? stepLoad(value, step, 1) : Math.max(0, Math.round(((value || 0) + step) * 100) / 100))}><Icon name="plus" /></button>
</div>
)
// A plain set row (anything but a reps L/R stack). Its own function since a timed per-side
@@ -1139,7 +1143,9 @@ function ActiveWorkout() {
const removeSet = idx => mutEntry(idx, e => { e.sets = removeLastSet(e.sets) })
const addWarmup = idx => mutEntry(idx, e => {
const m = modeOf({ ...(e.target || {}), id: e.id })
- e.sets = insertWarmupRow(e.sets, m, e.target || {}, defaultIncrement(e.id, S.unit), barFloor(S, e.id))
+ // A warm-up of a dumbbell lift lands on a bell you own when the profile lists them (#376).
+ const ramp = (m === 'reps' && ownedWeightsFor(S, { ...(e.target || {}), id: e.id })) || defaultIncrement(e.id, S.unit)
+ e.sets = insertWarmupRow(e.sets, m, e.target || {}, ramp, barFloor(S, e.id))
})
// The set-number menu's Remove and the swipe both go through deleteActiveSet, Undo and all.
const removeSetAt = (idx, i) => deleteActiveSet(idx, i, { editing })
@@ -1363,7 +1369,7 @@ function ActiveWorkout() {
// buildPlannedEntry does for a planned exercise (lib/dumbbells.js).
const built = freestyle
? { target: withMeaning(s, cfg, ex.id), plan: null, sets: applyIntensifierPlan(buildSets(historyAs(past, ex.id, dbLoadFor(s, full)), full, {
- step: modeOf(full) === 'reps' ? weightIncrement(full, s.unit) : defaultIncrement(ex.id, s.unit), preferLast: true,
+ step: modeOf(full) === 'reps' ? (ownedWeightsFor(s, full) || weightIncrement(full, s.unit)) : defaultIncrement(ex.id, s.unit), preferLast: true,
}), full, dropGrid(s, full)) }
: buildPlannedEntry(past, full, routine, { noProg })
const insertAt = insertionIndexAfterCurrentUnit(supersetUnits(s.active.entries), s.active.cur, s.active.entries.length)
diff --git a/frontend/src/views/settings-pages.js b/frontend/src/views/settings-pages.js
index c1cc04c49..8ef823070 100644
--- a/frontend/src/views/settings-pages.js
+++ b/frontend/src/views/settings-pages.js
@@ -96,6 +96,7 @@ export const SEARCH = [
{ page: 'units', title: '1RM formula', icon: 'chart', tint: 'var(--teal)', kw: '1rm one rep max epley brzycki lombardi formula estimate' },
// Equipment
{ page: 'equipment', title: 'Plates', icon: 'plate', tint: 'var(--orange)', kw: 'plates bar plate math barbell' },
+ { page: 'equipment', title: 'Dumbbells', icon: 'dumbbell', tint: 'var(--teal)', kw: 'dumbbells dumbbell rack inventory adjustable weights own home gym' },
{ page: 'equipment', title: 'Filter by equipment', icon: 'kettlebell', tint: 'var(--green)', kw: 'equipment filter home gym', when: c => c.profiles },
{ page: 'equipment', title: 'Active profile', icon: 'house', tint: 'var(--blue)', kw: 'equipment profile home gym', when: c => c.profiles },
{ page: 'equipment', title: 'Add equipment profile', icon: 'plusCircle', tint: 'var(--green)', kw: 'equipment profile home gym hotel' },