From f11710197293a4b027ad364915029791caf9e9a2 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Tue, 21 Jul 2026 18:49:30 +0200 Subject: [PATCH] Add a remove-set button during a workout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was + Add set but no way back down — some days you just want fewer sets than planned. Mirrors Add set (removes the last row), floored at 1 set per exercise so an entry can't go empty. --- frontend/src/views/Workout.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index fa9a457..cf245d9 100644 --- a/frontend/src/views/Workout.jsx +++ b/frontend/src/views/Workout.jsx @@ -48,7 +48,7 @@ function Elapsed({ start }) { } /* ---------- one exercise block (strength: weight×reps · cardio: duration+speed) ---------- */ -function ExerciseBlock({ entryIdx, compact, onToggle, onField, onBumpAll, onAddSet }) { +function ExerciseBlock({ entryIdx, compact, onToggle, onField, onBumpAll, onAddSet, onRemoveSet }) { const S = useStore(s => s.S) const entry = S.active.entries[entryIdx] const ex = EXIDX[entry.id] @@ -89,7 +89,10 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onBumpAll, onAddS )}
- +
+ + +
} @@ -118,6 +121,7 @@ function ActiveWorkout() { if (isCardio(e.id)) e.sets.push({ min: l ? l.min : (e.target.min || 20), speed: l ? l.speed : (e.target.speed || 8), done: false }) else e.sets.push({ w: l ? l.w : 0, r: l ? l.r : e.target.reps, done: false }) }) + const removeSet = idx => mutEntry(idx, e => { if (e.sets.length > 1) e.sets.pop() }) const toggle = (idx, i) => { const cardioEntry = isCardio(A.entries[idx].id) @@ -158,11 +162,11 @@ function ActiveWorkout() { {unit.map((idx, k) =>
{k > 0 &&
+
} toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onBumpAll={(f, v) => bumpAll(idx, f, v)} onAddSet={() => addSet(idx)} /> + onToggle={i => toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onBumpAll={(f, v) => bumpAll(idx, f, v)} onAddSet={() => addSet(idx)} onRemoveSet={() => removeSet(idx)} />
)} ) : ( - toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onBumpAll={(f, v) => bumpAll(cur, f, v)} onAddSet={() => addSet(cur)} /> + toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onBumpAll={(f, v) => bumpAll(cur, f, v)} onAddSet={() => addSet(cur)} onRemoveSet={() => removeSet(cur)} /> )} :
🎯
Freestyle workout — add your first exercise.
}