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.

Rest for warm-ups and between sides, per exercise (Discord)

Duarte Santos224a5348aa80
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index 5a63137f7..90a6c0cf6 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -120,6 +120,9 @@ function cleanEx(e) {
// timer in charge. parsePlan and mergePlan carry it through by spread.
if (e.restSec > 0) o.restSec = e.restSec
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.
+ if (e.warmupRestOff === true) o.warmupRestOff = true
+ if (e.side && e.sideRestSec > 0) o.sideRestSec = e.sideRestSec
if (e.sg) {
o.sg = e.sg
// A superset's name and its rest between rounds (#292) ride on every member, so they travel
@@ -259,15 +262,17 @@ export function parsePlan(raw, destinationUnit = 'kg') {
const intens = cleanIntensifier(e.intensifier)
const rest = cleanRestSec(e.restSec)
const warmRest = cleanRestSec(e.warmupRestSec)
+ const warmOff = e.warmupRestOff === true
+ const sideRest = cleanRestSec(e.sideRestSec)
// Superset meta only means something on a member of a superset; on a lone exercise it is dropped.
const sgName = e.sg ? cleanSgName(e.sgName) : ''
const sgRest = e.sg ? cleanRestSec(e.sgRest) : 0
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, pyramid: _pyramid, pyramidRest: _pyramidRest, pyramidWeight: _pyramidWeight, sgName: _sgName, sgRest: _sgRest, ...passthrough } = e
+ const { warmupSets, intensifier, restSec, warmupRestSec, warmupRestOff: _warmOff, sideRestSec: _sideRest, pyramid: _pyramid, pyramidRest: _pyramidRest, pyramidWeight: _pyramidWeight, sgName: _sgName, sgRest: _sgRest, ...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 } : {}), ...(warmRest ? { warmupRestSec: warmRest } : {}), ...(sgName ? { sgName } : {}), ...(sgRest ? { sgRest } : {}) }, sourceUnit || destination, destination)
+ 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 } : {}), ...(sideRest ? { sideRestSec: sideRest } : {}), ...(sgName ? { sgName } : {}), ...(sgRest ? { sgRest } : {}) }, sourceUnit || destination, destination)
})
}))
return {
diff --git a/frontend/src/lib/plan-share.test.js b/frontend/src/lib/plan-share.test.js
index 5e1a3e52f..22a27a7fc 100644
--- a/frontend/src/lib/plan-share.test.js
+++ b/frontend/src/lib/plan-share.test.js
@@ -113,6 +113,17 @@ describe('what survives a shared plan', () => {
expect('warmupRestSec' in roundTrip({ warmupRestSec: 0 })).toBe(false)
})
+ // The warm-ups' "no timer" and the break between sides (Discord "set-specific rest timers").
+ it('carries the warm-ups\' "no timer" and the break between sides, and leaves them out when unset', () => {
+ expect(roundTrip({ warmupRestOff: true, warmupRestSec: 45 })).toMatchObject({ warmupRestOff: true })
+ expect('warmupRestSec' in roundTrip({ warmupRestOff: true, warmupRestSec: 45 })).toBe(false)
+ expect(roundTrip({ side: true, sideRestSec: 20 }).sideRestSec).toBe(20)
+ for (const e of [{}, { warmupRestOff: false }, { warmupRestOff: 'yes' }, { side: true, sideRestSec: 0 }, { sideRestSec: 20 }]) {
+ const out = roundTrip(e)
+ expect('warmupRestOff' in out || 'sideRestSec' in out, JSON.stringify(e)).toBe(false)
+ }
+ })
+
// The absence has to survive too: writing a 0 would pin the recipient's timer to "off"
// instead of letting the exercise keep inheriting whatever their own default is.
it('leaves an exercise that set no rest free of the field', () => {
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index fb17fe237..16bb70042 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('6ccfae3c126b654efed8d6d5f1c4599ee79b0a6b38a1ce58282d0ff2456a9651')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('8b771eb52db6f0db4147399afbdbd62256c6367170842632e0fc40402e818082')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/lib/supersetFlow.js b/frontend/src/lib/supersetFlow.js
index 401265398..ae2c9a727 100644
--- a/frontend/src/lib/supersetFlow.js
+++ b/frontend/src/lib/supersetFlow.js
@@ -114,10 +114,25 @@ export function warmupRestSecFor(entry, setIdx, workRestSec) {
if (!set || !isWarmupRow(set)) return workRestSec
const next = sets.slice(setIdx + 1).find(s => !s.done)
if (!next || !isWarmupRow(next)) return workRestSec
+ // "No timer" between ramp sets: an optional `warmupRestOff` (set in the exercise's settings).
+ if (entry?.target?.warmupRestOff === true) return 0
const own = Number(entry?.target?.warmupRestSec)
return own > 0 ? own : workRestSec
}
+/**
+ * The break between the two sides of one per-side set, or null for none. An exercise may set its
+ * own `sideRestSec` (optional, Discord "set-specific rest timers"). Without it nothing changes:
+ * a timed hold pauses `switchSec` (capped at the set's rest, and none with the rest switched off),
+ * and a reps set has no break between its sides, as before the field existed.
+ */
+export function sideRestFor(target, { timed, restAfter, switchSec }) {
+ const own = Math.round(Number(target?.sideRestSec)) || 0
+ if (own > 0) return own
+ if (timed && restAfter > 0) return Math.min(switchSec, restAfter)
+ return null
+}
+
// Decide where a newly completed superset set goes next. Spent members are skipped, including
// across the wrap. A round ends when no later member in display order has work left; this makes
// the last *active* member the boundary rather than blindly using the group's last array index.
diff --git a/frontend/src/lib/supersetFlow.test.js b/frontend/src/lib/supersetFlow.test.js
index 1487f00ea..601cfaaab 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 } from './supersetFlow.js'
+import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor, sideRestFor } from './supersetFlow.js'
const entry = done => ({ sets: done.map(value => ({ done: value })) })
@@ -138,6 +138,26 @@ describe('restSecFor', () => {
})
})
+describe('set-specific rests (Discord: rest for warm-ups and between sides)', () => {
+ const ramp = target => ({ target, sets: [{ phase: 'warmup', done: false }, { phase: 'warmup', done: false }, { done: false }] })
+ it('"no timer" between ramp sets is 0; the last ramp set still rests the work rest', () => {
+ expect(warmupRestSecFor(ramp({ warmupRestOff: true, warmupRestSec: 45 }), 0, 150)).toBe(0)
+ expect(warmupRestSecFor(ramp({ warmupRestOff: true }), 1, 150)).toBe(150)
+ })
+ it('anything but true is not "no timer": the old behaviour', () => {
+ for (const v of [false, 'true', 1, null]) expect(warmupRestSecFor(ramp({ warmupRestOff: v }), 0, 150), String(v)).toBe(150)
+ })
+ it('between sides: the exercise\'s own break, else what it always was', () => {
+ expect(sideRestFor({ sideRestSec: 20 }, { timed: false })).toBe(20)
+ expect(sideRestFor({ sideRestSec: 20 }, { timed: true, restAfter: 0, switchSec: 10 })).toBe(20)
+ // without one: reps has no break, a hold the switch pause capped at its rest, none with rest off
+ expect(sideRestFor({}, { timed: false })).toBeNull()
+ expect(sideRestFor(undefined, { timed: true, restAfter: 90, switchSec: 10 })).toBe(10)
+ expect(sideRestFor({}, { timed: true, restAfter: 5, switchSec: 10 })).toBe(5)
+ expect(sideRestFor({ sideRestSec: 0 }, { timed: true, restAfter: 0, switchSec: 10 })).toBeNull()
+ })
+})
+
describe('warmupRestSecFor', () => {
const ramp = (warmupRestSec, done = [false, false, false, false]) => ({
target: { restSec: 150, ...(warmupRestSec ? { warmupRestSec } : {}) },
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index c517f1c12..ff90b8427 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -2353,4 +2353,12 @@ export default {
'Make the box smaller': 'تصغير مربع الكتابة',
// --- progress photos: remove ---
'Photo removed': 'تمت إزالة الصورة',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'استراحة قصيرة بعد جانب وقبل الآخر. الاستراحة الكاملة تأتي بعد إنهاء الجانبين.',
+ 'Like the work sets': 'مثل مجموعات العمل',
+ 'No timer': 'بلا مؤقت',
+ 'Pick a time': 'اختر مدة',
+ 'Rest between sides': 'الاستراحة بين الجانبين',
+ 'Rest between warm-ups': 'الاستراحة بين مجموعات الإحماء',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'مجموعات الإحماء خفيفة، فيمكن أن تكون استراحتها أقصر أو بلا استراحة. آخرها يحصل على الاستراحة الكاملة قبل أول مجموعة عمل.',
}
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 7edc540cb..002fffe7e 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -2377,4 +2377,12 @@ export default {
'Make the box smaller': 'লেখার বাক্স ছোট করুন',
// --- progress photos: remove ---
'Photo removed': 'ছবি সরানো হয়েছে',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'এক দিকের পর অন্য দিকের আগে একটু দম নেওয়া। দুই দিক শেষ হলে পুরো বিশ্রাম।',
+ 'Like the work sets': 'কাজের সেটের মতো',
+ 'No timer': 'টাইমার নেই',
+ 'Pick a time': 'সময় বেছে নিন',
+ 'Rest between sides': 'দুই দিকের মাঝে বিশ্রাম',
+ 'Rest between warm-ups': 'ওয়ার্ম-আপের মাঝে বিশ্রাম',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'ওয়ার্ম-আপ হালকা, তাই বিশ্রাম কম বা একেবারেই না হলেও চলে। শেষটি প্রথম কাজের সেটের আগে পুরো বিশ্রাম পায়।',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 210442e2f..fa1ef708c 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -2318,4 +2318,12 @@ export default {
'Make the box smaller': 'Feld verkleinern',
// --- progress photos: remove ---
'Photo removed': 'Foto entfernt',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Kurz durchatmen nach der einen Seite, bevor die andere dran ist. Die volle Pause kommt, wenn beide Seiten fertig sind.',
+ 'Like the work sets': 'Wie die Arbeitssätze',
+ 'No timer': 'Kein Timer',
+ 'Pick a time': 'Zeit wählen',
+ 'Rest between sides': 'Pause zwischen den Seiten',
+ 'Rest between warm-ups': 'Pause zwischen Aufwärmsätzen',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Aufwärmsätze sind leicht, da reicht weniger Pause oder gar keine. Der letzte bekommt trotzdem die volle Pause vor dem ersten Arbeitssatz.',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index b16ea92d1..fa6e6366e 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'Achicar el cuadro',
// --- progress photos: remove ---
'Photo removed': 'Foto quitada',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Un respiro tras un lado, antes del otro. El descanso completo llega cuando terminas ambos lados.',
+ 'Like the work sets': 'Como las series de trabajo',
+ 'No timer': 'Sin temporizador',
+ 'Pick a time': 'Elegir un tiempo',
+ 'Rest between sides': 'Descanso entre lados',
+ 'Rest between warm-ups': 'Descanso entre calentamientos',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'El calentamiento es ligero, así que puede descansar menos o nada. El último sigue teniendo el descanso completo antes de tu primera serie de trabajo.',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 620bd24bd..3ffef6495 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'Réduire la zone',
// --- progress photos: remove ---
'Photo removed': 'Photo retirée',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Une petite pause après un côté, avant l’autre. Le repos complet vient quand les deux côtés sont faits.',
+ 'Like the work sets': 'Comme les séries de travail',
+ 'No timer': 'Pas de minuteur',
+ 'Pick a time': 'Choisir une durée',
+ 'Rest between sides': 'Repos entre les côtés',
+ 'Rest between warm-ups': 'Repos entre les échauffements',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'L’échauffement est léger, il peut donc se reposer moins, voire pas du tout. Le dernier garde le repos complet avant ta première série de travail.',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index fbb98d16d..39a3d570b 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'बॉक्स छोटा करें',
// --- progress photos: remove ---
'Photo removed': 'फ़ोटो हटाई गई',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'एक तरफ़ के बाद, दूसरी से पहले थोड़ा दम लें। पूरा आराम तब, जब दोनों तरफ़ हो जाएँ।',
+ 'Like the work sets': 'वर्क सेट जैसा',
+ 'No timer': 'कोई टाइमर नहीं',
+ 'Pick a time': 'समय चुनें',
+ 'Rest between sides': 'दोनों तरफ़ के बीच आराम',
+ 'Rest between warm-ups': 'वॉर्म-अप के बीच आराम',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'वॉर्म-अप हल्के होते हैं, इसलिए आराम कम या बिल्कुल नहीं भी चलेगा। आख़िरी वॉर्म-अप को पहले वर्क सेट से पहले पूरा आराम मिलता है।',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index c54fa6ae5..f8c281a04 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -2301,4 +2301,12 @@ export default {
'Make the box smaller': 'Kisebb mező',
// --- progress photos: remove ---
'Photo removed': 'Fotó eltávolítva',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Egy kis szusszanás az egyik oldal után, a másik előtt. A teljes pihenő akkor jön, ha mindkét oldal kész.',
+ 'Like the work sets': 'Mint a munkasorozatok',
+ 'No timer': 'Nincs időzítő',
+ 'Pick a time': 'Idő választása',
+ 'Rest between sides': 'Pihenő az oldalak között',
+ 'Rest between warm-ups': 'Pihenő a bemelegítő sorozatok között',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'A bemelegítés könnyű, így kevesebb pihenő is elég, vagy semmi. Az utolsó így is megkapja a teljes pihenőt az első munkasorozat előtt.',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index cf18f3894..46c6d0a69 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'Rimpicciolisci il riquadro',
// --- progress photos: remove ---
'Photo removed': 'Foto rimossa',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Un attimo di respiro dopo un lato, prima dell’altro. Il recupero pieno arriva quando hai finito entrambi i lati.',
+ 'Like the work sets': 'Come le serie allenanti',
+ 'No timer': 'Nessun timer',
+ 'Pick a time': 'Scegli un tempo',
+ 'Rest between sides': 'Recupero tra i lati',
+ 'Rest between warm-ups': 'Recupero tra i riscaldamenti',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Il riscaldamento è leggero, quindi può recuperare meno o per niente. L’ultimo ha comunque il recupero pieno prima della prima serie allenante.',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 09a84128f..fd1dfec05 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': '입력창 작게',
// --- progress photos: remove ---
'Photo removed': '사진을 지웠어요',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': '한쪽을 마치고 다른 쪽 전에 잠깐 숨 돌려요. 양쪽을 다 하면 원래 휴식이 시작돼요.',
+ 'Like the work sets': '본 세트와 같이',
+ 'No timer': '타이머 없음',
+ 'Pick a time': '시간 고르기',
+ 'Rest between sides': '좌우 사이 휴식',
+ 'Rest between warm-ups': '워밍업 세트 사이 휴식',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': '워밍업은 가벼우니 짧게 쉬거나 안 쉬어도 돼요. 마지막 워밍업 뒤에는 첫 본 세트 전에 원래 휴식을 다 줘요.',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 13f278442..3e1464b3a 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'Zmniejsz pole',
// --- progress photos: remove ---
'Photo removed': 'Zdjęcie usunięte',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Chwila oddechu po jednej stronie, przed drugą. Pełna przerwa przychodzi, gdy obie strony są zrobione.',
+ 'Like the work sets': 'Jak serie robocze',
+ 'No timer': 'Bez timera',
+ 'Pick a time': 'Wybierz czas',
+ 'Rest between sides': 'Przerwa między stronami',
+ 'Rest between warm-ups': 'Przerwa między seriami rozgrzewkowymi',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Rozgrzewka jest lekka, więc może mieć krótszą przerwę albo żadną. Ostatnia i tak dostaje pełną przerwę przed pierwszą serią roboczą.',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 2d4684fd9..7e70b64eb 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1456,6 +1456,9 @@ export const PT_BR_OVERRIDES = {
'Logged a workout on another device? Before the nudge goes out, the phone checks with your server whenever it lets the app run in the background. Opening the app always catches up.': 'Registrou um treino em outro dispositivo? Antes do aviso, o celular confirma com o seu servidor, sempre que deixar o aplicativo rodar em segundo plano. Abrir o aplicativo sempre deixa tudo em dia.',
// --- Coach message box ---
// --- progress photos: remove ---
+ // --- set-specific rest ---
+ 'No timer': 'Sem cronômetro',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'O aquecimento é leve, então pode descansar menos ou nada. O último continua tendo o descanso completo antes da sua primeira série de trabalho.',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index fce4043f3..68cbfc06b 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'Diminuir a caixa',
// --- progress photos: remove ---
'Photo removed': 'Foto removida',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Uma pausa curta depois de um lado, antes do outro. O descanso completo vem quando os dois lados estiverem feitos.',
+ 'Like the work sets': 'Como as séries de trabalho',
+ 'No timer': 'Sem temporizador',
+ 'Pick a time': 'Escolher um tempo',
+ 'Rest between sides': 'Descanso entre lados',
+ 'Rest between warm-ups': 'Descanso entre aquecimentos',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'O aquecimento é leve, por isso pode descansar menos ou nada. O último continua a ter o descanso completo antes da tua primeira série de trabalho.',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 6394cd611..30e8fbf8d 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -2302,4 +2302,12 @@ export default {
'Make the box smaller': 'Уменьшить поле',
// --- progress photos: remove ---
'Photo removed': 'Фото удалено',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Короткая передышка после одной стороны, перед другой. Полный отдых будет, когда обе стороны готовы.',
+ 'Like the work sets': 'Как рабочие подходы',
+ 'No timer': 'Без таймера',
+ 'Pick a time': 'Выбрать время',
+ 'Rest between sides': 'Отдых между сторонами',
+ 'Rest between warm-ups': 'Отдых между разминочными подходами',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Разминка лёгкая, так что отдыхать можно меньше или вовсе нет. После последней разминки всё равно будет полный отдых перед первым рабочим подходом.',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 6ff1422e5..fc84461c7 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -2309,4 +2309,12 @@ export default {
'Make the box smaller': 'ย่อช่องพิมพ์',
// --- progress photos: remove ---
'Photo removed': 'ลบรูปแล้ว',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'พักหายใจสั้น ๆ หลังข้างหนึ่ง ก่อนอีกข้าง พักเต็มเมื่อทำครบทั้งสองข้าง',
+ 'Like the work sets': 'เหมือนเซ็ตหลัก',
+ 'No timer': 'ไม่มีตัวจับเวลา',
+ 'Pick a time': 'เลือกเวลา',
+ 'Rest between sides': 'พักระหว่างสองข้าง',
+ 'Rest between warm-ups': 'พักระหว่างเซ็ตวอร์มอัพ',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'เซ็ตวอร์มอัพเบา จึงพักน้อยลงหรือไม่พักเลยก็ได้ เซ็ตสุดท้ายยังได้พักเต็มก่อนเซ็ตหลักแรก',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 941da4970..7eea90013 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': 'Kutuyu küçült',
// --- progress photos: remove ---
'Photo removed': 'Fotoğraf kaldırıldı',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Bir taraftan sonra, diğerinden önce kısa bir nefes. Tam dinlenme iki taraf da bitince gelir.',
+ 'Like the work sets': 'Çalışma setleri gibi',
+ 'No timer': 'Zamanlayıcı yok',
+ 'Pick a time': 'Süre seç',
+ 'Rest between sides': 'Taraflar arası dinlenme',
+ 'Rest between warm-ups': 'Isınma setleri arası dinlenme',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Isınma setleri hafif, o yüzden daha az ya da hiç dinlenmeyebilir. Sonuncusu yine de ilk çalışma setinden önce tam dinlenmeyi alır.',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index a28fabbca..f2db4d826 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -2295,4 +2295,12 @@ export default {
'Make the box smaller': 'Зменшити поле',
// --- progress photos: remove ---
'Photo removed': 'Фото видалено',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': 'Коротка перепочинка після одного боку, перед іншим. Повний відпочинок буде, коли обидва боки готові.',
+ 'Like the work sets': 'Як робочі підходи',
+ 'No timer': 'Без таймера',
+ 'Pick a time': 'Вибрати час',
+ 'Rest between sides': 'Відпочинок між боками',
+ 'Rest between warm-ups': 'Відпочинок між розминковими підходами',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': 'Розминка легка, тож відпочивати можна менше або зовсім ні. Після останньої розминки все одно буде повний відпочинок перед першим робочим підходом.',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 933f4c122..c8b57514e 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -2291,4 +2291,12 @@ export default {
'Make the box smaller': '縮小輸入框',
// --- progress photos: remove ---
'Photo removed': '已移除相片',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': '一側做完、另一側開始前,稍微喘口氣。兩側都做完後才是完整的休息。',
+ 'Like the work sets': '和正式組一樣',
+ 'No timer': '不計時',
+ 'Pick a time': '選擇時長',
+ 'Rest between sides': '兩側之間的休息',
+ 'Rest between warm-ups': '熱身組之間的休息',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': '熱身組較輕,可以少休息或不休息。最後一個熱身組在第一個正式組前仍會得到完整的休息。',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index dda5cb8f2..e032114b7 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -2298,4 +2298,12 @@ export default {
'Make the box smaller': '缩小输入框',
// --- progress photos: remove ---
'Photo removed': '已移除照片',
+ // --- set-specific rest ---
+ 'A breather after one side, before the other. The full rest comes once both sides are done.': '一侧做完、另一侧开始前,稍微喘口气。两侧都做完后才是完整的休息。',
+ 'Like the work sets': '和正式组一样',
+ 'No timer': '不计时',
+ 'Pick a time': '选择时长',
+ 'Rest between sides': '两侧之间的休息',
+ 'Rest between warm-ups': '热身组之间的休息',
+ 'Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.': '热身组较轻,可以少休息或不休息。最后一个热身组在第一个正式组前仍会得到完整的休息。',
}
diff --git a/frontend/src/sheets.config-rest.test.jsx b/frontend/src/sheets.config-rest.test.jsx
index 4695853ed..62ed82c7f 100644
--- a/frontend/src/sheets.config-rest.test.jsx
+++ b/frontend/src/sheets.config-rest.test.jsx
@@ -63,3 +63,62 @@ describe('exercise settings: rest on the wheel', () => {
expect(onSave.mock.calls[0][0].restSec).toBe(75)
})
})
+
+// Discord "set-specific rest timers": the warm-ups' own rest and the break between sides, both
+// optional; a config that never touched them saves the exact shape it had.
+describe('exercise settings: rest for warm-ups and between sides', () => {
+ beforeEach(() => {
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true
+ useUI.setState({ sheets: [] })
+ useStore.setState(s => ({ S: { ...s.S, unit: 'kg', restSec: 120 } }))
+ document.body.innerHTML = ''
+ })
+ afterEach(() => { act(() => { mounted.splice(0).forEach(([root, host]) => { root.unmount(); host.remove() }) }) })
+ const row = (host, title) => [...host.querySelectorAll('.lrow')].find(r => r.querySelector('.lrow-t')?.textContent === title)
+ const lastMenuItems = () => useUI.getState().sheets.at(-1)
+
+ it('untouched, nothing new is written; a per-side row only shows for a per-side exercise', () => {
+ const onSave = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', warmupSets: 2 }, onSave)
+ const host = render(useUI.getState().sheets.at(-1))
+ expect(row(host, 'Rest between warm-ups').querySelector('.lrow-v').textContent).toBe('Like the work sets')
+ expect(row(host, 'Rest between sides')).toBeUndefined()
+ act(() => save(host))
+ const out = onSave.mock.calls[0][0]
+ expect('warmupRestOff' in out || 'warmupRestSec' in out || 'sideRestSec' in out).toBe(false)
+ })
+
+ it('keeps what it was given: a warm-up rest from the Coach, "no timer", a break between sides', () => {
+ const onSave = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', side: true, warmupRestSec: 45, sideRestSec: 20 }, onSave)
+ let host = render(useUI.getState().sheets.at(-1))
+ expect(row(host, 'Rest between warm-ups').querySelector('.lrow-v').textContent).toBe('45s')
+ expect(row(host, 'Rest between sides').querySelector('.lrow-v').textContent).toBe('20s')
+ act(() => save(host))
+ expect(onSave.mock.calls[0][0]).toMatchObject({ warmupRestSec: 45, sideRestSec: 20, side: true })
+
+ const again = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', warmupRestOff: true }, again)
+ host = render(useUI.getState().sheets.at(-1))
+ expect(row(host, 'Rest between warm-ups').querySelector('.lrow-v').textContent).toBe('No timer')
+ act(() => save(host))
+ expect(again.mock.calls[0][0].warmupRestOff).toBe(true)
+ expect('warmupRestSec' in again.mock.calls[0][0]).toBe(false)
+ })
+
+ it('"No timer" from the menu is saved as that, and "Like the work sets" takes it away again', () => {
+ const onSave = vi.fn()
+ exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', warmupRestSec: 45 }, onSave)
+ const host = render(useUI.getState().sheets.at(-1))
+ act(() => row(host, 'Rest between warm-ups').click())
+ const menu = render(lastMenuItems())
+ act(() => [...menu.querySelectorAll('.menu-item')].find(b => b.textContent.includes('No timer')).click())
+ act(() => row(host, 'Rest between warm-ups').click())
+ const menu2 = render(lastMenuItems())
+ expect(row(host, 'Rest between warm-ups').querySelector('.lrow-v').textContent).toBe('No timer')
+ act(() => [...menu2.querySelectorAll('.menu-item')].find(b => b.textContent.includes('Like the work sets')).click())
+ act(() => save(host))
+ const out = onSave.mock.calls[0][0]
+ expect('warmupRestOff' in out || 'warmupRestSec' in out).toBe(false)
+ })
+})
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index c82a0d80d..d4a9be912 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -1736,8 +1736,15 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
const withMeant = dbLoad ? { dbLoad } : {}
// "Last set to failure": written only when on, so a plan that never asked keeps its shape.
const withFailure = c.lastToFailure === true ? { lastToFailure: true } : {}
+ // The warm-ups' own rest and the break between sides (Discord "set-specific rest timers"):
+ // optional fields, written only when chosen, so a config that never touched them keeps its
+ // exact shape and rests as it always did (lib/supersetFlow.js warmupRestSecFor, sideRestFor).
+ const withSetRests = {
+ ...(c.warmupRestOff === true ? { warmupRestOff: true } : c.warmupRestSec > 0 ? { warmupRestSec: Math.round(c.warmupRestSec) } : {}),
+ ...(perSide && c.sideRestSec > 0 ? { sideRestSec: Math.round(c.sideRestSec) } : {}),
+ }
if (cardio) onSave({ sets, min: Math.max(1, Math.round(c.min) || 20), speed: Math.max(0, c.speed || 8), ...withNote, ...withRest })
- else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog, ...withNote, ...withWarmups, ...withRest, ...withMeant, ...withFailure })
+ else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog, ...withNote, ...withWarmups, ...withRest, ...withSetRests, ...withMeant, ...withFailure })
else {
// A unilateral target is stored even: the split has to divide, and a typed 15 would
// otherwise plan seven reps on one side and eight on the other, every session.
@@ -1749,7 +1756,7 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
range = normalizeRepRange(reps, c.repsMin, stride)
reps = range.reps
}
- const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog, ...withNote, ...withWarmups, ...withRest, ...withMeant }
+ const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog, ...withNote, ...withWarmups, ...withRest, ...withSetRests, ...withMeant }
// The list is the prescription; sets and reps follow it, so everything that reads the
// flat target (a config sheet reopened with the toggle off, older builds) still makes sense.
const list = pyramid ? normalizePyramid(c.pyramid, stride) : []
@@ -1903,6 +1910,44 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
<div className="small dim" style={{ marginBottom: 18 }}>
{t('Rest after each set of this exercise. 0:00 means your default rest.')}
</div>
+ {/* The warm-ups' own rest: 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. */}
+ {!cardio && <>
+ <div className="sect-b cfg-rest" style={{ marginBottom: 6 }}>
+ <Row icon="timer" iconTint="var(--yellow)" title={t('Rest between warm-ups')} accessory="chevron"
+ value={c.warmupRestOff === true ? t('No timer') : c.warmupRestSec > 0 ? fmtRest(c.warmupRestSec) : t('Like the work sets')}
+ onClick={() => menuSheet({
+ title: t('Rest between warm-ups'),
+ items: [
+ { icon: 'timer', label: t('Like the work sets'), 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'),
+ onDone: v => setC(x => { const { warmupRestOff, warmupRestSec, ...rest } = x; return v > 0 ? { ...rest, warmupRestSec: v } : { ...rest, warmupRestOff: true } }),
+ }) },
+ ],
+ })} />
+ </div>
+ <div className="small dim" style={{ marginBottom: 18 }}>
+ {t('Warm-ups are light, so they can rest less, or not at all. The last one still gets the full rest before your first work set.')}
+ </div>
+ </>}
+ {/* The break between the two sides of a per-side set. Without one: none for reps, the short
+ switch pause for a hold, as before. */}
+ {!cardio && perSide && <>
+ <div className="sect-b cfg-rest" style={{ marginBottom: 6 }}>
+ <Row icon="sides" iconTint="var(--blue)" title={t('Rest between sides')} accessory="chevron"
+ value={c.sideRestSec > 0 ? fmtRest(c.sideRestSec) : mode === 'time' ? t('Default ({0})', fmtRest(10)) : t('No timer')}
+ onClick={() => durationSheet({
+ title: t('Rest between sides'), value: c.sideRestSec > 0 ? c.sideRestSec : 0, max: REST_MAX,
+ off: mode === 'time' ? t('Default ({0})', fmtRest(10)) : t('No timer'),
+ onDone: v => setC(x => { const { sideRestSec, ...rest } = x; return v > 0 ? { ...rest, sideRestSec: v } : rest }),
+ })} />
+ </div>
+ <div className="small dim" style={{ marginBottom: 18 }}>
+ {t('A breather after one side, before the other. The full rest comes once both sides are done.')}
+ </div>
+ </>}
{/* ---------- bodyweight + per side (issues #31/#32/#33) ---------- */}
{!cardio && <div className="sect-b" style={{ marginBottom: 8 }}>
<Row icon="figureStrength" iconTint="var(--acc)" title={t('Bodyweight')}
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 25ac97c4f..c8696e20e 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 } from '../lib/supersetFlow.js'
+import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor, sideRestFor } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
import WorkoutScrollAnchor from '../components/WorkoutScrollAnchor.jsx'
import WorkoutChips from '../components/WorkoutChips.jsx'
@@ -1674,6 +1674,16 @@ function ActiveWorkout() {
else if (exJustDone && cardioEntry) useUI.getState().toast(t('Cardio logged'))
else if (exJustDone && m === 'time') useUI.getState().toast(t('Hold logged'))
+ // One side of a per-side reps set ticked, the other still to go: the exercise's own break
+ // between sides, when it has one (sideRestFor); none otherwise, as before.
+ if (side && !checked) {
+ const row = useStore.getState().S.active?.entries[idx]?.sets[i]
+ const other = side === 'L' ? 'R' : 'L'
+ if (row?.sides?.[side]?.done && !row.sides[other]?.done) {
+ const pause = sideRestFor(useStore.getState().S.active.entries[idx].target, { timed: false })
+ if (pause > 0) startRest(pause, idx, { kind: 'switch', forSet: i })
+ }
+ }
// Only progress beyond this exercise's high-water mark may navigate or change rest. This
// prevents an uncheck/re-check of finished work from replaying the flow side effects.
const fresh = useStore.getState().S.active
@@ -1726,9 +1736,9 @@ function ActiveWorkout() {
const sideOf = r => r && !isWarmupRow(r) ? r.side : null
const partner = sideOf(rows[i]) === 'L' && sideOf(rows[i + 1]) === 'R' ? rows[i + 1]
: sideOf(rows[i]) === 'R' && sideOf(rows[i - 1]) === 'L' ? rows[i - 1] : null
- if (m === 'time' && partner && !partner.done && restAfter > 0) {
- startRest(Math.min(SWITCH_SIDES_SEC, restAfter), idx, { kind: 'switch', forSet: i })
- return
+ if (m === 'time' && partner && !partner.done) {
+ const pause = sideRestFor(fresh.entries[idx].target, { timed: true, restAfter, switchSec: SWITCH_SIDES_SEC })
+ if (pause > 0) { startRest(pause, idx, { kind: 'switch', forSet: i }); return }
}
// Singleton units are ordinary exercises: they rest between sets and after the closing
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index 360920f23..f4027c320 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -300,6 +300,33 @@ describe('Workout set completion flow', () => {
expect(mocks.startRest).toHaveBeenCalledTimes(3)
})
+ // Discord "set-specific rest timers": "no timer" between ramp sets, a break between sides.
+ it('with "no timer" for warm-ups, a ramp set starts no rest; the last ramp set still rests the work rest', async () => {
+ await mount([exercise('ramped-squat', [false, false, false], {
+ target: { mode: 'reps', reps: 6, weight: 125, bodyweight: false, restSec: 150, warmupRestOff: true },
+ sets: [{ w: 60, r: 8, done: false, phase: 'warmup' }, { w: 95, r: 5, done: false, phase: 'warmup' }, { w: 125, r: 6, done: false }, { w: 125, r: 6, done: false }],
+ })])
+ await toggleSet(0)
+ expect(mocks.startRest).toHaveBeenLastCalledWith(0, expect.any(Number), { forSet: expect.any(Number) })
+ await toggleSet(1)
+ expect(mocks.startRest).toHaveBeenLastCalledWith(150, expect.any(Number), { forSet: expect.any(Number) })
+ })
+
+ it('a per-side set rests the exercise\'s break between sides; without one, nothing between them as before', async () => {
+ const lunge = extra => exercise('split-squat', [false], {
+ target: { mode: 'reps', reps: 10, weight: 20, side: true, ...extra },
+ sets: [{ w: 20, r: 10, done: false, sides: { L: { w: 20, r: 5, done: false }, R: { w: 20, r: 5, done: false } } }, { w: 20, r: 10, done: false, sides: { L: { w: 20, r: 5, done: false }, R: { w: 20, r: 5, done: false } } }],
+ })
+ await mount([lunge({ sideRestSec: 20 })], 0, { active: { workoutView: 'focus' } })
+ await click(container.querySelector('[data-focus-side="L"] button[aria-label="Complete left side"]'))
+ expect(mocks.startRest).toHaveBeenLastCalledWith(20, 0, { kind: 'switch', forSet: 0 })
+ await unmount()
+ mocks.startRest.mockClear()
+ await mount([lunge({})], 0, { active: { workoutView: 'focus' } })
+ await click(container.querySelector('[data-focus-side="L"] button[aria-label="Complete left side"]'))
+ expect(mocks.startRest).not.toHaveBeenCalled()
+ })
+
it('starts rest after a non-final ordinary set, but stops rest without restarting it on the final set', async () => {
await mount([exercise('plain-bench', [false, false, false])])
await toggleSet(0)