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(rest): "No timer" for one exercise, rest wheels open on the rest that applies (#735)

Duarte Santos8727ee09050a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9cb3c606..d4a0f84d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,6 +64,12 @@ per muscle. Settings → Workout → Fine-tuning turns it off.
(#736, thanks @lodepav). Jumping jacks, burpees, star jumps and tuck jumps start as sets × reps
instead of minutes and speed (#717, thanks @zykll18). Only fresh picks: what's already in your
routines and history stays exactly as you set it up.
+- **"No timer" for a single exercise.** Rest for this exercise now has the same three choices as
+ the warm-ups: your default, No timer, or a time of its own. Stretches and carries can finally
+ skip the countdown while your squats keep theirs. Saved in routines, shared plans and backups.
+- **The rest wheel starts where your rest is.** Pick a time opens on the rest that applies right
+ now (the exercise's, the warm-ups', or your default) instead of sitting at 0:00 (#735, thanks
+ @lodepav).
**Security.** Follow-ups to v1.4.2's audit.
- **Pairing the phone app asks you to confirm it's you** (passkey, or your password where that
diff --git a/api/test/rest-off-data-safety.test.js b/api/test/rest-off-data-safety.test.js
new file mode 100644
index 000000000..3711c59a6
--- /dev/null
+++ b/api/test/rest-off-data-safety.test.js
@@ -0,0 +1,30 @@
+/* DATA SAFETY on the server for an exercise's own "No timer" (`restOff` on a routine entry): it
+ survives PUT /api/data's stamping, also when an app from before it writes over it. */
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { stampPut } from '../sync-stamps.js';
+
+const old = () => ({
+ _ts: 100, unit: 'kg',
+ routines: [{ id: 'r1', name: 'Upper', _ts: 7, ex: [{ id: '0025', sets: 3, reps: 8, weight: 60 }] }],
+});
+const withNew = () => {
+ const S = old();
+ S.routines[0].ex[0] = { ...S.routines[0].ex[0], restOff: true };
+ return S;
+};
+
+test('a stamped write keeps restOff as sent', () => {
+ const next = withNew();
+ next._ts = 200;
+ const out = stampPut(old(), next, { stamped: true, now: 300 });
+ assert.equal(out.routines[0].ex[0].restOff, true);
+});
+
+test('an app from before it, writing its copy of the routine, does not take it away', () => {
+ const cur = withNew();
+ const next = old(); // it rebuilt the exercise from the fields it knows
+ next._ts = 200;
+ const out = stampPut(cur, next, { stamped: false, overRead: true, now: 300 });
+ assert.equal(out.routines[0].ex[0].restOff, true);
+});
diff --git a/frontend/src/lib/duration.js b/frontend/src/lib/duration.js
index b04b2b66c..b2efd6d6b 100644
--- a/frontend/src/lib/duration.js
+++ b/frontend/src/lib/duration.js
@@ -53,3 +53,7 @@ export function durationText(sec, { off = null } = {}) {
/** The rest timer's own wording for a row or a preview: "1:30" or "Off". */
export const fmtRest = sec => fmtDuration(sec, { off: t('Off') })
+
+/** Where a rest wheel opens (#735): on the rest of its own, else on the one that applies without
+ * it, so the dials show the break you'd actually get instead of sitting at 0:00. */
+export const restWheelValue = (own, applies) => (own > 0 ? Math.round(own) : applies > 0 ? Math.round(applies) : 0)
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index fa2b1c489..180b79db9 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -126,6 +126,7 @@ function cleanEx(e) {
// only when set, so a plan that never asked for one leaves the recipient's own default
// timer in charge. parsePlan and mergePlan carry it through by spread.
if (e.restSec > 0) o.restSec = e.restSec
+ else if (e.restOff === true) o.restOff = true // "No timer" for this exercise
if (e.warmupRestSec > 0) o.warmupRestSec = e.warmupRestSec // the ramp's own rest travels with the work rest
// The warm-ups' "no timer" and the break between sides travel the same way, only when set.
// Planned substitutes (lib/routine-backups.js): the catalogue's only, since the other end may
@@ -273,6 +274,7 @@ export function parsePlan(raw, destinationUnit = 'kg') {
const warm = cleanWarmupSets(e.warmupSets)
const intens = cleanIntensifier(e.intensifier)
const rest = cleanRestSec(e.restSec)
+ const restOff = e.restOff === true
const warmRest = cleanRestSec(e.warmupRestSec)
const warmOff = e.warmupRestOff === true
const sideRest = cleanRestSec(e.sideRestSec)
@@ -286,9 +288,9 @@ export function parsePlan(raw, destinationUnit = 'kg') {
const pyramid = normalizePyramid(e.pyramid)
const pyramidRest = pyramid.length ? normalizePyramidRest(e.pyramidRest, pyramid.length) : []
const pyramidWeight = pyramid.length ? normalizePyramidWeight(e.pyramidWeight, pyramid.length) : []
- const { warmupSets, intensifier, restSec, warmupRestSec, warmupRestOff: _warmOff, sideRestSec: _sideRest, sideRestOff: _sideOff, subs: _subs, pyramid: _pyramid, pyramidRest: _pyramidRest, pyramidWeight: _pyramidWeight, sgName: _sgName, sgRest: _sgRest, incline: _incline, ...passthrough } = e
+ const { warmupSets, intensifier, restSec, restOff: _restOff, warmupRestSec, warmupRestOff: _warmOff, sideRestSec: _sideRest, sideRestOff: _sideOff, subs: _subs, pyramid: _pyramid, pyramidRest: _pyramidRest, pyramidWeight: _pyramidWeight, sgName: _sgName, sgRest: _sgRest, incline: _incline, ...passthrough } = e
if (!known.has(passthrough.id)) passthrough.id = canonicalExId(passthrough.id)
- return convertedExercise({ ...passthrough, ...(pyramid.length ? { pyramid } : {}), ...(pyramidRest.length ? { pyramidRest } : {}), ...(pyramidWeight.length ? { pyramidWeight } : {}), ...(warm ? { warmupSets: warm } : {}), ...(intens ? { intensifier: intens } : {}), ...(rest ? { restSec: rest } : {}), ...(warmOff ? { warmupRestOff: true } : warmRest ? { warmupRestSec: warmRest } : {}), ...(sideOff ? { sideRestOff: true } : sideRest ? { sideRestSec: sideRest } : {}), ...(subs.length ? { subs } : {}), ...(sgName ? { sgName } : {}), ...(sgRest ? { sgRest } : {}), ...(incline > 0 ? { incline } : {}) }, sourceUnit || destination, destination)
+ return convertedExercise({ ...passthrough, ...(pyramid.length ? { pyramid } : {}), ...(pyramidRest.length ? { pyramidRest } : {}), ...(pyramidWeight.length ? { pyramidWeight } : {}), ...(warm ? { warmupSets: warm } : {}), ...(intens ? { intensifier: intens } : {}), ...(rest ? { restSec: rest } : restOff ? { restOff: true } : {}), ...(warmOff ? { warmupRestOff: true } : warmRest ? { warmupRestSec: warmRest } : {}), ...(sideOff ? { sideRestOff: true } : sideRest ? { sideRestSec: sideRest } : {}), ...(subs.length ? { subs } : {}), ...(sgName ? { sgName } : {}), ...(sgRest ? { sgRest } : {}), ...(incline > 0 ? { incline } : {}) }, sourceUnit || destination, destination)
})
}))
return {
diff --git a/frontend/src/lib/plan-share.test.js b/frontend/src/lib/plan-share.test.js
index c9ff55f36..aa95e3b75 100644
--- a/frontend/src/lib/plan-share.test.js
+++ b/frontend/src/lib/plan-share.test.js
@@ -110,6 +110,15 @@ describe('what survives a shared plan', () => {
expect(roundTrip({ restSec: 180 }).restSec).toBe(180)
})
+ // Discord (lajawi): an exercise's own "No timer" is part of the prescription too.
+ it('carries an exercise’s "No timer", and only a real one', () => {
+ expect(roundTrip({ restOff: true })).toMatchObject({ restOff: true })
+ expect('restSec' in roundTrip({ restOff: true })).toBe(false)
+ expect(roundTrip({ restOff: true, restSec: 120 })).toMatchObject({ restSec: 120 })
+ expect('restOff' in roundTrip({ restOff: true, restSec: 120 })).toBe(false)
+ for (const e of [{}, { restOff: false }, { restOff: 'yes' }]) expect('restOff' in roundTrip(e), JSON.stringify(e)).toBe(false)
+ })
+
// The ramp's own rest is the same kind of prescription: a shared plan whose warm-up sets
// arrive resting the full working rest is not the plan that was written.
it('carries a per-exercise warm-up rest, and leaves it out when unset', () => {
diff --git a/frontend/src/lib/rest-off.data-safety.test.js b/frontend/src/lib/rest-off.data-safety.test.js
new file mode 100644
index 000000000..2812f8047
--- /dev/null
+++ b/frontend/src/lib/rest-off.data-safety.test.js
@@ -0,0 +1,53 @@
+// @vitest-environment happy-dom
+import { describe, expect, it } from 'vitest'
+import { restoredStateFor } from '../store/useStore.js'
+import { mergeStates } from './sync-merge.js'
+import { exportBackupZip, readBackupFile } from './backup-media.js'
+import { createMediaStore, memoryBackend } from './media-store.js'
+import { parsePlan, buildPlanBundle } from './plan-share.js'
+import { restSecFor } from './supersetFlow.js'
+
+/* DATA SAFETY for an exercise's own "No timer" (Discord lajawi): one optional `restOff: true` on a
+ routine entry and a session target. Nothing existing changes meaning: a 0 or missing restSec
+ still follows the default. A profile with it keeps it through loading, merging, backups and plan
+ files; an app from before it reads such an exercise as following the default, as it always did. */
+const OLD = () => ({
+ _ts: 1760000000000, unit: 'kg',
+ routines: [{ id: 'r1', name: 'Upper', _ts: 7, ex: [
+ { id: '0025', sets: 3, reps: 8, weight: 60, restSec: 150 },
+ { id: '0098', sets: 3, reps: 10, weight: 20 },
+ ] }],
+ week: { 1: ['r1'] }, workouts: [],
+})
+const NEW = () => {
+ const S = OLD()
+ S.routines[0].ex[1] = { ...S.routines[0].ex[1], restOff: true }
+ return S
+}
+
+describe('an exercise on "No timer"', () => {
+ it('a profile from before it gains nothing', () => {
+ const loaded = restoredStateFor({}, OLD())
+ expect(JSON.stringify(loaded.routines)).not.toMatch(/restOff/)
+ expect(JSON.stringify(mergeStates(OLD(), OLD()).routines)).not.toMatch(/restOff/)
+ expect(JSON.stringify(parsePlan(JSON.stringify(buildPlanBundle(OLD(), 'Plan'))))).not.toMatch(/restOff/)
+ })
+ it('loads with it and keeps it through a merge with a copy from before it', () => {
+ expect(restoredStateFor({}, NEW()).routines).toEqual(NEW().routines)
+ const m = mergeStates({ ...NEW(), routines: [{ ...NEW().routines[0], _ts: 99 }] }, OLD())
+ expect(m.routines[0].ex[1].restOff).toBe(true)
+ })
+ it('keeps it through a backup and a shared plan', async () => {
+ const S = NEW()
+ const out = await exportBackupZip(S, { media: createMediaStore(memoryBackend()) })
+ const read = await readBackupFile(new File([out.blob], 'b.zip'))
+ expect(read.state.routines).toEqual(S.routines)
+ expect(parsePlan(JSON.stringify(buildPlanBundle(S, 'Plan'))).routines[0].ex[1].restOff).toBe(true)
+ })
+ it('reads the way an older app would where restOff is unknown: like the default', () => {
+ // What v1.4.2 resolved for an exercise without a rest of its own.
+ const { restOff: _off, ...asOld } = NEW().routines[0].ex[1]
+ expect(restSecFor([{ target: asOld, sets: [] }], [0], 90)).toBe(90)
+ expect(restSecFor([{ target: NEW().routines[0].ex[1], sets: [] }], [0], 90)).toBe(0)
+ })
+})
diff --git a/frontend/src/lib/routines.js b/frontend/src/lib/routines.js
index fe1df25a1..1cd87f1b3 100644
--- a/frontend/src/lib/routines.js
+++ b/frontend/src/lib/routines.js
@@ -3,6 +3,7 @@ import { defaultConfig, isBw, modeOf, MAX_PLANNED_WARMUPS, NOTE_MAX } from './hi
import { isAssisted, isBodyweightEq, isCardio } from './exercises.js'
import { sessionsFor } from './progression.js'
import { isWarmupRow } from './workout-model.js'
+import { ownExerciseRest } from './supersetFlow.js'
/**
* Create a deep copy of a routine with a new id and a "(Copy)" suffix.
@@ -143,7 +144,7 @@ export function replaceSlotExercise(slot, id, S, rid) {
const old = slot || {}
if (old.id === id) return { ...old }
if ((modeOf(old) === 'cardio') !== isCardio(id)) {
- const kept = ['sg', 'note', 'restSec', 'subs'].filter(key => old[key] != null)
+ const kept = ['sg', 'note', 'restSec', 'restOff', 'subs'].filter(key => old[key] != null)
return dropSelfBackup({ id, ...defaultConfig(id), ...Object.fromEntries(kept.map(key => [key, old[key]])) })
}
const { id: _replaced, bodyweight: _flag, assisted: _assisted, side: _side, ...carried } = old
@@ -190,10 +191,13 @@ export function routineSlotIndex(routine, entries, idx) {
// A key that does not apply to the exercise is left out, so it can never overwrite the slot's own:
// a cardio interval has no warm-ups, and rest-pause builds its own warm-up row (ExConfig hides
// the stepper for both).
+// A rest reads as one number: its own seconds, 0 for the default, and -1 for "No timer" (restOff).
+const restOf = x => { const own = ownExerciseRest(x); return own === 0 ? -1 : own || 0 }
+
function setupOf(entry) {
const target = entry.target || {}
const out = {
- restSec: Math.max(0, Math.round(Number(target.restSec)) || 0),
+ restSec: restOf(target),
note: String(target.note || '').trim().slice(0, NOTE_MAX),
}
if (modeOf({ ...target, id: entry.id }) !== 'cardio' && target.intensifier?.type !== 'restpause') {
@@ -220,7 +224,7 @@ export function routineChangesFromEntry(routine, entries, idx) {
const changes = []
for (const key of ['warmupSets', 'restSec', 'note']) {
if (now[key] === undefined) continue
- const from = key === 'note' ? String(slot.note || '').trim() : Math.max(0, Math.round(Number(slot[key])) || 0)
+ const from = key === 'note' ? String(slot.note || '').trim() : key === 'restSec' ? restOf(slot) : Math.max(0, Math.round(Number(slot[key])) || 0)
if (from !== now[key]) changes.push({ key, from, to: now[key] })
}
return changes.length ? { at, changes } : null
@@ -236,7 +240,10 @@ export function updateRoutineFromEntry(routine, entries, idx) {
if (!found) return null
const slot = routine.ex[found.at]
for (const { key, to } of found.changes) {
- if (to) slot[key] = to
+ // "No timer" is stored as restOff, never as a negative rest an older app would misread.
+ if (key === 'restSec') delete slot.restOff
+ if (key === 'restSec' && to < 0) { delete slot.restSec; slot.restOff = true }
+ else if (to) slot[key] = to
else delete slot[key]
}
return found.changes
diff --git a/frontend/src/lib/routines.update.test.js b/frontend/src/lib/routines.update.test.js
index 31e425732..59c6be243 100644
--- a/frontend/src/lib/routines.update.test.js
+++ b/frontend/src/lib/routines.update.test.js
@@ -124,3 +124,26 @@ describe('updateRoutineFromEntry', () => {
expect(routine.ex[0]).toEqual({ id: BENCH, sets: 3 })
})
})
+
+// Discord (lajawi): "No timer" for an exercise is `restOff`, never a 0 or a negative rest.
+describe('updateRoutineFromEntry with an exercise on "No timer"', () => {
+ it('offers it as a rest change and stores it as restOff', () => {
+ const routine = { id: 'A', ex: [{ id: BENCH, sets: 3, restSec: 90 }] }
+ const entries = [entry(BENCH, work(3), { restOff: true })]
+ expect(routineChangesFromEntry(routine, entries, 0).changes).toEqual([{ key: 'restSec', from: 90, to: -1 }])
+ updateRoutineFromEntry(routine, entries, 0)
+ expect(routine.ex[0]).toEqual({ id: BENCH, sets: 3, restOff: true })
+ })
+ it('and back to the default or a time takes restOff away again', () => {
+ const routine = { id: 'A', ex: [{ id: BENCH, sets: 3, restOff: true }] }
+ updateRoutineFromEntry(routine, [entry(BENCH, work(3), { restSec: 0 })], 0)
+ expect(routine.ex[0]).toEqual({ id: BENCH, sets: 3 })
+ routine.ex[0].restOff = true
+ updateRoutineFromEntry(routine, [entry(BENCH, work(3), { restSec: 75 })], 0)
+ expect(routine.ex[0]).toEqual({ id: BENCH, sets: 3, restSec: 75 })
+ })
+ it('a session that kept the routine’s "No timer" has nothing to update', () => {
+ const routine = { id: 'A', ex: [{ id: BENCH, sets: 3, restOff: true }] }
+ expect(routineChangesFromEntry(routine, [entry(BENCH, work(3), { restOff: true })], 0)).toBeNull()
+ })
+})
diff --git a/frontend/src/lib/supersetFlow.js b/frontend/src/lib/supersetFlow.js
index b3feae90c..5575d7951 100644
--- a/frontend/src/lib/supersetFlow.js
+++ b/frontend/src/lib/supersetFlow.js
@@ -108,11 +108,24 @@ export function restSecFor(entries, unit, defaultRestSec, setRest = null) {
return idxs.reduce((longest, idx) => {
// `setRest` is the ticked set's own rest ({ idx, sec }, a pyramid set): it stands in for
// that member's exercise rest, and a superset still takes the longest of the group.
- const own = setRest && setRest.idx === idx && setRest.sec > 0 ? setRest.sec : entries?.[idx]?.target?.restSec
- return Math.max(longest, own > 0 ? own : fallback)
+ const own = setRest && setRest.idx === idx && setRest.sec > 0 ? setRest.sec : ownExerciseRest(entries?.[idx]?.target)
+ return Math.max(longest, own ?? fallback)
}, 0)
}
+/**
+ * An exercise's own rest after its work sets: its `restSec`, 0 when it is set to "No timer"
+ * (`restOff`, Discord: a 0:00 rest used to mean "the default", so there was no way to say none),
+ * or null when it has none of its own and the default applies. Older apps don't know `restOff`
+ * and read such an exercise as following the default, which is what it did before. A time picked
+ * on one of them next to a restOff it kept wins: it is the newer choice.
+ */
+export function ownExerciseRest(target) {
+ const v = Math.round(Number(target?.restSec)) || 0
+ if (v > 0) return v
+ return target?.restOff === true ? 0 : null
+}
+
/**
* The rest a completed set earns when it was a warm-up ramp set.
*
diff --git a/frontend/src/lib/supersetFlow.test.js b/frontend/src/lib/supersetFlow.test.js
index 2aea88aad..ef317663a 100644
--- a/frontend/src/lib/supersetFlow.test.js
+++ b/frontend/src/lib/supersetFlow.test.js
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor, sideRestFor, ownSetRest, stepUnitIndex, advanceAfterTimedRest } from './supersetFlow.js'
+import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor, sideRestFor, ownSetRest, ownExerciseRest, stepUnitIndex, advanceAfterTimedRest } from './supersetFlow.js'
const entry = done => ({ sets: done.map(value => ({ done: value })) })
@@ -288,3 +288,32 @@ describe('advanceAfterTimedRest (#532)', () => {
})
})
+
+// Discord (lajawi): an exercise can say "No timer" for itself (`restOff`), where a 0 rest has
+// always meant "the default".
+describe('an exercise on "No timer"', () => {
+ const ex = (target, sets = [{ done: true }, { done: false }]) => ({ target, sets })
+ it('rests nothing after its sets, whatever the default is', () => {
+ expect(restSecFor([ex({ restOff: true })], [0], 90)).toBe(0)
+ expect(restSecFor([ex({ restSec: 0 })], [0], 90)).toBe(90)
+ expect(restSecFor([ex({})], [0], 90)).toBe(90)
+ })
+ it('in a superset the other member’s rest still applies, the longest as always', () => {
+ expect(restSecFor([ex({ restOff: true, sg: 'a' }), ex({ sg: 'a' })], [0, 1], 90)).toBe(90)
+ expect(restSecFor([ex({ restOff: true, sg: 'a' }), ex({ restOff: true, sg: 'a' })], [0, 1], 90)).toBe(0)
+ })
+ it('a pyramid set’s own rest still stands in for it', () => {
+ expect(restSecFor([ex({ restOff: true })], [0], 90, { idx: 0, sec: 45 })).toBe(45)
+ })
+ it('a time picked next to it on an older app wins, and garbage reads as the default', () => {
+ expect(ownExerciseRest({ restOff: true, restSec: 120 })).toBe(120)
+ expect(ownExerciseRest({ restOff: true })).toBe(0)
+ expect(ownExerciseRest({ restOff: 'yes' })).toBeNull()
+ expect(ownExerciseRest({ restSec: -5 })).toBeNull()
+ expect(ownExerciseRest(undefined)).toBeNull()
+ })
+ it('its last warm-up goes into the first work set without a timer too', () => {
+ const e = { target: { restOff: true }, sets: [{ phase: 'warmup', done: true }, { done: false }] }
+ expect(warmupRestSecFor(e, 0, restSecFor([e], [0], 90), undefined)).toBe(0)
+ })
+})
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index f5e8c786d..e6b2da3f8 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -732,7 +732,7 @@ export default {
'Keep replacement in this group': 'إبقاء البديل في هذه المجموعة',
'Insert after this group': 'إدراج بعد هذه المجموعة',
'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'تبقى المجموعات المسجلة مع التمرين الأصلي. سيُدرج البديل بعده.',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'الراحة بعد كل مجموعة من هذا التمرين. عند 0:00 تُستخدم راحتك الافتراضية.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'الراحة بعد كل مجموعة من هذا التمرين. «بلا مؤقت» يعني بلا عدّ تنازلي، تبدأ متى كنت جاهزًا.',
'Import from Hevy': 'استيراد من Hevy',
'Pull your history with a Hevy Pro API key': 'اسحب سجلك باستخدام مفتاح Hevy Pro API',
'Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'اسحب سجلك باستخدام مفتاح Hevy Pro API. يُستخدم المفتاح لهذا الاستيراد فقط ولا يُحفظ.',
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 10c256a3f..75dcb2e62 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -215,7 +215,7 @@ export default {
'Remove drop': 'ড্রপ সরান',
'Remove burst': 'বার্স্ট সরান',
'Rest (s)': 'বিশ্রাম (সে.)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'এই ব্যায়ামের প্রতিটি সেটের পরে বিশ্রাম। 0:00 মানে আপনার ডিফল্ট বিশ্রাম।',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'এই ব্যায়ামের প্রতিটি সেটের পরে বিশ্রাম। টাইমার নেই মানে কোনো কাউন্টডাউন নেই, তৈরি হলেই শুরু করুন।',
'Drop-set / rest-pause': 'ড্রপ সেট / রেস্ট-পজ',
'Intensifier': 'ইনটেনসিফায়ার',
'None': 'কিছু না',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index b8e95d69c..42a233652 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -192,7 +192,7 @@ export default {
'Remove drop': 'Dropsatz entfernen',
'Remove burst': 'Burst entfernen',
'Rest (s)': 'Pause (s)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Pause nach jedem Satz dieser Übung. Bei 0:00 gilt deine Standard-Pause.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Pause nach jedem Satz dieser Übung. Kein Timer heißt kein Countdown, du legst los, wenn du bereit bist.',
'Drop-set / rest-pause': 'Dropsatz / Rest-Pause',
'Intensifier': 'Intensivierungstechnik',
'None': 'Keine',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 651865f11..014cfb295 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'Quitar bajada',
'Remove burst': 'Quitar ráfaga',
'Rest (s)': 'Descanso (s)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Descanso tras cada serie de este ejercicio. Con 0:00 se usa tu descanso por defecto.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Descanso tras cada serie de este ejercicio. Sin temporizador no hay cuenta atrás, sigues cuando estés listo.',
'Drop-set / rest-pause': 'Series descendentes / rest-pause',
'Intensifier': 'Intensificador',
'None': 'Ninguno',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index ed1365ea6..db5121d14 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'Retirer le drop set',
'Remove burst': 'Retirer la rafale',
'Rest (s)': 'Repos (s)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Repos après chaque série de cet exercice. À 0:00, c’est ton repos par défaut.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Repos après chaque série de cet exercice. Pas de minuteur, pas de compte à rebours : tu repars quand tu es prêt.',
'Drop-set / rest-pause': 'Drop-set / rest-pause',
'Intensifier': 'Intensificateur',
'None': 'Aucun',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 08aa9f851..a6a9c0d2c 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'ड्रॉप सेट हटाएं',
'Remove burst': 'बर्स्ट हटाएं',
'Rest (s)': 'आराम (सेकंड)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'इस एक्सरसाइज़ के हर सेट के बाद आराम। 0:00 पर आपका डिफ़ॉल्ट आराम लागू होता है।',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'इस एक्सरसाइज़ के हर सेट के बाद आराम। कोई टाइमर नहीं यानी कोई काउंटडाउन नहीं, जब तैयार हों तब शुरू करें।',
'Drop-set / rest-pause': 'ड्रॉप सेट / रेस्ट-पॉज़',
'Intensifier': 'इंटेंसिफायर',
'None': 'कोई नहीं',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index b64744e1a..9a8fb9648 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -868,7 +868,7 @@ export default {
'Keep replacement in this group': 'A csere maradjon ebben a csoportban',
'Insert after this group': 'Beszúrás a csoport után',
'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'A naplózott sorozatok az eredeti gyakorlatnál maradnak. A csere utána kerül beszúrásra.',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Pihenő a gyakorlat minden sorozata után. 0:00 esetén az alapértelmezett pihenőd érvényes.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Pihenő a gyakorlat minden sorozata után. Nincs időzítő: nincs visszaszámlálás, akkor folytatod, amikor készen állsz.',
'Vibrate': 'Rezgés',
'Weigh in before workouts': 'Súlymérés edzés előtt',
'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Edzés indításakor rákérdez a testsúlyodra. Kikapcsolva az edzés azonnal indul.',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index f4d5af040..c80c31084 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'Rimuovi drop set',
'Remove burst': 'Rimuovi burst',
'Rest (s)': 'Recupero (s)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Recupero dopo ogni serie di questo esercizio. A 0:00 vale il tuo recupero predefinito.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Recupero dopo ogni serie di questo esercizio. Nessun timer vuol dire niente conto alla rovescia, riparti quando sei pronto.',
'Drop-set / rest-pause': 'Drop-set / rest-pause',
'Intensifier': 'Intensificatore',
'None': 'Nessuno',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index d665507d5..322461c47 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': '드롭세트 제거',
'Remove burst': '버스트 제거',
'Rest (s)': '휴식(초)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': '이 운동의 세트마다 갖는 휴식이에요. 0:00이면 기본 휴식을 써요.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': '이 운동의 세트마다 갖는 휴식이에요. 타이머 없음이면 카운트다운 없이 준비되면 바로 시작해요.',
'Drop-set / rest-pause': '드롭세트 / 레스트포즈',
'Intensifier': '강도 기법',
'None': '없음',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 66373be06..80f2fe7cd 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'Usuń serię zniżkującą',
'Remove burst': 'Usuń serię rest-pause',
'Rest (s)': 'Odpoczynek (s)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Odpoczynek po każdej serii tego ćwiczenia. 0:00 oznacza domyślną przerwę.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Odpoczynek po każdej serii tego ćwiczenia. Bez timera nie ma odliczania, ruszasz, kiedy jesteś gotowy.',
'Drop-set / rest-pause': 'Seria zniżkująca / rest-pause',
'Intensifier': 'Technika intensyfikująca',
'None': 'Brak',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index cc16b7618..88d31aa53 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -725,7 +725,7 @@ export const PT_BR_OVERRIDES = {
'{0}: what’s planned': '{0}: previsto',
// --- per-exercise rest ---
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Descanso depois de cada série deste exercício. Em 0:00 vale o seu descanso padrão.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Descanso depois de cada série deste exercício. Sem cronômetro não tem contagem regressiva, você vai quando estiver pronto.',
'Hevy is rate-limiting requests. Wait a minute and try again': 'O Hevy está limitando as solicitações. Espere um minuto e tente de novo',
'Log a past workout': 'Registrar um treino passado',
'Logged on the usual workout screen, without timers.': 'Registrado na tela de treino habitual, só sem temporizadores.',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 3becef96a..c9c17713b 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'Remover queda',
'Remove burst': 'Remover rajada',
'Rest (s)': 'Descanso (s)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Descanso depois de cada série deste exercício. Em 0:00 fica o teu descanso predefinido.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Descanso depois de cada série deste exercício. Sem temporizador não há contagem decrescente, avanças quando estiveres pronto.',
'Drop-set / rest-pause': 'Séries decrescentes / rest-pause',
'Intensifier': 'Intensificador',
'None': 'Nenhum',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 8d3c511ea..557753bba 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -178,7 +178,7 @@ export default {
'Remove drop': 'Убрать дроп-сет',
'Remove burst': 'Убрать серию',
'Rest (s)': 'Отдых (с)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Отдых после каждого подхода этого упражнения. 0:00 значит ваш отдых по умолчанию.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Отдых после каждого подхода этого упражнения. Без таймера нет обратного отсчёта, продолжайте, когда будете готовы.',
'Drop-set / rest-pause': 'Дроп-сет / рест-пауза',
'Intensifier': 'Интенсификатор',
'None': 'Нет',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 04d76f61d..177261246 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -876,7 +876,7 @@ export default {
'Keep replacement in this group': 'เก็บท่าใหม่ไว้ในกลุ่มนี้',
'Insert after this group': 'แทรกหลังกลุ่มนี้',
'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'เซ็ตที่บันทึกแล้วจะอยู่กับท่าเดิม ท่าใหม่จะถูกแทรกไว้ถัดไป',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'พักหลังแต่ละเซ็ตของท่านี้ ตั้งที่ 0:00 จะใช้เวลาพักค่าเริ่มต้นของคุณ',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'พักหลังแต่ละเซ็ตของท่านี้ ไม่มีตัวจับเวลาคือไม่มีการนับถอยหลัง พร้อมเมื่อไหร่ก็ไปต่อได้เลย',
'Vibrate': 'การสั่น',
'Weigh in before workouts': 'ชั่งน้ำหนักก่อนออกกำลังกาย',
'Asks for your body weight when a workout starts. Off starts the session straight away.': 'ถามน้ำหนักตัวเมื่อเริ่มออกกำลังกาย ถ้าปิด เซสชันจะเริ่มทันที',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 5b2308da9..fd314d42a 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': 'Düşüş setini kaldır',
'Remove burst': 'Patlamayı kaldır',
'Rest (s)': 'Dinlenme (sn)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Bu egzersizin her setinden sonraki dinlenme. 0:00’da varsayılan dinlenmen geçerli olur.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Bu egzersizin her setinden sonraki dinlenme. Zamanlayıcı yok demek geri sayım yok demek, hazır olunca devam edersin.',
'Drop-set / rest-pause': 'Düşüş seti / rest-pause',
'Intensifier': 'Yoğunlaştırıcı',
'None': 'Yok',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index c6e69f6e3..055f089dd 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -166,7 +166,7 @@ export default {
'Remove drop': 'Прибрати дроп-сет',
'Remove burst': 'Прибрати серію',
'Rest (s)': 'Відпочинок (с)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': 'Відпочинок після кожного підходу цієї вправи. 0:00 означає твій відпочинок за замовчуванням.',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': 'Відпочинок після кожного підходу цієї вправи. Без таймера немає зворотного відліку, продовжуй, коли будеш готовий.',
'Drop-set / rest-pause': 'Дроп-сет / рест-пауза',
'Intensifier': 'Інтенсифікатор',
'None': 'Немає',
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index b74acb12a..60d7ab028 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -180,7 +180,7 @@ export default {
'Remove drop': '移除遞減組',
'Remove burst': '移除爆發組',
'Rest (s)': '休息(秒)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': '此動作每組結束後的休息時間。設為 0:00 即使用預設休息。',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': '此動作每組結束後的休息時間。選「不計時」就沒有倒數,準備好就繼續。',
'Drop-set / rest-pause': '遞減組 / 休息暫停組',
'Intensifier': '強化技巧',
'None': '無',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index b02753f77..8cb4b6398 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -184,7 +184,7 @@ export default {
'Remove drop': '移除递减组',
'Remove burst': '移除爆发组',
'Rest (s)': '休息(秒)',
- 'Rest after each set of this exercise. 0:00 means your default rest.': '这个动作每组之后的休息时间。设为 0:00 就用默认休息。',
+ 'Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.': '这个动作每组之后的休息时间。选“不计时”就没有倒计时,准备好了就继续。',
'Drop-set / rest-pause': '递减组 / 歇息暂停组',
'Intensifier': '强化技巧',
'None': '无',
diff --git a/frontend/src/sheets.config-rest.test.jsx b/frontend/src/sheets.config-rest.test.jsx
index 22f80cd88..5815b489b 100644
--- a/frontend/src/sheets.config-rest.test.jsx
+++ b/frontend/src/sheets.config-rest.test.jsx
@@ -2,13 +2,14 @@
import React, { act } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { createRoot } from 'react-dom/client'
-import { EXDB } from './lib/exercises.js'
+import { EXDB, EXIDX } from './lib/exercises.js'
import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { exConfigSheet } from './sheets.jsx'
-// v1.3.11: an exercise's own rest is set on the same wheel as the default rest timer, where 0:00
-// means "no rest of its own" and the row says which default applies then.
+// An exercise's own rest: the default, "No timer" (Discord lajawi; a 0:00 used to mean the
+// default, so there was no way to say none) or a time of its own, as for the warm-ups. The wheel
+// opens on the rest that applies (#735), not on 0:00.
const ex = EXDB.find(e => e.id === '0009')
const mounted = []
@@ -22,8 +23,10 @@ function render(sheet) {
}
const restRow = host => [...host.querySelectorAll('.lrow')].find(r => r.querySelector('.lrow-t')?.textContent === 'Rest for this exercise')
const save = host => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === 'Save').click()
+const pick = (menu, label) => act(() => [...menu.querySelectorAll('.menu-item')].find(b => b.textContent.includes(label)).click())
+const done = wheel => act(() => [...wheel.querySelectorAll('button')].find(b => b.textContent === 'Done').click())
-describe('exercise settings: rest on the wheel', () => {
+describe('exercise settings: rest for this exercise', () => {
beforeEach(() => {
globalThis.IS_REACT_ACT_ENVIRONMENT = true
useUI.setState({ sheets: [] })
@@ -32,22 +35,63 @@ describe('exercise settings: rest on the wheel', () => {
})
afterEach(() => { act(() => { mounted.splice(0).forEach(([root, host]) => { root.unmount(); host.remove() }) }) })
- it('reads Default with the default rest when the exercise has none, and saves what the wheel picks', () => {
+ it('reads Default with the default rest when the exercise has none, and saves nothing new', () => {
const onSave = vi.fn()
exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', restSec: 0 }, onSave)
const host = render(useUI.getState().sheets.at(-1))
expect(restRow(host).querySelector('.lrow-v').textContent).toBe('Default (2:00)')
+ expect(host.textContent).toContain('No timer means no countdown')
+ expect(host.textContent).not.toMatch(/0:00 means/)
+ act(() => save(host))
+ const out = onSave.mock.calls[0][0]
+ expect(out.restSec || 0).toBe(0)
+ expect('restOff' in out).toBe(false)
+ })
+
+ it('"No timer" is saved as restOff, and Default takes it away again', () => {
+ const onSave = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', restSec: 75 }, onSave)
+ const host = render(useUI.getState().sheets.at(-1))
+ act(() => restRow(host).click())
+ pick(render(useUI.getState().sheets.at(-1)), 'No timer')
+ expect(restRow(host).querySelector('.lrow-v').textContent).toBe('No timer')
+ act(() => save(host))
+ expect(onSave.mock.calls[0][0]).toMatchObject({ restOff: true })
+ expect('restSec' in onSave.mock.calls[0][0]).toBe(false)
+
+ const again = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', restOff: true }, again)
+ const host2 = render(useUI.getState().sheets.at(-1))
+ expect(restRow(host2).querySelector('.lrow-v').textContent).toBe('No timer')
+ act(() => restRow(host2).click())
+ pick(render(useUI.getState().sheets.at(-1)), 'Default (2:00)')
+ act(() => save(host2))
+ expect('restOff' in again.mock.calls[0][0] || 'restSec' in again.mock.calls[0][0]).toBe(false)
+ })
+
+ it('cardio keeps its "No timer" too', () => {
+ const onSave = vi.fn()
+ const bike = EXIDX['2138']
+ exConfigSheet(bike, { sets: 1, min: 20, speed: 8, restOff: true }, onSave)
+ const host = render(useUI.getState().sheets.at(-1))
+ expect(restRow(host).querySelector('.lrow-v').textContent).toBe('No timer')
+ act(() => save(host))
+ expect(onSave.mock.calls[0][0].restOff).toBe(true)
+ })
+
+ it('Pick a time opens on the default rest that applies, not on 0:00, and keeps what it picks (#735)', () => {
+ const onSave = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps' }, onSave)
+ const host = render(useUI.getState().sheets.at(-1))
act(() => restRow(host).click())
+ pick(render(useUI.getState().sheets.at(-1)), 'Pick a time')
const wheel = render(useUI.getState().sheets.at(-1))
expect(wheel.querySelector('h3').textContent).toBe('Rest for this exercise')
- expect(wheel.querySelector('.dw-read').textContent).toBe('Default (2:00)')
- // The copy names the wheel's 0:00, not a "0" the row never shows (QA 10-05).
- expect(host.textContent).toContain('0:00 means your default rest.')
- expect(host.textContent).not.toMatch(/Leave at 0/)
- // Done keeps 0:00, the default; the value shown stays the default's.
- act(() => [...wheel.querySelectorAll('button')].find(b => b.textContent === 'Done').click())
+ expect(wheel.querySelector('.dw-read').textContent).toBe('2:00')
+ done(wheel)
+ expect(restRow(host).querySelector('.lrow-v').textContent).toBe('2:00')
act(() => save(host))
- expect(onSave.mock.calls[0][0].restSec || 0).toBe(0)
+ expect(onSave.mock.calls[0][0].restSec).toBe(120)
})
it('shows an exercise’s own rest as a time, and the wheel opens on it', () => {
@@ -56,12 +100,30 @@ describe('exercise settings: rest on the wheel', () => {
const host = render(useUI.getState().sheets.at(-1))
expect(restRow(host).querySelector('.lrow-v').textContent).toBe('1:15')
act(() => restRow(host).click())
+ pick(render(useUI.getState().sheets.at(-1)), 'Pick a time')
const wheel = render(useUI.getState().sheets.at(-1))
expect(wheel.querySelector('.dw-read').textContent).toBe('1:15')
- act(() => [...wheel.querySelectorAll('button')].find(b => b.textContent === 'Done').click())
+ done(wheel)
act(() => save(host))
expect(onSave.mock.calls[0][0].restSec).toBe(75)
})
+
+ it('the warm-ups’ wheel opens on their rest that applies: the profile’s, else the work sets’ (#735)', () => {
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', warmupSets: 2, restSec: 75 }, vi.fn())
+ let host = render(useUI.getState().sheets.at(-1))
+ const warmRow = h => [...h.querySelectorAll('.lrow')].find(r => r.querySelector('.lrow-t')?.textContent === 'Rest between warm-ups')
+ act(() => warmRow(host).click())
+ pick(render(useUI.getState().sheets.at(-1)), 'Pick a time')
+ expect(render(useUI.getState().sheets.at(-1)).querySelector('.dw-read').textContent).toBe('1:15')
+
+ useStore.setState(s => ({ S: { ...s.S, warmupRestSec: 40 } }))
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', warmupSets: 2, restSec: 75 }, vi.fn())
+ host = render(useUI.getState().sheets.at(-1))
+ act(() => warmRow(host).click())
+ pick(render(useUI.getState().sheets.at(-1)), 'Pick a time')
+ expect(render(useUI.getState().sheets.at(-1)).querySelector('.dw-read').textContent).toBe('40s')
+ useStore.setState(s => { const { warmupRestSec, ...rest } = s.S; return { S: rest } })
+ })
})
// Discord "set-specific rest timers": the warm-ups' own rest and the break between sides, both
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 062bf8d6a..45d214a7a 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -22,7 +22,7 @@ import Stepper from './components/Stepper.jsx'
import { durationSheet } from './components/DurationWheel.jsx'
import { cleanBackups, withBackups, MAX_BACKUPS } from './lib/routine-backups.js'
import { SG_NAME_MAX } from './lib/superset-meta.js'
-import { REST_MAX, fmtRest } from './lib/duration.js'
+import { REST_MAX, fmtRest, restWheelValue } from './lib/duration.js'
import Icon from './components/Icon.jsx'
import { Button, Slider, Switch, Segmented, SelectRow, Row, TextField, NumberField, MultiSelectRow } from './components/ui.jsx'
import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js'
@@ -49,6 +49,7 @@ import { clampIncline, inclineFits, INCLINE_MAX, INCLINE_STEP } from './lib/incl
import { buildCompletedWorkout, sessionEnd } from './lib/finish-workout.js'
import { refillAfter } from './lib/rotation.js'
import { isWarmupRow, hasCompletedWork } from './lib/workout-model.js'
+import { ownExerciseRest } from './lib/supersetFlow.js'
import { saveSessionAsRoutine, routineAdditions, addToRoutine } from './lib/session-routines.js'
import { repeatSessionEntries } from './lib/session-repeat.js'
import { swapActiveExercise } from './lib/active-exercise-swap.js'
@@ -1758,6 +1759,8 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
const warmLikeAll = warmAll === null ? t('Like the work sets') : t('Default ({0})', warmAll > 0 ? fmtRest(warmAll) : t('No timer'))
// A hold's switch-sides pause when it has none of its own (Workout.jsx SWITCH_SIDES_SEC).
const sideDefault = t('Default ({0})', fmtRest(10))
+ // No rest of its own: the default rest timer's, which may itself be off.
+ const restLikeAll = t('Default ({0})', fmtRest(st.restSec))
// A catalogue cardio exercise logs intervals by default, but it can be counted in sets x reps
// or timed like any other (#678). A saved duration/speed plan keeps its cardio form even after
// the catalogue moved its exercise out of cardio (jumping jacks, #717).
@@ -1782,6 +1785,9 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
// Both default from the dataset and are then whatever the config says — see isBw.
const bw = !cardio && isBw({ ...c, id: ex.id })
const perSide = isPerSide(c)
+ // What a warm-up rests without one of its own, for its wheel to open on (#735): the profile's,
+ // else the work sets' (lib/supersetFlow.js warmupRestSecFor).
+ const warmApplies = warmAll !== null ? warmAll : ownExerciseRest(c) ?? st.restSec
// Pyramid sets: one rep target per set, in place of the flat Sets × Reps (CONTEXT.md).
const pyramid = mode === 'reps' && isPyramid({ ...c, mode })
const setPyramidAt = (i, v) => setC(x => ({ ...x, pyramid: x.pyramid.map((p, j) => (j === i ? v : p)) }))
@@ -1837,8 +1843,9 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
// Per-exercise rest (issue #10): written only when a positive value was set, so 0 keeps
// inheriting the global rest timer and a config that never touched it stays the shape it
// was. Mode-independent — a heavy triple, a plank and a cardio interval all rest.
+ // "No timer" is its own `restOff` rather than a 0, which has always meant the default.
const restSec = Math.max(0, Math.round(c.restSec) || 0)
- const withRest = restSec ? { restSec } : {}
+ const withRest = restSec ? { restSec } : c.restOff === true ? { restOff: true } : {}
// What a dumbbell weight means in this slot (lib/dumbbells.js): written only when the slot
// picked its own, so every other config stays the shape it was.
const dbLoad = isBellEx(ex) && !bw ? dbLoadOf(c.dbLoad) : null
@@ -2014,20 +2021,25 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
{/* Per-exercise rest (issue #10). Its own full-width row, like the other steppers with an
explanation under them, and outside every mode branch because a heavy triple, a plank
and a cardio interval all rest — they just do not all want the same break. */}
- {/* On the same wheel as the default rest timer (v1.3.11): 0:00 is "no rest of its own", so
- the default applies, and the row says which default that is. */}
+ {/* The default rest, no timer, or a time of its own: the warm-ups' three choices. The wheel
+ opens on the rest that applies now (#735), and 0:00 on it is no timer. */}
<div className="sect-b cfg-rest" style={{ marginBottom: 6 }}>
<Row icon="timer" iconTint="var(--orange)" title={t('Rest for this exercise')} accessory="chevron"
- value={c.restSec > 0 ? fmtRest(c.restSec) : t('Default ({0})', fmtRest(st.restSec))}
- onClick={() => durationSheet({
- title: t('Rest for this exercise'), value: c.restSec > 0 ? c.restSec : 0, max: REST_MAX,
- off: t('Default ({0})', fmtRest(st.restSec)),
- footer: t('Rest after each set of this exercise. 0:00 means your default rest.'),
- onDone: v => setC(x => ({ ...x, restSec: v })),
+ value={c.restSec > 0 ? fmtRest(c.restSec) : c.restOff === true ? t('No timer') : restLikeAll}
+ onClick={() => menuSheet({
+ title: t('Rest for this exercise'),
+ items: [
+ { icon: 'timer', label: restLikeAll, on: !(c.restSec > 0) && c.restOff !== true, onClick: () => setC(x => { const { restOff, restSec, ...rest } = x; return rest }) },
+ { icon: 'pause', label: t('No timer'), on: !(c.restSec > 0) && c.restOff === true, onClick: () => setC(x => { const { restSec, ...rest } = x; return { ...rest, restOff: true } }) },
+ { icon: 'clock', label: t('Pick a time'), on: c.restSec > 0, onClick: () => durationSheet({
+ title: t('Rest for this exercise'), value: restWheelValue(c.restSec, c.restOff === true ? 0 : st.restSec), max: REST_MAX, off: t('No timer'),
+ onDone: v => setC(x => { const { restOff, restSec, ...rest } = x; return v > 0 ? { ...rest, restSec: v } : { ...rest, restOff: true } }),
+ }) },
+ ],
})} />
</div>
<div className="small dim" style={{ marginBottom: 18 }}>
- {t('Rest after each set of this exercise. 0:00 means your default rest.')}
+ {t('Rest after each set of this exercise. No timer means no countdown, you go when you’re ready.')}
</div>
{/* The warm-ups' own rest: the profile's or like the work sets (no field, as always), no timer,
or a time of their own. The last warm-up still rests the full work rest before the first work set. */}
@@ -2041,7 +2053,7 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
{ icon: 'timer', label: warmLikeAll, on: !(c.warmupRestOff === true) && !(c.warmupRestSec > 0), onClick: () => setC(x => { const { warmupRestOff, warmupRestSec, ...rest } = x; return rest }) },
{ icon: 'pause', label: t('No timer'), on: c.warmupRestOff === true, onClick: () => setC(x => { const { warmupRestSec, ...rest } = x; return { ...rest, warmupRestOff: true } }) },
{ icon: 'clock', label: t('Pick a time'), on: c.warmupRestOff !== true && c.warmupRestSec > 0, onClick: () => durationSheet({
- title: t('Rest between warm-ups'), value: c.warmupRestSec > 0 ? c.warmupRestSec : 30, max: REST_MAX, off: t('No timer'),
+ title: t('Rest between warm-ups'), value: restWheelValue(c.warmupRestSec, warmApplies), max: REST_MAX, off: t('No timer'),
onDone: v => setC(x => { const { warmupRestOff, warmupRestSec, ...rest } = x; return v > 0 ? { ...rest, warmupRestSec: v } : { ...rest, warmupRestOff: true } }),
}) },
],
diff --git a/frontend/src/views/FocusView.jsx b/frontend/src/views/FocusView.jsx
index f8bcc2716..df9935f9f 100644
--- a/frontend/src/views/FocusView.jsx
+++ b/frontend/src/views/FocusView.jsx
@@ -73,7 +73,8 @@ function Prescription({ entry, setIdx, unit, fallbackRest, children }) {
const rpe = target.rpeMin > 0
? `RPE ${fmtNum(target.rpeMin)}${target.rpeMax > target.rpeMin ? `–${fmtNum(target.rpeMax)}` : ''}`
: ''
- const rest = target.restSec > 0 ? `Rest ${target.restSec}s` : fallbackRest > 0 ? `Rest ${fallbackRest}s` : ''
+ // An exercise on 'No timer' (restOff) shows no rest, whatever the default is.
+ const rest = target.restOff === true ? '' : target.restSec > 0 ? `Rest ${target.restSec}s` : fallbackRest > 0 ? `Rest ${fallbackRest}s` : ''
const badges = [reps && `${reps} Reps`, load, rpe, rest, target.tempo].filter(Boolean)
return <div className="focus-prescription">
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 6eb140488..08e1f5a3b 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -17,7 +17,7 @@ import { pinState } from '../lib/queue.js'
import { t, tn, exerciseNameFor, exerciseNameClass } from '../lib/i18n.js'
import { api, beacon } from '../lib/api.js'
import { pyramidRestFor, maxRecordAt, isPyramid, pyramidLabel } from '../lib/pyramid.js'
-import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor, sideRestFor, ownSetRest, stepUnitIndex, advanceAfterTimedRest } from '../lib/supersetFlow.js'
+import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor, sideRestFor, ownSetRest, ownExerciseRest, stepUnitIndex, advanceAfterTimedRest } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
import WorkoutScrollAnchor from '../components/WorkoutScrollAnchor.jsx'
import WorkoutChips from '../components/WorkoutChips.jsx'
@@ -26,7 +26,7 @@ import WorkoutThumb, { hasWorkoutMedia } from '../components/WorkoutThumb.jsx'
import { workoutSettingsSheet } from '../components/WorkoutSettingsSheet.jsx'
import { SessionMapButton } from '../components/SessionMuscles.jsx'
import { durationSheet } from '../components/DurationWheel.jsx'
-import { REST_MAX, fmtRest } from '../lib/duration.js'
+import { REST_MAX, fmtRest, restWheelValue } from '../lib/duration.js'
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, exitWorkoutEdit, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, renameWorkoutSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, effortPickerSheet, exerciseHistorySheet, addRoutineToSessionSheet, finishWorkoutSheet, finishWorkoutNow } from '../sheets.jsx'
import { afterScrollRestore, scrollRestorePending } from '../components/Modals.jsx'
import { effortColor } from '../lib/effort.js'
@@ -410,8 +410,8 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
// in groups since v1.3.11: what you change today, what you look up, the exercise's settings,
// the order of the session, and Remove on its own at the end.
// The exercise's own rest, or the default it falls back to (lib/supersetFlow.js restSecFor).
- const ownRest = entry.target?.restSec > 0 ? entry.target.restSec : 0
- const restSub = ownRest ? fmtRest(ownRest) : t('Default ({0})', fmtRest(S.restSec))
+ const ownRest = ownExerciseRest(entry.target)
+ const restSub = ownRest === 0 ? t('No timer') : ownRest ? fmtRest(ownRest) : t('Default ({0})', fmtRest(S.restSec))
const openMore = () => menuSheet({
title: exerciseNameFor(ex),
titleClass: exerciseNameClass(ex),
@@ -1366,7 +1366,7 @@ function ActiveWorkout() {
// edits it (lib/session-routines.js). This is the explicit way to keep them — an item in the
// exercise's ⋯ menu, there only while the routine's slot says something else than the session
// did. Sets, reps and weight are not part of it (routineChangesFromEntry).
- const restWord = v => (Number(v) > 0 ? fmtRest(v) : t('Default ({0})', fmtRest(S.restSec)))
+ const restWord = v => (Number(v) > 0 ? fmtRest(v) : Number(v) < 0 ? t('No timer') : t('Default ({0})', fmtRest(S.restSec)))
const routineUpdateFor = idx => {
const entry = A.entries[idx]
const routine = !editing && entry?.rid ? S.routines.find(r => r.id === entry.rid) : null
@@ -1570,25 +1570,33 @@ function ActiveWorkout() {
] },
],
})
- // An exercise's own rest, from its ⋯ menu: the same wheel as the default rest timer, where 0:00
- // means "no rest of its own", so the default applies. Like everything edited on the exercise
- // from inside the session it is this session's; the menu's Update routine offers to keep it.
+ // An exercise's own rest, from its ⋯ menu: the default, no timer, or a time of its own, as on
+ // its settings sheet. Like everything edited on the exercise from inside the session it is this
+ // session's; the menu's Update routine offers to keep it.
const openExerciseRest = idx => {
const state = useStore.getState().S
const entry = state.active?.entries?.[idx]
if (!entry) return
const activeId = state.active.id
const entryId = entry.id
- durationSheet({
+ const own = ownExerciseRest(entry.target)
+ const setRest = sec => update(s => {
+ const e = s.active?.id === activeId ? s.active.entries?.[idx] : null
+ if (!e || e.id !== entryId) return
+ const { restSec: _sec, restOff: _off, ...target } = e.target || {}
+ e.target = sec == null ? target : sec > 0 ? { ...target, restSec: sec } : { ...target, restOff: true }
+ })
+ menuSheet({
title: t('Rest for this exercise'),
- value: entry.target?.restSec > 0 ? entry.target.restSec : 0, max: REST_MAX,
- off: t('Default ({0})', fmtRest(state.restSec)),
- footer: t('Rest after each set of this exercise. 0:00 means your default rest.'),
- onDone: v => update(s => {
- const e = s.active?.id === activeId ? s.active.entries?.[idx] : null
- if (!e || e.id !== entryId) return
- e.target = { ...(e.target || {}), restSec: v }
- }),
+ items: [
+ { icon: 'timer', label: t('Default ({0})', fmtRest(state.restSec)), on: own == null, onClick: () => setRest(null) },
+ { icon: 'pause', label: t('No timer'), on: own === 0, onClick: () => setRest(0) },
+ // The wheel opens on the rest that applies now (#735), 0:00 on it is no timer.
+ { icon: 'clock', label: t('Pick a time'), on: own > 0, onClick: () => durationSheet({
+ title: t('Rest for this exercise'), value: restWheelValue(own, state.restSec), max: REST_MAX, off: t('No timer'),
+ onDone: v => setRest(v > 0 ? v : 0),
+ }) },
+ ],
})
}
const openProgressionSettings = idx => {
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index e8da2542d..c0da42e31 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -3551,22 +3551,35 @@ describe('the workout screen chrome (v1.3.11)', () => {
])
})
- it('sets an exercise’s own rest on the wheel, 0:00 meaning the default', async () => {
+ it('sets an exercise’s own rest: the default, no timer, or a time on a wheel that opens on the rest that applies (#735)', async () => {
await mount([exercise('plain-bench', [false])])
await openMore()
expect(item('Rest timer').sub).toBe('Default (1:30)')
item('Rest timer').onClick()
+ const restItems = () => menuItemsOf(lastMenu())
+ expect(restItems().map(it => [it.label, !!it.on])).toEqual([['Default (1:30)', true], ['No timer', false], ['Pick a time', false]])
+ restItems()[2].onClick()
const opts = mocks.durationSheet.mock.calls.at(-1)[0]
- expect(opts).toMatchObject({ title: 'Rest for this exercise', value: 0, max: 900, off: 'Default (1:30)' })
+ // Not 0:00: the dials sit on the 1:30 that applies, and 0:00 on them is no timer.
+ expect(opts).toMatchObject({ title: 'Rest for this exercise', value: 90, max: 900, off: 'No timer' })
await act(async () => { opts.onDone(135) })
expect(mocks.S.active.entries[0].target.restSec).toBe(135)
await rerender()
await openMore()
expect(item('Rest timer').sub).toBe('2:15')
item('Rest timer').onClick()
+ restItems()[2].onClick()
expect(mocks.durationSheet.mock.calls.at(-1)[0].value).toBe(135)
+ // 0:00 on the wheel is "No timer" now, stored as restOff, never as a 0 that reads as the default.
await act(async () => { mocks.durationSheet.mock.calls.at(-1)[0].onDone(0) })
- expect(mocks.S.active.entries[0].target.restSec).toBe(0)
+ expect(mocks.S.active.entries[0].target).toMatchObject({ restOff: true })
+ expect('restSec' in mocks.S.active.entries[0].target).toBe(false)
+ await rerender()
+ await openMore()
+ expect(item('Rest timer').sub).toBe('No timer')
+ item('Rest timer').onClick()
+ await act(async () => { restItems()[0].onClick() })
+ expect('restOff' in mocks.S.active.entries[0].target || 'restSec' in mocks.S.active.entries[0].target).toBe(false)
})
it('has no rest item in the editor of a saved workout', async () => {