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

Beim Abhaken des letzten Satzes der letzten Übung erscheint ein Popup
'That's the whole workout!' mit 'Finish workout' und 'Continue workout'
(weitermachen + neue Übung hinzufügen). Der Finish-Button während des Trainings
ist jetzt dezent ('Finish workout early · x/y exercises') und wird erst
prominent, wenn alle Übungen erledigt sind.
This commit is contained in:
Duarte Santos committed 2026-07-20 20:21:46 +02:00
1 parent 4545e60974
commit 3428daeb54
2 files changed
+29 -5

No files matched your search

+15 -2
View File
@@ -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' }}>