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.

Structural balance: Change exercise opens a picker headed Change exercise instead of Add exercise (!140)

Duarte Santos344b62385c87
diff --git a/frontend/src/views/StructuralBalance.jsx b/frontend/src/views/StructuralBalance.jsx
index 09b9f47ed..cec397e20 100644
--- a/frontend/src/views/StructuralBalance.jsx
+++ b/frontend/src/views/StructuralBalance.jsx
@@ -35,8 +35,10 @@ export default function StructuralBalance() {
s.balanceOverrides = withOverride(s.balanceOverrides, overrideKey(template, role), exId)
})
const clearOverride = role => setOverride(role, null)
+ // Headed by what a pick does here, like the routine editor's Replace (#110): the picker's own
+ // heading is "Add exercise".
const changeExercise = role => {
- const picker = exercisePicker(ex => { setOverride(role, ex.id); picker.close() })
+ const picker = exercisePicker(ex => { setOverride(role, ex.id); picker.close() }, { title: t('Change exercise') })
}
return <>
diff --git a/frontend/src/views/StructuralBalance.test.jsx b/frontend/src/views/StructuralBalance.test.jsx
index e9d014f6a..ed0b87e63 100644
--- a/frontend/src/views/StructuralBalance.test.jsx
+++ b/frontend/src/views/StructuralBalance.test.jsx
@@ -160,6 +160,7 @@ describe('StructuralBalance view', () => {
const picker = useUI.getState().sheets.at(-1)
expect(picker).toBeTruthy()
const pickerView = picker.render(picker.close)
+ expect(pickerView.props.title).toBe('Change exercise') // not the picker's own "Add exercise"
act(() => pickerView.props.onPick({ id: '0043' })) // barbell full squat — deliberately not in inclineBench's whitelist
const chosen = useStore.getState().S.balanceOverrides['poliquin:inclineBench']