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 open editor on a saved workout reads as an edit in the Today row, not as a workout in progress

Duarte Santos690076598245
diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsx
index 32b0d82d2..63d641f51 100644
--- a/frontend/src/views/Home.jsx
+++ b/frontend/src/views/Home.jsx
@@ -25,6 +25,9 @@ export default function Home() {
const routine = todayRoutines[0] || null
const todayName = todayRoutines.map(r => r.name).join(' + ')
const todayOvr = S.dayPlan[todayISO()] !== undefined
+ // An open editor on a saved workout (lib/session-edit.js) holds S.active too, but it is not a
+ // session in progress: the row takes you back to it as an edit, the way the tab bar does.
+ const editingSaved = !!S.active?.editingWorkoutId
// On a rest day, saying when you train next beats leaving the row as a full stop.
const next = !S.active && !todayRoutines.length ? nextTrainingDay(S, todayISO()) : null
const bw = lastBW(S)
@@ -81,18 +84,18 @@ export default function Home() {
<div className="today-row" {...tappable(onToday)}>
<div className="row" style={{ gap: 9, minWidth: 0 }}>
<span className="lrow-i" style={{ background: S.active ? 'var(--orange)' : doneToday ? 'var(--surface-3)' : routine ? 'var(--acc)' : 'var(--surface-3)' }}>
- <Icon name={S.active ? 'timer' : doneToday ? 'checkCircle' : routine ? glyphOf(routine.emoji) : 'moon'}
+ <Icon name={S.active ? (editingSaved ? 'pencil' : 'timer') : doneToday ? 'checkCircle' : routine ? glyphOf(routine.emoji) : 'moon'}
style={doneToday && !S.active ? { color: 'var(--green)' } : undefined} />
</span>
<div style={{ minWidth: 0 }}>
<div className="lbl2">{t('Today')}</div>
- <div className="ttl">{S.active ? t('{0} — in progress', S.active.name)
+ <div className="ttl">{S.active ? (editingSaved ? S.active.name : t('{0} — in progress', S.active.name))
: doneToday ? (doneToday.name ? t('{0} — done', doneToday.name) : t('Workout done'))
: routine ? todayName : 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>
+ {S.active ? <span className="tag" style={{ color: 'var(--orange)', background: 'color-mix(in srgb,var(--orange) 16%,transparent)' }}>{editingSaved ? t('Edit') : t('Resume')}</span>
: doneToday ? <span className="tag" style={{ color: 'var(--green)', background: 'color-mix(in srgb,var(--green) 16%,transparent)' }}>{t('Done')}</span>
: routine ? <span className="tag acc">{t('Start')}</span>
: <Icon name="plus" className="chev" />}
diff --git a/frontend/src/views/Home.startdoor.test.jsx b/frontend/src/views/Home.startdoor.test.jsx
index ee980827d..e7bfe75a1 100644
--- a/frontend/src/views/Home.startdoor.test.jsx
+++ b/frontend/src/views/Home.startdoor.test.jsx
@@ -65,4 +65,22 @@ describe('Home — the way to the Start screen when a plan already owns today',
mount()
expect(door()).toBeFalsy()
})
+
+ it('reads an open editor on a saved workout as an edit, not as a session in progress', () => {
+ setS({ active: { id: 'w', name: 'Push', start: 1000, cur: 0, entries: [], editingWorkoutId: 'w' } })
+ mount()
+ const row = host.querySelector('.today-row')
+ expect(row.querySelector('.ttl').textContent).toBe('Push')
+ expect(row.querySelector('.tag').textContent).toBe('Edit')
+ act(() => { row.dispatchEvent(new MouseEvent('click', { bubbles: true })) })
+ expect(nav).toHaveBeenCalledWith('/workout')
+ })
+
+ it('still reads a running session as in progress', () => {
+ setS({ active: { id: 'a', name: 'Push', start: Date.now(), cur: 0, entries: [] } })
+ mount()
+ const row = host.querySelector('.today-row')
+ expect(row.querySelector('.ttl').textContent).toBe('Push — in progress')
+ expect(row.querySelector('.tag').textContent).toBe('Resume')
+ })
})