diff --git a/frontend/src/index.css b/frontend/src/index.css index 024eebe..a6be108 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -559,6 +559,9 @@ h4.sec{ .setrow+.setrow::before{ content:'';position:absolute;left:32px;right:0;top:0;height:var(--hair);background:var(--sep); } +.setph{margin:8px 0 2px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--dim);display:flex;align-items:center;gap:10px} +.setph::after{content:'';flex:1;height:1px;background:var(--sep)} +.setsep{height:1px;background:var(--sep);margin:9px 0} .setrow .n{ width:24px;height:24px;border-radius:50%;background:var(--surface-2);color:var(--label-2); display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;flex:none; diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index 6099b60..a09bdd6 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -161,6 +161,8 @@ export default { 'Last time you hit all reps — try {0}': 'Letztes Mal alle Wdh. geschafft — versuch {0}', 'Weights bumped to {0}': 'Gewichte auf {0} erhöht', 'Remove set': 'Satz entfernen', + 'Warm-up': 'Aufwärmen', + 'Add warm-up set': 'Aufwärmsatz hinzufügen', 'Add set': 'Satz hinzufügen', 'Cardio logged': 'Cardio eingetragen', 'Discard workout?': 'Training verwerfen?', diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index 2e96c8f..f26af19 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'La última vez completaste todas las reps — prueba {0}', 'Weights bumped to {0}': 'Pesos subidos a {0}', 'Remove set': 'Quitar serie', + 'Warm-up': 'Calentamiento', + 'Add warm-up set': 'Añadir serie de calentamiento', 'Add set': 'Añadir serie', 'Cardio logged': 'Cardio registrado', 'Discard workout?': '¿Descartar entrenamiento?', diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index 9b8b542..9333955 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'Toutes les reps réussies la dernière fois — essaie {0}', 'Weights bumped to {0}': 'Poids montés à {0}', 'Remove set': 'Retirer une série', + 'Warm-up': 'Échauffement', + 'Add warm-up set': 'Ajouter une série d’échauffement', 'Add set': 'Ajouter une série', 'Cardio logged': 'Cardio noté', 'Discard workout?': 'Abandonner la séance ?', diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index 32b8fd0..673870d 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'पिछली बार सारे रेप्स पूरे किए — {0} आज़माएँ', 'Weights bumped to {0}': 'वज़न बढ़ाकर {0} किया', 'Remove set': 'सेट हटाएँ', + 'Warm-up': 'वार्म-अप', + 'Add warm-up set': 'वार्म-अप सेट जोड़ें', 'Add set': 'सेट जोड़ें', 'Cardio logged': 'कार्डियो दर्ज हुआ', 'Discard workout?': 'वर्कआउट छोड़ें?', diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index f20d849..7d1079a 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': "L'ultima volta hai completato tutte le rip. — prova {0}", 'Weights bumped to {0}': 'Pesi aumentati a {0}', 'Remove set': 'Rimuovi serie', + 'Warm-up': 'Riscaldamento', + 'Add warm-up set': 'Aggiungi serie di riscaldamento', 'Add set': 'Aggiungi serie', 'Cardio logged': 'Cardio registrato', 'Discard workout?': 'Scartare allenamento?', diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index 1ea8005..e26c81d 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': '지난번에 모든 횟수를 채웠어요 — {0}에 도전해 보세요', 'Weights bumped to {0}': '무게를 {0}(으)로 올렸어요', 'Remove set': '세트 빼기', + 'Warm-up': '워밍업', + 'Add warm-up set': '워밍업 세트 추가', 'Add set': '세트 추가', 'Cardio logged': '유산소 기록됨', 'Discard workout?': '운동을 버릴까요?', diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index 04499c1..648fa99 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'Ostatnio zrobiłeś wszystkie powtórzenia — spróbuj {0}', 'Weights bumped to {0}': 'Ciężary podniesione do {0}', 'Remove set': 'Usuń serię', + 'Warm-up': 'Rozgrzewka', + 'Add warm-up set': 'Dodaj serię rozgrzewkową', 'Add set': 'Dodaj serię', 'Cardio logged': 'Cardio zapisane', 'Discard workout?': 'Odrzucić trening?', diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index 560758d..fc0cec2 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'Da última vez completaste todas as reps — tenta {0}', 'Weights bumped to {0}': 'Pesos aumentados para {0}', 'Remove set': 'Remover série', + 'Warm-up': 'Aquecimento', + 'Add warm-up set': 'Adicionar série de aquecimento', 'Add set': 'Adicionar série', 'Cardio logged': 'Cardio registado', 'Discard workout?': 'Descartar treino?', diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index cef3ef2..699259b 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'В прошлый раз все повторения сделаны — попробуй {0}', 'Weights bumped to {0}': 'Веса подняты до {0}', 'Remove set': 'Убрать подход', + 'Warm-up': 'Разминка', + 'Add warm-up set': 'Добавить разминочный подход', 'Add set': 'Добавить подход', 'Cardio logged': 'Кардио записано', 'Discard workout?': 'Отменить тренировку?', diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index cdab886..dc63609 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': 'Geçen sefer tüm tekrarları yaptın — {0} dene', 'Weights bumped to {0}': 'Ağırlıklar {0} değerine çıkarıldı', 'Remove set': 'Set kaldır', + 'Warm-up': 'Isınma', + 'Add warm-up set': 'Isınma seti ekle', 'Add set': 'Set ekle', 'Cardio logged': 'Kardiyo kaydedildi', 'Discard workout?': 'Antrenman iptal edilsin mi?', diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index b743d39..2d58a58 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -154,6 +154,8 @@ export default { 'Last time you hit all reps — try {0}': '上次完成了所有次数——试试 {0}', 'Weights bumped to {0}': '重量已提升到 {0}', 'Remove set': '减一组', + 'Warm-up': '热身', + 'Add warm-up set': '添加热身组', 'Add set': '加一组', 'Cardio logged': '有氧已记录', 'Discard workout?': '放弃训练?', diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index c81d26c..79397d8 100644 --- a/frontend/src/views/Workout.jsx +++ b/frontend/src/views/Workout.jsx @@ -54,7 +54,7 @@ function Elapsed({ start }) { } /* ---------- one exercise block (reps: weight×reps · time: a held duration · cardio: duration+speed) ---------- */ -function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onStartTimed }) { +function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed }) { const S = useStore(s => s.S) const working = useUI(s => s.work) const entry = S.active.entries[entryIdx] @@ -131,19 +131,30 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}
{col1.hd}{col2 && {col2.hd}}{col3 && {col3.hd}}{timed && }
- {entry.sets.map((s, i) =>
-
{i + 1}
- {cell(s, i, col1, 'w')} - {col2 && cell(s, i, col2, 'r')} - {col3 && cell(s, i, col3, 'eff')} - {/* A timed set is started, not typed: the timer counts the hold down and checks the - set off itself. The checkbox stays for anyone who timed it on their own watch. */} - {timed && } - onToggle(i)} /> -
)} + {entry.sets.map((s, i) => { + const warmBefore = i > 0 && !!entry.sets[i - 1].warmup + const isFirstWarmup = !!s.warmup && !warmBefore + return
+ {isFirstWarmup &&
{t('Warm-up')}
} + {!s.warmup && warmBefore &&
} +
+
{i + 1}
+ {cell(s, i, col1, 'w')} + {col2 && cell(s, i, col2, 'r')} + {col3 && cell(s, i, col3, 'eff')} + {/* A timed set is started, not typed: the timer counts the hold down and checks the + set off itself. The checkbox stays for anyone who timed it on their own watch. */} + {timed && } + {s.warmup && } + onToggle(i)} /> +
+
+ })}
-
+
+
@@ -172,6 +183,16 @@ function ActiveWorkout() { // what was actually logged — in the session, in history and in a backup. const setField = (idx, i, field, v) => mutEntry(idx, e => { if (v == null) delete e.sets[i][field]; else e.sets[i][field] = v + // Changing a weight cascades to the following sets of the same phase, so a + // heavier bar carries through the set instead of retyping every row. + if (field === 'w') { + const warm = !!e.sets[i].warmup + for (let j = i + 1; j < e.sets.length; j++) { + if (!!e.sets[j].warmup === warm) { + if (v == null) delete e.sets[j][field]; else e.sets[j][field] = v + } + } + } }) const modeAt = idx => modeOf({ ...(A.entries[idx].target || {}), id: A.entries[idx].id }) const addSet = idx => mutEntry(idx, e => { @@ -182,6 +203,19 @@ function ActiveWorkout() { 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 addWarmup = idx => mutEntry(idx, e => { + const firstWork = e.sets.findIndex(x => !x.warmup) + const at = firstWork === -1 ? e.sets.length : firstWork + const l = e.sets[at - 1] || e.sets[e.sets.length - 1] + const m = modeOf({ ...(e.target || {}), id: e.id }) + const warm = m === 'cardio' + ? { min: l ? l.min : (e.target.min || 20), speed: l ? l.speed : (e.target.speed || 8), done: false, warmup: true } + : m === 'time' + ? { sec: l ? l.sec : (e.target.sec || 45), w: l ? (l.w || 0) : (e.target.weight || 0), done: false, warmup: true } + : { w: l ? l.w : 0, r: l ? l.r : e.target.reps, done: false, warmup: true } + e.sets.splice(at, 0, warm) + }) + const removeSetAt = (idx, i) => mutEntry(idx, e => { if (e.sets.length > 1) e.sets.splice(i, 1) }) // A timed set is held, not typed. The work timer records what was actually held — an early // finish logs 0:38 of a 0:45 target rather than crediting the full prescription — and then @@ -267,11 +301,11 @@ function ActiveWorkout() { {unit.map((idx, k) =>
{k > 0 &&
+
} toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onAddSet={() => addSet(idx)} onRemoveSet={() => removeSet(idx)} onStartTimed={i => startTimed(idx, i)} /> + onToggle={i => toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onAddSet={() => addSet(idx)} onRemoveSet={() => removeSet(idx)} onAddWarmup={() => addWarmup(idx)} onRemoveSetAt={i => removeSetAt(idx, i)} onStartTimed={i => startTimed(idx, i)} />
)}
) : ( - toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onAddSet={() => addSet(cur)} onRemoveSet={() => removeSet(cur)} onStartTimed={i => startTimed(cur, i)} /> + toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onAddSet={() => addSet(cur)} onRemoveSet={() => removeSet(cur)} onAddWarmup={() => addWarmup(cur)} onRemoveSetAt={i => removeSetAt(cur, i)} onStartTimed={i => startTimed(cur, i)} /> )} :
{t('Freestyle workout — add your first exercise.')}
}