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.

Exercise settings: an exercise's own rest on the wheel, 0:00 says which default applies

Duarte Santos8fb609cd96ab
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index fcf9cd51c..a47167e11 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1925,4 +1925,6 @@ export default {
'All settings': 'كل الإعدادات',
'Changes stick for your next workouts too.': 'تبقى التغييرات لتمارينك القادمة أيضًا.',
'Workout settings': 'إعدادات التمرين الحالي',
+ 'Default ({0})': 'الافتراضي ({0})',
+ 'Rest for this exercise': 'الراحة لهذا التمرين',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 129b53f02..9df2bc706 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1892,4 +1892,6 @@ export default {
'All settings': 'Alle Einstellungen',
'Changes stick for your next workouts too.': 'Änderungen gelten auch für deine nächsten Trainings.',
'Workout settings': 'Trainings-Einstellungen',
+ 'Default ({0})': 'Standard ({0})',
+ 'Rest for this exercise': 'Pause für diese Übung',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index e13b90087..2566513f6 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'Todos los ajustes',
'Changes stick for your next workouts too.': 'Los cambios se quedan para tus próximos entrenamientos.',
'Workout settings': 'Ajustes del entrenamiento',
+ 'Default ({0})': 'Predeterminado ({0})',
+ 'Rest for this exercise': 'Descanso de este ejercicio',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index a426962f0..9f8e1a342 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'Tous les réglages',
'Changes stick for your next workouts too.': 'Tes changements valent aussi pour tes prochaines séances.',
'Workout settings': 'Réglages de la séance',
+ 'Default ({0})': 'Par défaut ({0})',
+ 'Rest for this exercise': 'Repos pour cet exercice',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 9696c5725..b6224613b 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'सभी सेटिंग्स',
'Changes stick for your next workouts too.': 'बदलाव आपके अगले वर्कआउट के लिए भी रहेंगे।',
'Workout settings': 'वर्कआउट सेटिंग',
+ 'Default ({0})': 'डिफ़ॉल्ट ({0})',
+ 'Rest for this exercise': 'इस एक्सरसाइज़ का आराम',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 1efb25eba..cd115ad7e 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1875,4 +1875,6 @@ export default {
'All settings': 'Összes beállítás',
'Changes stick for your next workouts too.': 'A változások a következő edzésekre is érvényesek.',
'Workout settings': 'Edzés beállításai',
+ 'Default ({0})': 'Alapértelmezett ({0})',
+ 'Rest for this exercise': 'Pihenő ennél a gyakorlatnál',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 879cfb8d6..e1e246617 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'Tutte le impostazioni',
'Changes stick for your next workouts too.': 'Le modifiche valgono anche per i prossimi allenamenti.',
'Workout settings': 'Impostazioni allenamento',
+ 'Default ({0})': 'Predefinito ({0})',
+ 'Rest for this exercise': 'Recupero per questo esercizio',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 4982f3811..c96b85af4 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': '전체 설정',
'Changes stick for your next workouts too.': '변경 사항은 다음 운동에도 그대로 적용돼요.',
'Workout settings': '운동 중 설정',
+ 'Default ({0})': '기본값 ({0})',
+ 'Rest for this exercise': '이 운동의 휴식',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index c3e60bcd5..5fd0b5c59 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'Wszystkie ustawienia',
'Changes stick for your next workouts too.': 'Zmiany zostają też na kolejne treningi.',
'Workout settings': 'Ustawienia treningu',
+ 'Default ({0})': 'Domyślnie ({0})',
+ 'Rest for this exercise': 'Przerwa dla tego ćwiczenia',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 8418fb4ea..9b70c2a7b 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -4,6 +4,8 @@
import pt from './pt.js'
export const PT_BR_OVERRIDES = {
+ 'Default ({0})': 'Padrão ({0})',
+ 'Rest for this exercise': 'Descanso deste exercício',
'All settings': 'Todas as configurações',
'Changes stick for your next workouts too.': 'As mudanças valem para os próximos treinos também.',
'Workout settings': 'Configurações do treino',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index bec35862c..717d836fe 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'Todas as definições',
'Changes stick for your next workouts too.': 'As alterações ficam para os próximos treinos também.',
'Workout settings': 'Definições do treino',
+ 'Default ({0})': 'Predefinição ({0})',
+ 'Rest for this exercise': 'Descanso deste exercício',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 8537fb571..a37e44420 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1876,4 +1876,6 @@ export default {
'All settings': 'Все настройки',
'Changes stick for your next workouts too.': 'Изменения сохранятся и для следующих тренировок.',
'Workout settings': 'Настройки тренировки',
+ 'Default ({0})': 'По умолчанию ({0})',
+ 'Rest for this exercise': 'Отдых для этого упражнения',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 9adb395be..6d3ac7b29 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1883,4 +1883,6 @@ export default {
'All settings': 'การตั้งค่าทั้งหมด',
'Changes stick for your next workouts too.': 'การเปลี่ยนแปลงจะใช้กับการออกกำลังกายครั้งต่อไปด้วย',
'Workout settings': 'ตั้งค่าระหว่างออกกำลังกาย',
+ 'Default ({0})': 'ค่าเริ่มต้น ({0})',
+ 'Rest for this exercise': 'เวลาพักของท่านี้',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 781939b24..4e16ae18f 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': 'Tüm ayarlar',
'Changes stick for your next workouts too.': 'Değişiklikler sonraki antrenmanlarında da geçerli.',
'Workout settings': 'Antrenman ayarları',
+ 'Default ({0})': 'Varsayılan ({0})',
+ 'Rest for this exercise': 'Bu egzersizin dinlenmesi',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index b2993dc68..683d02928 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1869,4 +1869,6 @@ export default {
'All settings': 'Усі налаштування',
'Changes stick for your next workouts too.': 'Зміни збережуться і для наступних тренувань.',
'Workout settings': 'Налаштування тренування',
+ 'Default ({0})': 'Типово ({0})',
+ 'Rest for this exercise': 'Відпочинок для цієї вправи',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index dd813851f..3d759a031 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1865,4 +1865,6 @@ export default {
'All settings': '所有設定',
'Changes stick for your next workouts too.': '變更也會套用到之後的訓練。',
'Workout settings': '訓練設定',
+ 'Default ({0})': '預設({0})',
+ 'Rest for this exercise': '此動作的組間休息',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 01df0ded5..95ca44b04 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1872,4 +1872,6 @@ export default {
'All settings': '所有设置',
'Changes stick for your next workouts too.': '更改也会用于你之后的训练。',
'Workout settings': '训练设置',
+ 'Default ({0})': '默认({0})',
+ 'Rest for this exercise': '本动作的休息',
}
diff --git a/frontend/src/sheets.config-rest.test.jsx b/frontend/src/sheets.config-rest.test.jsx
new file mode 100644
index 000000000..d2f108daa
--- /dev/null
+++ b/frontend/src/sheets.config-rest.test.jsx
@@ -0,0 +1,62 @@
+// @vitest-environment happy-dom
+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 { 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.
+const ex = EXDB.find(e => e.id === '0009')
+const mounted = []
+
+function render(sheet) {
+ const host = document.createElement('div')
+ document.body.appendChild(host)
+ const root = createRoot(host)
+ mounted.push([root, host])
+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
+ return host
+}
+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()
+
+describe('exercise settings: rest on the wheel', () => {
+ 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() }) }) })
+
+ it('reads Default with the default rest when the exercise has none, and saves what the wheel picks', () => {
+ 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)')
+ act(() => restRow(host).click())
+ 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)')
+ // Done keeps 0:00, the default; the value shown stays the default's.
+ act(() => [...wheel.querySelectorAll('button')].find(b => b.textContent === 'Done').click())
+ act(() => save(host))
+ expect(onSave.mock.calls[0][0].restSec || 0).toBe(0)
+ })
+
+ it('shows an exercise’s own rest as a time, and the wheel opens on it', () => {
+ 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))
+ expect(restRow(host).querySelector('.lrow-v').textContent).toBe('1:15')
+ act(() => restRow(host).click())
+ 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())
+ act(() => save(host))
+ expect(onSave.mock.calls[0][0].restSec).toBe(75)
+ })
+})
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 9c303097b..bd6a4f1bf 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -19,6 +19,8 @@ import { mediaOf, normalizeMediaRef, cleanUrl, workoutMediaOf } from './lib/medi
import { syncMedia } from './lib/media-sync.js'
import LineChart from './components/LineChart.jsx'
import Stepper from './components/Stepper.jsx'
+import { durationSheet } from './components/DurationWheel.jsx'
+import { REST_MAX, fmtRest } 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'
@@ -1592,9 +1594,17 @@ 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. */}
- <div className="row cfgrow" style={{ marginBottom: 6 }}>
- <Stepper label={t('Rest (s)')} value={c.restSec || 0} step={15} decimal={false}
- onChange={v => setC(x => ({ ...x, restSec: v }))} />
+ {/* 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. */}
+ <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. Leave at 0 to use your default rest timer.'),
+ onDone: v => setC(x => ({ ...x, restSec: v })),
+ })} />
</div>
<div className="small dim" style={{ marginBottom: 18 }}>
{t('Rest after each set of this exercise. Leave at 0 to use your default rest timer.')}