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.

Workout-Ende: Finish/Continue-Popup nach letztem Satz, dezenter Finish-Button mit x/y-Zähler

Duarte Santos3428daeb5472
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 9ffbf5853..42ce56a30 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -411,7 +411,7 @@ function TopWeight({ entryIdx, close }) {
})
close()
if (advance && unitDone) {
- if (isLastUnit) finishWorkout()
+ if (isLastUnit) workoutCompleteSheet() // whole workout done → finish/continue prompt
else update(s => { s.active.cur = units[unitIdx + 1][0] })
} else toast('Tracked — next time starts at ' + fmtNum(S().exWeights[entry.id].w) + ' ' + st.unit + ' 📈')
}
@@ -421,13 +421,26 @@ function TopWeight({ entryIdx, close }) {
<div className="bwin"><input ref={ref} type="number" inputMode="decimal" step="0.5" value={v} onChange={e => setV(e.target.value)} /><span>{st.unit}</span></div>
{prevBest > 0 ? <div className="small dim" style={{ textAlign: 'center', marginBottom: 12 }}>Previous best: {fmtNum(prevBest)} {st.unit}{maxSet > prevBest && <span style={{ color: 'var(--gold)' }}> — new record! 🏆</span>}</div> : <div style={{ height: 4 }} />}
{unitDone ? <>
- <button className="btn primary" onClick={() => commit(true)}>{isLastUnit ? 'Save & finish 🏁' : 'Save & next exercise ›'}</button>
+ <button className="btn primary" onClick={() => commit(true)}>{isLastUnit ? 'Save ✓' : 'Save & next exercise ›'}</button>
<div style={{ height: 8 }} /><button className="btn ghost dim" onClick={() => commit(false)}>Just close</button>
</> : <button className="btn primary" onClick={() => commit(false)}>Save weight</button>}
</>
}
export const topWeightSheet = entryIdx => ui().openSheet(close => <TopWeight entryIdx={entryIdx} close={close} />)
+// Shown when the last exercise's last set is checked — finish, or keep going.
+function WorkoutComplete({ close }) {
+ return <div style={{ textAlign: 'center', padding: '8px 0' }}>
+ <div style={{ fontSize: '3rem' }}>🎉</div>
+ <h3 style={{ margin: '8px 0' }}>That's the whole workout!</h3>
+ <div className="muted small" style={{ marginBottom: 16 }}>Every exercise done — great work. Finish up, or keep going and add another exercise.</div>
+ <button className="btn primary" onClick={() => { close(); finishWorkout() }}>Finish workout 🏁</button>
+ <div style={{ height: 8 }} />
+ <button className="btn" onClick={() => { close(); useUI.getState().toast('Keep going 💪 — tap “+ Add exercise” below') }}>Continue workout</button>
+ </div>
+}
+export const workoutCompleteSheet = () => ui().openSheet(close => <WorkoutComplete close={close} />, { kind: 'center' })
+
function FinishSummary({ w, prs, close }) {
const st = useStore(s => s.S)
return <div style={{ textAlign: 'center', padding: '8px 0' }}>
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 80623e29a..9ca2565d5 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -7,7 +7,7 @@ import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActiv
import { fmtNum, fmtDate, todayISO, DAYN } from '../lib/format.js'
import { beep, vibrate } from '../lib/sound.js'
import Media from '../components/Media.jsx'
-import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout } from '../sheets.jsx'
+import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet } from '../sheets.jsx'
/* ---------- start chooser (no active workout) ---------- */
function StartChooser() {
@@ -121,7 +121,8 @@ function ActiveWorkout() {
const toggle = (idx, i) => {
const cardioEntry = isCardio(A.entries[idx].id)
- let askTop = false, exJustDone = false
+ const isLastUnit = unitIdx >= units.length - 1
+ let askTop = false, exJustDone = false, workoutDone = false
mutEntry(idx, e => {
e.sets[i].done = !e.sets[i].done
if (e.sets[i].done) {
@@ -130,10 +131,14 @@ function ActiveWorkout() {
const unitDone = unit.every(ui => (ui === idx ? e : A.entries[ui]).sets.every(x => x.done))
if (isLastExInUnit && !unitDone) startRest(S.restSec)
else if (unitDone) stopRest()
+ if (unitDone && isLastUnit) workoutDone = true // last exercise's last set → done
if (e.sets.every(x => x.done)) { exJustDone = true; if (!cardioEntry && !e.asked) { e.asked = true; askTop = true } }
}
})
+ // non-cardio: topWeight first (it chains into the finish/continue prompt on the last unit).
+ // cardio or already-confirmed: go straight to the prompt.
if (askTop) topWeightSheet(idx)
+ else if (workoutDone) workoutCompleteSheet()
else if (exJustDone && cardioEntry) useUI.getState().toast('Cardio logged 🏃')
}
@@ -172,7 +177,13 @@ function ActiveWorkout() {
s.active.cur = s.active.entries.length - 1
})))}>+ Add exercise</button>
<div style={{ height: 10 }} />
- <button className="btn primary" onClick={finishWorkout}>Finish workout 🏁</button>
+ {(() => {
+ const exDone = A.entries.filter(e => e.sets.length && e.sets.every(s => s.done)).length
+ const allDone = A.entries.length > 0 && exDone === A.entries.length
+ return <button className={allDone ? 'btn primary' : 'btn ghost dim'} onClick={finishWorkout}>
+ {allDone ? 'Finish workout 🏁' : `Finish workout early · ${exDone}/${A.entries.length} exercises`}
+ </button>
+ })()}
<div style={{ height: 40 }} />
</div>
}