Add optional per-exercise notes
An exercise instance in a routine only carried sets/reps/weight — a flat target with no room for loading instructions that vary within a session (e.g. a pyramid: "bar only, then +1 plate/side each set"). Adds a small free-text `note` field alongside the existing config flags, shown in the routine editor, during the active workout, and round-tripped through the plan share/print/import paths. No schema migration: it's an optional string on the same object that already carries `sg`/`bodyweight`/`side`.
This commit is contained in:
1 parent
f8024d344d
commit
f52decf633
5 files changed
+21
-6
No files matched your search
@@ -45,6 +45,7 @@ function cleanEx(e) {
|
||||
if (e.repsMin != null) o.repsMin = e.repsMin
|
||||
if (e.repsMax != null) o.repsMax = e.repsMax
|
||||
if (e.sg) o.sg = e.sg
|
||||
if (e.note) o.note = e.note
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -174,7 +175,8 @@ function routineHTML(r, unit) {
|
||||
const ex = EXIDX[e.id]
|
||||
const name = ex ? ex.n : t('Unknown exercise')
|
||||
const part = ex && ex.bp && ex.bp !== 'cardio' ? `<span class="part">${esc(ex.bp)}</span>` : ''
|
||||
return `<div class="ex"><div class="ex-n">${esc(name)}${part}</div><div class="ex-s">${esc(scheme(e, unit))}</div></div>`
|
||||
const note = e.note ? `<div class="ex-note">${esc(e.note)}</div>` : ''
|
||||
return `<div class="ex"><div class="ex-row"><div class="ex-n">${esc(name)}${part}</div><div class="ex-s">${esc(scheme(e, unit))}</div></div>${note}</div>`
|
||||
}).join('')
|
||||
return u.length > 1
|
||||
? `<div class="ss"><div class="ss-tag">${esc(t('Superset'))}</div><div class="ss-items">${items}</div></div>`
|
||||
@@ -236,11 +238,13 @@ export function planPrintHTML(S, owner) {
|
||||
.r-count { font-size: 12px; color: #8a90a0; white-space: nowrap; }
|
||||
|
||||
.ex-list { display: flex; flex-direction: column; }
|
||||
.ex { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 6px 0; break-inside: avoid; page-break-inside: avoid; }
|
||||
.ex { display: flex; flex-direction: column; padding: 6px 0; break-inside: avoid; page-break-inside: avoid; }
|
||||
.ex + .ex, .ss + .ex, .ex + .ss { border-top: 1px solid #f2f3f6; }
|
||||
.ex-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
|
||||
.ex-n { text-transform: capitalize; font-weight: 500; }
|
||||
.ex-n .part { text-transform: capitalize; color: #9aa0ae; font-weight: 400; font-size: 12px; margin-left: 8px; }
|
||||
.ex-s { color: #3d424e; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||
.ex-note { color: #6a7080; font-size: 12px; margin-top: 2px; }
|
||||
.ex.empty, .none { color: #a2a8b6; }
|
||||
|
||||
.ss { break-inside: avoid; page-break-inside: avoid; border-left: 3px solid #cfe08a; padding-left: 12px; margin: 4px 0; }
|
||||
|
||||
@@ -206,6 +206,7 @@ export default {
|
||||
'Create one or load the starter plan.': 'Crea una o carga el plan inicial.',
|
||||
'Load starter plan (Push / Pull / Legs)': 'Cargar plan inicial (Push / Pull / Piernas)',
|
||||
'Superset with exercise above': 'Superserie con el ejercicio de arriba',
|
||||
'Note (optional) — loading cues, "bar only then +1 plate/side each set", anything worth remembering here': 'Nota (opcional) — indicaciones de carga, ej. «solo barra y +1 disco por lado en cada serie», lo que quieras recordar',
|
||||
'No exercises yet — add your first one.': 'Aún no hay ejercicios — añade el primero.',
|
||||
'Tap the link button on an exercise to superset it with the one above — you’ll do them back-to-back.': 'Toca el botón de enlace en un ejercicio para hacer superserie con el de arriba — los harás seguidos.',
|
||||
'Delete routine?': '¿Eliminar rutina?',
|
||||
|
||||
+11
-3
@@ -516,14 +516,19 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
|
||||
// rather than carrying a flag nothing downstream can read.
|
||||
const flags = {}
|
||||
if (bw !== isBodyweightEq(ex.id)) flags.bodyweight = bw
|
||||
if (cardio) onSave({ sets, min: Math.max(1, Math.round(c.min) || 20), speed: Math.max(0, c.speed || 8) })
|
||||
else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...flags, ...prog })
|
||||
// Free text, e.g. a pyramid's per-set loading ("bar only, +1 plate/side each set") — the
|
||||
// sets/reps/weight fields are one flat target and have no room for that on their own.
|
||||
// Mode-independent, so it is spread in below rather than folded into `flags`.
|
||||
const note = (c.note || '').trim().slice(0, 500)
|
||||
const withNote = note ? { note } : {}
|
||||
if (cardio) onSave({ sets, min: Math.max(1, Math.round(c.min) || 20), speed: Math.max(0, c.speed || 8), ...withNote })
|
||||
else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...flags, ...prog, ...withNote })
|
||||
else {
|
||||
// A unilateral target is stored even: the split has to divide, and a typed 15 would
|
||||
// otherwise plan seven reps on one side and eight on the other, every session.
|
||||
const typed = Math.max(1, Math.round(c.reps) || 10)
|
||||
const reps = perSide ? Math.ceil(typed / 2) * 2 : typed
|
||||
const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog }
|
||||
const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog, ...withNote }
|
||||
if (policyFor({ ...c, id: ex.id }, routine, 'reps') === 'double') out.repsMin = Math.min(reps, Math.max(1, Math.round(c.repsMin) || Math.max(1, reps - 2)))
|
||||
// A ceiling below the working reps would tell you to add a set on day one.
|
||||
if (bw && !(out.weight > 0) && c.repsMax > 0) out.repsMax = Math.max(reps, Math.round(c.repsMax))
|
||||
@@ -598,6 +603,9 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
|
||||
: t('Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.')}
|
||||
</div>}
|
||||
<ProgressionFields ex={ex} mode={mode} c={c} setC={setC} routine={routine} unit={st.unit} />
|
||||
<textarea className="input" rows={3} maxLength={500} style={{ marginBottom: 18 }}
|
||||
placeholder={t('Note (optional) — loading cues, "bar only then +1 plate/side each set", anything worth remembering here')}
|
||||
value={c.note || ''} onChange={e => setC(x => ({ ...x, note: e.target.value }))} />
|
||||
<Button variant="primary" onClick={save}>{existing ? t('Save') : t('Add to routine')}</Button>
|
||||
{ex.custom && <><div style={{ height: 8 }} /><Button icon="pencil" onClick={() => { close(); customExSheet(ex) }}>{t('Edit or delete this exercise')}</Button></>}
|
||||
{onDelete && <><div style={{ height: 8 }} /><Button variant="danger" onClick={() => { close(); onDelete() }}>{t('Remove from routine')}</Button></>}
|
||||
|
||||
@@ -67,7 +67,8 @@ export default function RoutineEdit() {
|
||||
exConfigSheet(ex, e, cfg => edit(x => { x[i] = { id: x[i].id, sg: x[i].sg, ...cfg } }), () => edit(x => { x.splice(i, 1); cleanupSg(x) }), r)
|
||||
}}>
|
||||
<Thumb ex={ex} />
|
||||
<div className="grow"><div className="tt capitalize">{ex.n}</div><div className="ss">{exLine(e, S.unit)}</div></div>
|
||||
<div className="grow"><div className="tt capitalize">{ex.n}</div><div className="ss">{exLine(e, S.unit)}</div>
|
||||
{e.note && <div className="small dim" style={{ marginTop: 2 }}>{e.note}</div>}</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, flex: 'none', alignItems: 'center' }}>
|
||||
{i > 0 && <button className={'iconbtn' + (linkedPrev ? ' on-ss' : '')} title={t('Superset with exercise above')} style={{ width: 32, height: 28, borderRadius: 8, fontSize: 15 }} onClick={ev => { ev.stopPropagation(); toggleLink(i) }}><Icon name="link" /></button>}
|
||||
<div style={{ display: 'flex', gap: 2 }}>
|
||||
|
||||
@@ -129,6 +129,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
{ex.eq && <span className="tag">{t(ex.eq)}</span>}
|
||||
{best > 0 && <span className="tag nocap">{t('Best:')} {fmtNum(best)} {S.unit}</span>}
|
||||
</div>
|
||||
{cfg.note && <div className="exnote">{cfg.note}</div>}
|
||||
{last && <div className="small dim" style={{ marginBottom: 4 }}>{t('Last time')} ({fmtDate(last.d)}): {last.sets.map(s => setLabel(entry.id, s, last.target)).join(', ')}</div>}
|
||||
{plan && plan.why && plan.kind !== 'off' && <div className={'progline' + (plan.kind === 'deload' ? ' warn' : '')}>
|
||||
<Icon name={plan.kind === 'up' ? 'arrowUp' : plan.kind === 'deload' ? 'arrowDown' : 'lightbulb'} />
|
||||
|
||||
Reference in new issue
Block a user