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.

Settings: Rotation with no loop yet stays on Settings and offers Build your loop in Plan

Duarte Santosecc5a2f18424
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index da32ea0f0..74e633e59 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1935,4 +1935,5 @@ export default {
'Remove {0}': 'إزالة {0}',
'Delete {0}': 'حذف {0}',
'Move {0}': 'نقل {0}',
+ 'Build your loop in Plan': 'أنشئ دورتك في الخطة',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index d9845433c..cd2d6335d 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1902,4 +1902,5 @@ export default {
'Remove {0}': '{0} entfernen',
'Delete {0}': '{0} löschen',
'Move {0}': '{0} verschieben',
+ 'Build your loop in Plan': 'Kreislauf im Plan erstellen',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 44e48d8c8..af554bb97 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': 'Quitar {0}',
'Delete {0}': 'Eliminar {0}',
'Move {0}': 'Mover {0}',
+ 'Build your loop in Plan': 'Crea tu bucle en Plan',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 430aaf229..73a4c866f 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': 'Retirer {0}',
'Delete {0}': 'Supprimer {0}',
'Move {0}': 'Déplacer {0}',
+ 'Build your loop in Plan': 'Crée ta boucle dans Plan',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 29c32b7db..2b4654a14 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': '{0} हटाएँ',
'Delete {0}': '{0} मिटाएँ',
'Move {0}': '{0} खिसकाएँ',
+ 'Build your loop in Plan': 'योजना में अपना चक्र बनाएं',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index e7f0e2df7..61085566e 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1885,4 +1885,5 @@ export default {
'Remove {0}': '{0} eltávolítása',
'Delete {0}': '{0} törlése',
'Move {0}': '{0} áthelyezése',
+ 'Build your loop in Plan': 'Állítsd össze a köröd a Tervben',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 433b7661d..8fbdb0402 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': 'Togli {0}',
'Delete {0}': 'Elimina {0}',
'Move {0}': 'Sposta {0}',
+ 'Build your loop in Plan': 'Crea il tuo ciclo in Piano',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index eae794c71..5b2d6c264 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': '{0} 빼기',
'Delete {0}': '{0} 삭제',
'Move {0}': '{0} 이동',
+ 'Build your loop in Plan': '계획에서 순환 만들기',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index df0dd8855..74775564a 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': 'Usuń {0}',
'Delete {0}': 'Usuń {0}',
'Move {0}': 'Przenieś {0}',
+ 'Build your loop in Plan': 'Zbuduj pętlę w Planie',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 61973c225..603b6944f 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1166,6 +1166,7 @@ export const PT_BR_OVERRIDES = {
'Open Settings → Account → “Pair the mobile app” on your openGym site in a browser and enter the new code shown there. What this phone kept is merged into your account.': 'No seu site openGym em um navegador, abra Configurações → Conta → “Parear o aplicativo” e digite o novo código mostrado lá. O que este celular manteve é incorporado à sua conta.',
'Turn on push notifications first.': 'Ative primeiro as notificações push.',
'Delete {0}': 'Excluir {0}',
+ 'Build your loop in Plan': 'Monte seu ciclo no Plano',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index acab23ad0..1ccb37b05 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': 'Tirar {0}',
'Delete {0}': 'Eliminar {0}',
'Move {0}': 'Mover {0}',
+ 'Build your loop in Plan': 'Crie o seu ciclo no Plano',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 5ae929465..74ccb3995 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1886,4 +1886,5 @@ export default {
'Remove {0}': 'Убрать {0}',
'Delete {0}': 'Удалить {0}',
'Move {0}': 'Переместить {0}',
+ 'Build your loop in Plan': 'Собери круг в Плане',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 9528ba5ae..19e102e33 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1893,4 +1893,5 @@ export default {
'Remove {0}': 'เอา {0} ออก',
'Delete {0}': 'ลบ {0}',
'Move {0}': 'ย้าย {0}',
+ 'Build your loop in Plan': 'สร้างการวนรอบในแผน',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 0c3a0e087..1d27f0320 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': '{0} çıkar',
'Delete {0}': '{0} sil',
'Move {0}': '{0} taşı',
+ 'Build your loop in Plan': 'Döngünü Plan\'da oluştur',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index bb669e779..45488f214 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1879,4 +1879,5 @@ export default {
'Remove {0}': 'Прибрати {0}',
'Delete {0}': 'Видалити {0}',
'Move {0}': 'Перемістити {0}',
+ 'Build your loop in Plan': 'Збери коло в Плані',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 156f2ad73..fb5d1d011 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1875,4 +1875,5 @@ export default {
'Remove {0}': '移除 {0}',
'Delete {0}': '刪除 {0}',
'Move {0}': '移動 {0}',
+ 'Build your loop in Plan': '在計畫中建立循環',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 0512ab85c..935fc565f 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1882,4 +1882,5 @@ export default {
'Remove {0}': '移除 {0}',
'Delete {0}': '删除 {0}',
'Move {0}': '移动 {0}',
+ 'Build your loop in Plan': '在计划中创建循环',
}
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index 6aabc4572..1b006a3ef 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -136,10 +136,9 @@ export default function Settings({ page = null, find = null, via = null }) {
return
}
// The same switch as Plan's "How you train" (lib/rotation.js). With nothing to start (no
- // saved sequence, or a malformed queue Plan has to sort out) Plan is where to go next.
- let started = false
- update(s => { started = chooseRotation(s) })
- if (!started) nav('/plan')
+ // saved sequence, or a malformed queue Plan has to sort out) the choice holds and you stay
+ // here: the page then offers the way to Plan (below), so picking a value never leaves it.
+ update(s => { chooseRotation(s) })
}
// --- update check state ---
@@ -604,6 +603,9 @@ export default function Settings({ page = null, find = null, via = null }) {
options={[{ value: 'week', label: t('Fixed Week') }, { value: 'rotation', label: t('Rotation') }]}
value={mode} onChange={setScheduleMode} />}
</Row>
+ {/* Rotation chosen with no loop running yet: the loop is built on Plan. */}
+ {mode === 'rotation' && !liveQ && <Row icon="calendar" iconTint="var(--orange)" title={t('Build your loop in Plan')}
+ accessory="chevron" onClick={() => nav('/plan')} />}
{/* Monday or Sunday: the Plan list, the Home strip, the calendar grid and every "this
week" total follow it. Stored as a getDay() index (see lib/format.js). */}
<Row icon="calendar" iconTint="var(--orange)" title={t('Week starts on')}>
diff --git a/frontend/src/views/Settings.schedule.test.jsx b/frontend/src/views/Settings.schedule.test.jsx
index 5fdc62ffe..1268af1c4 100644
--- a/frontend/src/views/Settings.schedule.test.jsx
+++ b/frontend/src/views/Settings.schedule.test.jsx
@@ -69,6 +69,7 @@ const mount = over => { mocks.S = baseS(over); act(() => root.render(<Settings p
const seg = () => [...host.querySelectorAll('button')].filter(b => ['Fixed Week', 'Rotation'].includes(b.textContent))
const pick = label => act(() => seg().find(b => b.textContent === label).dispatchEvent(new MouseEvent('click', { bubbles: true })))
const selected = () => seg().find(b => b.className.includes('on'))?.textContent
+const buildRow = () => [...host.querySelectorAll('.lrow')].find(r => r.textContent.includes('Build your loop in Plan'))
describe('Settings — How you train (Plan & schedule)', () => {
it('selects Fixed Week without a usable queue, Rotation with one this app manages', () => {
@@ -135,18 +136,29 @@ describe('Settings — How you train (Plan & schedule)', () => {
expect(mocks.nav).not.toHaveBeenCalled()
})
- it('Rotation with nothing saved sends you to Plan, but stays selected — a live queue is not the only signal', () => {
+ it('Rotation with nothing saved stays selected and stays here, with a row that leads to Plan', () => {
mount()
+ expect(buildRow()).toBeUndefined()
pick('Rotation')
expect(mocks.S.queue).toBe(null)
expect(mocks.S.scheduleMode).toBe('rotation')
+ expect(mocks.nav).not.toHaveBeenCalled()
+ act(() => root.render(<Settings page="plan" key="again" />))
+ act(() => buildRow().click())
expect(mocks.nav).toHaveBeenCalledWith('/plan')
})
- it('a malformed queue sends you to Plan instead of starting a pass over it', () => {
+ it('a malformed queue is not started over; the row leads to Plan, which does the recovery', () => {
mount({ queue: { ids: ['gone'], since: Date.now() }, rotation: { id: 'r1', sequence: ['a'], label: 'x' } })
pick('Rotation')
expect(mocks.S.queue.ids).toEqual(['gone']) // untouched: Plan does the recovery
- expect(mocks.nav).toHaveBeenCalledWith('/plan')
+ expect(mocks.nav).not.toHaveBeenCalled()
+ act(() => root.render(<Settings page="plan" key="again" />))
+ expect(buildRow()).toBeTruthy()
+ })
+
+ it('no row to Plan while a loop is running', () => {
+ mount({ queue: { ids: ['a', 'b'], since: Date.now(), rotationId: 'r1' }, rotation: { id: 'r1', sequence: ['a', 'b'], label: 'x' } })
+ expect(buildRow()).toBeUndefined()
})
})