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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
fix(workout): Set current switch straight to card view
bluzername95fc7192503f
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex 8e772d080..befa17ab5 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -683,7 +683,14 @@ function ActiveWorkout() {// List mode shows every unit at once, so the "current" exercise is chosen by tapping// "Set current" on its header instead of Prev/Next. The bottom Move/Swap/Remove actions// keep operating on it, and completing sets still advances it on its own.- const focusUnit = firstIdx => update(s => { if (s.active) s.active.cur = firstIdx })+ // "Set current" has no purpose besides picking which exercise to look at next, so it also+ // switches the session into card view (#260) rather than leaving you in the list to open+ // Cards yourself - three taps for one intent otherwise.+ const focusUnit = firstIdx => update(s => {+ if (!s.active) return+ s.active.cur = firstIdx+ s.active.workoutView = 'cards'+ })// The header ⋮ re-lays-out the running session without touching the saved default// (Settings → During a workout → Workout view). It writes s.active.workoutView, which the// render above prefers over S.workoutView.diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsxindex 5409de4d7..f68c6cebe 100644--- a/frontend/src/views/Workout.test.jsx+++ b/frontend/src/views/Workout.test.jsx@@ -1031,15 +1031,17 @@ describe('workout list view', () => {})it('marks the current unit and moves the mark with Set current', async () => {- await mount([exercise('plain-bench', [false]), exercise('plain-row', [false])], 0, { workoutView: 'list' })+ await mount([exercise('plain-bench', [false]), exercise('plain-row', [false])], 0, {+ workoutView: 'list', active: { workoutView: 'list' },+ })await act(async () => { focusButton(units()[1]).dispatchEvent(new dom.Event('click', { bubbles: true })) })expect(mocks.S.active.cur).toBe(1)- await rerender()- expect(units()[0].textContent).not.toContain('Current')- expect(units()[1].textContent).toContain('Current')- expect(focusButton(units()[0])).toBeTruthy()+ // #260: "Set current" has no purpose besides jumping to that exercise, so it now also+ // drops the session back into card view - the only place a single exercise is front and+ // center - instead of leaving you in the list to tap Cards yourself.+ expect(mocks.S.active.workoutView).toBe('cards')})// Since !92 finishing an exercise no longer moves the current marker on its own (cards use