From 47c1cc446fc4c1ca99de7f16ae1ef9e5779d2a9f Mon Sep 17 00:00:00 2001 From: Horus Gonzalez Date: Sun, 30 Aug 2026 14:31:56 -0600 Subject: [PATCH] Exercise picker: the "+" adds now instead of opening the detail sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "+" on a row in the exercise picker read as "add this now" but did the same thing as tapping the row — opened the detail/config sheet — so it added nothing until you'd scrolled past sets/reps and found the real "Add to routine"/"Add exercise" button there. The "+" now commits with the default config (or, mid-workout in freestyle, the same last-session-seeded config the sheet would have opened with) immediately, with a toast confirming what got added. Tapping the rest of the row is unchanged — it still opens the detail sheet, for setting sets/reps before adding. Both call sites (routine editor, and the mid-workout "Add exercise") get the same fix, since they share the one picker component. No new strings — reuses 'Add "{0}"' and '"{0}" added to {1}', both already translated in every locale. --- frontend/src/sheets.jsx | 9 ++++++++- frontend/src/views/RoutineEdit.jsx | 13 +++++++++++-- frontend/src/views/Workout.jsx | 13 ++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index b5c0bd9..4a328e8 100644 --- a/frontend/src/sheets.jsx +++ b/frontend/src/sheets.jsx @@ -502,7 +502,14 @@ function ExercisePicker({ onPick, close }) { } {f.slice(0, shown).map(e =>
onPick(e)}>
{exerciseNameFor(e)}
{t(e.tg || e.bp)} · {t(e.eq)}
- {usage[e.id] && } + {usage[e.id] && } + {/* A "+" glyph reads as "add this now" — it used to just open the same detail sheet as + tapping the row, so it added nothing until you'd scrolled past the sets/reps config + and found the real button. Now it does what it looks like: adds with the default + config right away. Tapping the row itself still opens the detail/config sheet, for + when you want to set sets/reps before adding. */} +
)} {f.length === 0 && bp === '★' &&
{t('Nothing chosen yet — add exercises and they’ll show up here.')}
} diff --git a/frontend/src/views/RoutineEdit.jsx b/frontend/src/views/RoutineEdit.jsx index a8c492c..76ab810 100644 --- a/frontend/src/views/RoutineEdit.jsx +++ b/frontend/src/views/RoutineEdit.jsx @@ -1,11 +1,12 @@ import { useNavigate, useParams } from 'react-router-dom' import { useEffect } from 'react' import { useStore } from '../store/useStore.js' +import { useUI } from '../store/useUI.js' import { exOr } from '../lib/exercises.js' import { activeProfile, exAvailable } from '../lib/equipment.js' import { uid } from '../lib/format.js' import { t, exerciseNameFor } from '../lib/i18n.js' -import { supersetUnits, cleanupSg, exLine } from '../lib/history.js' +import { supersetUnits, cleanupSg, exLine, defaultConfig } from '../lib/history.js' import { Thumb } from '../components/Media.jsx' import { glyphPicker, exercisePicker, exConfigSheet, confirmSheet } from '../sheets.jsx' import Icon from '../components/Icon.jsx' @@ -20,6 +21,7 @@ export default function RoutineEdit() { const { id } = useParams() const S = useStore(s => s.S) const update = useStore(s => s.update) + const toast = useUI(s => s.toast) const r = S.routines.find(x => x.id === id) useEffect(() => { if (!r) nav('/plan') }, [!!r]) // Editing here has no explicit "save" — every field change persists immediately. A single @@ -111,7 +113,14 @@ export default function RoutineEdit() { })()}
{t('Tap the link button on an exercise to superset it with the one above — you’ll do them back-to-back.')}
- +
- {A.entries.length > 0 && <>