feat: prefill freestyle exercises from last workout

This commit is contained in:
Space-Hermes committed 2026-08-06 19:54:36 +02:00
1 parent 551b072c54
commit 84e98425cc
4 files changed
+121 -13

No files matched your search

+3 -3
View File
@@ -482,10 +482,10 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit }) {
</>
}
function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
const st = useStore(s => s.S)
const cardio = isCardio(ex.id)
const [c, setC] = useState(existing || defaultConfig(ex.id))
const [c, setC] = useState(existing || initial || defaultConfig(ex.id))
// Cardio keeps its own duration+speed form; the reps/time choice (issue #16) is offered for
// everything else, which is where the gap was — planks, hangs, wall sits, loaded carries.
const mode = cardio ? 'cardio' : modeOf({ ...c, id: ex.id })
@@ -596,7 +596,7 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
{onDelete && <><div style={{ height: 8 }} /><Button variant="danger" onClick={() => { close(); onDelete() }}>{t('Remove from routine')}</Button></>}
</>
}
export const exConfigSheet = (ex, existing, onSave, onDelete, routine) => ui().openSheet(close => <ExConfig ex={ex} existing={existing} onSave={onSave} onDelete={onDelete} routine={routine} close={close} />)
export const exConfigSheet = (ex, existing, onSave, onDelete, routine, initial) => ui().openSheet(close => <ExConfig ex={ex} existing={existing} initial={initial} onSave={onSave} onDelete={onDelete} routine={routine} close={close} />)
/* ============================ glyph picker ============================ */
// Grouped by what the glyph means for a training day, so picking one is a scan