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.

Home: an einem Ruhetag steht dort, wann die naechste Einheit ist

Duarte Santosddaaf1292952
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index 0850fc206..9eb3aa28a 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -284,6 +284,25 @@ export function effectiveRoutine(S, iso) {
const id = effectiveRoutineId(S, iso)
return id ? S.routines.find(r => r.id === id) || null : null
}
+
+/**
+ * The next day that actually has something to train, looking forward from `iso` (exclusive).
+ *
+ * Takes a date string rather than reading the clock so callers and tests agree on "today".
+ * A routine with no exercises does not count: starting one lands you in an empty session, so
+ * it is not an answer to "what is next" (the same guard TabBar applies before starting).
+ * Returns null when the whole week is rest.
+ */
+export function nextTrainingDay(S, iso) {
+ for (let i = 1; i <= 7; i++) {
+ const d = new Date(iso + 'T12:00:00')
+ d.setDate(d.getDate() + i)
+ const nextIso = isoOf(d)
+ const routine = effectiveRoutine(S, nextIso)
+ if (routine && (routine.ex || []).length) return { iso: nextIso, weekday: d.getDay(), routine }
+ }
+ return null
+}
/**
* Build the rows a planned exercise starts a session with: its work sets, preceded by however
* many warm-up sets the routine asks for (`cfg.warmupSets`, 0 by default so an existing plan
diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.js
index f74c6a4f0..685066abb 100644
--- a/frontend/src/lib/history.test.js
+++ b/frontend/src/lib/history.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
-import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, freestyleConfig, exLine, workoutVolume, bestWeightFor, bestWeightForEntry, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep, cascadeWeight, insertWarmupRow, removeRowAt, workSetsDone, pairAdjacent, unpairSuperset, supersetUnits, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from './history.js'
+import { nextTrainingDay, modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, freestyleConfig, exLine, workoutVolume, bestWeightFor, bestWeightForEntry, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep, cascadeWeight, insertWarmupRow, removeRowAt, workSetsDone, pairAdjacent, unpairSuperset, supersetUnits, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from './history.js'
import { EXDB } from './exercises.js'
// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.
@@ -853,3 +853,53 @@ describe('exNoteFor', () => {
expect(exNoteFor({}, '0025')).toBeNull()
})
})
+
+describe('nextTrainingDay', () => {
+ // 2026-08-18 is a Tuesday; the week map is keyed by getDay(), so 0 is Sunday.
+ const TUE = '2026-08-18'
+ const base = (over = {}) => ({
+ dayPlan: {},
+ routines: [{ id: 'r1', name: 'A', ex: [{ id: '0001' }] }, { id: 'r2', name: 'B', ex: [{ id: '0002' }] }],
+ week: {},
+ ...over
+ })
+
+ it('finds the next scheduled day and names its routine', () => {
+ const S = base({ week: { 4: 'r2' } }) // Thursday
+ expect(nextTrainingDay(S, TUE)).toMatchObject({ iso: '2026-08-20', weekday: 4 })
+ expect(nextTrainingDay(S, TUE).routine.name).toBe('B')
+ })
+
+ it('looks forward only — today itself is never the answer', () => {
+ // Only Tuesday is scheduled and today is Tuesday, so the next one is a week out. (The UI
+ // cannot reach this: a day with a session takes the other branch and never asks.)
+ const S = base({ week: { 2: 'r1' } })
+ expect(nextTrainingDay(S, TUE)).toMatchObject({ iso: '2026-08-25', weekday: 2 })
+ })
+
+ it('wraps around the end of the week', () => {
+ const S = base({ week: { 1: 'r1' } }) // Monday, six days on
+ expect(nextTrainingDay(S, TUE)).toMatchObject({ iso: '2026-08-24', weekday: 1 })
+ })
+
+ it('is null when every day is rest', () => {
+ expect(nextTrainingDay(base(), TUE)).toBeNull()
+ })
+
+ it('skips a day whose routine no longer exists', () => {
+ const S = base({ week: { 3: 'gone', 5: 'r1' } })
+ expect(nextTrainingDay(S, TUE)).toMatchObject({ iso: '2026-08-21', weekday: 5 })
+ })
+
+ it('skips a routine with no exercises — starting it would open an empty session', () => {
+ const S = base({ routines: [{ id: 'r1', name: 'A', ex: [] }, { id: 'r2', name: 'B', ex: [{ id: '1' }] }], week: { 3: 'r1', 5: 'r2' } })
+ expect(nextTrainingDay(S, TUE)).toMatchObject({ weekday: 5 })
+ })
+
+ it('respects a per-date override in both directions', () => {
+ const moved = base({ week: {}, dayPlan: { '2026-08-19': 'r1' } })
+ expect(nextTrainingDay(moved, TUE)).toMatchObject({ iso: '2026-08-19' })
+ const off = base({ week: { 3: 'r1', 5: 'r2' }, dayPlan: { '2026-08-19': 'rest' } })
+ expect(nextTrainingDay(off, TUE)).toMatchObject({ weekday: 5 })
+ })
+})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index f02491f29..d37a3fdcb 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(342)
- expect(inherited).toHaveLength(461)
+ expect(inherited).toHaveLength(462)
// If this fails, review the changed keys and wording before accepting a new hash. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1b6f52ab4152f95d7fca75fb79f12f582be228f6388b292b75932bfd09b427b2')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1ee637df4fe0a6e4bf56c5d728981ebd713147b23886b1ee533f1e6d18ec59bb')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 78217f7ac..dba325df2 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -118,6 +118,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Krank, Tag verpasst oder Lust auf was anderes? Wähle, was du stattdessen trainierst.',
'Rest / skip this day': 'Pause / Tag überspringen',
'Rest day': 'Pausentag',
+ 'Next session: {0}, {1}': 'Nächste Einheit: {0}, {1}',
'{0} workout': '{0} Training',
'{0} workouts': '{0} Trainings',
'No workouts this month': 'Keine Trainings in diesem Monat',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 6eb045042..b328d092c 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': '¿Enfermo, te saltaste un día o quieres otra sesión? Elige qué entrenar en su lugar.',
'Rest / skip this day': 'Descansar / saltar este día',
'Rest day': 'Día de descanso',
+ 'Next session: {0}, {1}': 'Próxima sesión: {0}, {1}',
'{0} workout': '{0} entrenamiento',
'{0} workouts': '{0} entrenamientos',
'No workouts this month': 'Sin entrenamientos este mes',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 65215003f..f01c6d461 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Malade, jour manqué ou envie d’autre chose ? Choisis quoi entraîner à la place.',
'Rest / skip this day': 'Repos / sauter ce jour',
'Rest day': 'Jour de repos',
+ 'Next session: {0}, {1}': 'Prochaine séance : {0}, {1}',
'{0} workout': '{0} séance',
'{0} workouts': '{0} séances',
'No workouts this month': 'Aucune séance ce mois-ci',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 46715c89f..7a72877b1 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'बीमार हैं, दिन छूट गया या कुछ और करना है? चुनें कि इसके बदले क्या ट्रेन करें।',
'Rest / skip this day': 'आराम / यह दिन छोड़ें',
'Rest day': 'आराम का दिन',
+ 'Next session: {0}, {1}': 'अगला सत्र: {0}, {1}',
'{0} workout': '{0} वर्कआउट',
'{0} workouts': '{0} वर्कआउट',
'No workouts this month': 'इस महीने कोई वर्कआउट नहीं',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index e5891e0ed..d08a1af24 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -110,6 +110,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Beteg vagy, kihagytál egy napot, vagy másra van kedved? Válaszd ki, mit edzel helyette.',
'Rest / skip this day': 'Pihenő / nap kihagyása',
'Rest day': 'Pihenőnap',
+ 'Next session: {0}, {1}': 'Következő edzés: {0}, {1}',
'{0} workout': '{0} edzés',
'{0} workouts': '{0} edzés',
'No workouts this month': 'Nincs edzés ebben a hónapban',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 75ed6da5f..a957f920d 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Malato, giorno saltato o voglia di altro? Scegli cosa allenare al suo posto.',
'Rest / skip this day': 'Riposo / salta questo giorno',
'Rest day': 'Giorno di riposo',
+ 'Next session: {0}, {1}': 'Prossima sessione: {0}, {1}',
'{0} workout': '{0} allenamento',
'{0} workouts': '{0} allenamenti',
'No workouts this month': 'Nessun allenamento questo mese',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index dd6b957c5..13e481efd 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': '아프거나, 하루를 놓쳤거나, 다른 운동이 하고 싶나요? 대신 할 운동을 선택하세요.',
'Rest / skip this day': '휴식 / 이 날 건너뛰기',
'Rest day': '휴식일',
+ 'Next session: {0}, {1}': '다음 세션: {0}, {1}',
'{0} workout': '운동 {0}회',
'{0} workouts': '운동 {0}회',
'No workouts this month': '이번 달 운동 없음',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index c5db41f52..1ab0b0cc4 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Choroba, opuszczony dzień albo ochota na coś innego? Wybierz, co trenować zamiast tego.',
'Rest / skip this day': 'Odpoczynek / pomiń ten dzień',
'Rest day': 'Dzień odpoczynku',
+ 'Next session: {0}, {1}': 'Następny trening: {0}, {1}',
'{0} workout': '{0} trening',
'{0} workouts': '{0} treningów',
'No workouts this month': 'Brak treningów w tym miesiącu',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index dd2ae30e8..78ea22f42 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Doente, falhaste um dia ou queres outra sessão? Escolhe o que treinar em vez disso.',
'Rest / skip this day': 'Descansar / saltar este dia',
'Rest day': 'Dia de descanso',
+ 'Next session: {0}, {1}': 'Próxima sessão: {0}, {1}',
'{0} workout': '{0} treino',
'{0} workouts': '{0} treinos',
'No workouts this month': 'Sem treinos este mês',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 9b69a0659..704f6194c 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Заболел, пропустил день или хочешь другую тренировку? Выбери, что делать вместо этого.',
'Rest / skip this day': 'Отдых / пропустить день',
'Rest day': 'День отдыха',
+ 'Next session: {0}, {1}': 'Следующая тренировка: {0}, {1}',
'{0} workout': 'Тренировок: {0}',
'{0} workouts': 'Тренировок: {0}',
'No workouts this month': 'В этом месяце тренировок нет',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index caad79df6..fa4331f05 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -110,6 +110,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'ป่วย, ขาดวัน หรืออยากเปลี่ยนโปรแกรม? เลือกสิ่งที่จะฝึกแทนได้เลย',
'Rest / skip this day': 'พัก / ข้ามวันนี้',
'Rest day': 'วันพัก',
+ 'Next session: {0}, {1}': 'เซสชันถัดไป: {0}, {1}',
'{0} workout': '{0} ครั้ง',
'{0} workouts': '{0} ครั้ง',
'No workouts this month': 'ไม่มีการออกกำลังกายในเดือนนี้',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 6ad297496..7f740f9b5 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': 'Hasta mısın, gün mü kaçırdın ya da farklı bir seans mı istiyorsun? Yerine ne çalışacağını seç.',
'Rest / skip this day': 'Dinlen / bu günü atla',
'Rest day': 'Dinlenme günü',
+ 'Next session: {0}, {1}': 'Sonraki antrenman: {0}, {1}',
'{0} workout': '{0} antrenman',
'{0} workouts': '{0} antrenman',
'No workouts this month': 'Bu ay antrenman yok',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index cba254c09..618aff334 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -113,6 +113,7 @@ export default {
'Sick, missed a day or want a different session? Pick what to train instead.': '生病、错过一天或想换个训练?选择改练什么。',
'Rest / skip this day': '休息 / 跳过这天',
'Rest day': '休息日',
+ 'Next session: {0}, {1}': '下次训练:{0},{1}',
'{0} workout': '{0} 次训练',
'{0} workouts': '{0} 次训练',
'No workouts this month': '本月没有训练',
diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsx
index 84990fe8a..54f79c1b2 100644
--- a/frontend/src/views/Home.jsx
+++ b/frontend/src/views/Home.jsx
@@ -1,8 +1,8 @@
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
-import { effectiveRoutine, effectiveRoutineId, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'
-import { fmtNum, fmtDate, todayISO, isoOf, weekKey, DAYS } from '../lib/format.js'
+import { effectiveRoutine, effectiveRoutineId, nextTrainingDay, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'
+import { fmtNum, fmtDate, todayISO, isoOf, weekKey, DAYS, DAYN } from '../lib/format.js'
import { t, dateLocale } from '../lib/i18n.js'
import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, loadStarterPlan, bwDeltaColor } from '../sheets.jsx'
import LineChart from '../components/LineChart.jsx'
@@ -21,6 +21,8 @@ export default function Home() {
const today = new Date()
const routine = effectiveRoutine(S, todayISO())
const todayOvr = S.dayPlan[todayISO()] !== undefined
+ // On a rest day, saying when you train next beats leaving the row as a full stop.
+ const next = !S.active && !routine ? nextTrainingDay(S, todayISO()) : null
const bw = lastBW(S)
const prevBW = S.bodyweight.length > 1 ? S.bodyweight[S.bodyweight.length - 2] : null
const delta = bw && prevBW ? bw.w - prevBW.w : null
@@ -78,6 +80,7 @@ export default function Home() {
<div className="ttl">{S.active ? t('{0} — in progress', S.active.name)
: doneToday ? (doneToday.name ? t('{0} — done', doneToday.name) : t('Workout done'))
: routine ? routine.name : t('Rest day')}{todayOvr && routine && !doneToday ? ' · ' + t('rescheduled') : ''}</div>
+ {next && !doneToday && <div className="ss">{t('Next session: {0}, {1}', t(DAYN[next.weekday]), next.routine.name)}</div>}
</div>
</div>
{S.active ? <span className="tag" style={{ color: 'var(--orange)', background: 'color-mix(in srgb,var(--orange) 16%,transparent)' }}>{t('Resume')}</span>