Stangengewicht: Stepper in Uebungsdetail und Konfiguration, Scheiben-pro-Seite-Chip im Workout, alle zwoelf Sprachen, Tests
This commit is contained in:
1 parent
9892f735d3
commit
7dd5b34eb3
16 files changed
+260
-5
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { BAR_EQ, DEFAULT_BAR_KG, DEFAULT_BAR_LB, usesBar, defaultBarWeight, barWeightFor, hasBarOverride, plateSplit } from './bar.js'
|
||||
import { EXDB } from './exercises-data.js'
|
||||
|
||||
const idOf = eq => EXDB.find(e => e.eq === eq).id
|
||||
|
||||
describe('bar equipment', () => {
|
||||
test('covers the five bar types and the 228 catalogue exercises they carry', () => {
|
||||
expect([...BAR_EQ].sort()).toEqual(['barbell', 'ez barbell', 'olympic barbell', 'smith machine', 'trap bar'])
|
||||
expect(EXDB.filter(e => BAR_EQ.has(e.eq)).length).toBe(228)
|
||||
})
|
||||
|
||||
test('usesBar answers for ids and exercise objects alike', () => {
|
||||
for (const eq of BAR_EQ) {
|
||||
expect(usesBar(idOf(eq)), eq).toBe(true)
|
||||
expect(usesBar({ eq }), eq).toBe(true)
|
||||
}
|
||||
expect(usesBar({ eq: 'dumbbell' })).toBe(false)
|
||||
expect(usesBar({ eq: 'body weight' })).toBe(false)
|
||||
expect(usesBar('no-such-id')).toBe(false)
|
||||
expect(usesBar(null)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('per-unit defaults', () => {
|
||||
test('every bar type has a default in both units', () => {
|
||||
for (const eq of BAR_EQ) {
|
||||
expect(DEFAULT_BAR_KG[eq], eq).toBeGreaterThan(0)
|
||||
expect(DEFAULT_BAR_LB[eq], eq).toBeGreaterThan(0)
|
||||
}
|
||||
expect(defaultBarWeight('ez barbell', 'kg')).toBe(10)
|
||||
expect(defaultBarWeight('ez barbell', 'lb')).toBe(25)
|
||||
expect(defaultBarWeight('olympic barbell', 'kg')).toBe(20)
|
||||
// A lb profile gets the bar its gym actually racks, not a 44.1 lb conversion.
|
||||
expect(defaultBarWeight('barbell', 'lb')).toBe(45)
|
||||
expect(defaultBarWeight('dumbbell', 'kg')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('barWeightFor', () => {
|
||||
const barbell = idOf('barbell')
|
||||
const ez = idOf('ez barbell')
|
||||
|
||||
test('falls back to the equipment default in the profile unit', () => {
|
||||
expect(barWeightFor({ unit: 'kg', barWeights: {} }, barbell)).toBe(20)
|
||||
expect(barWeightFor({ unit: 'lb', barWeights: {} }, barbell)).toBe(45)
|
||||
expect(barWeightFor({ unit: 'kg' }, ez)).toBe(10)
|
||||
})
|
||||
|
||||
test('an explicit override wins over the default', () => {
|
||||
const S = { unit: 'kg', barWeights: { [ez]: 7.5 } }
|
||||
expect(barWeightFor(S, ez)).toBe(7.5)
|
||||
expect(hasBarOverride(S, ez)).toBe(true)
|
||||
expect(barWeightFor(S, barbell)).toBe(20) // other exercises keep their default
|
||||
expect(hasBarOverride(S, barbell)).toBe(false)
|
||||
})
|
||||
|
||||
test('a cleared (deleted or zeroed) override falls back to the default', () => {
|
||||
const S = { unit: 'kg', barWeights: { [ez]: 12.5 } }
|
||||
delete S.barWeights[ez]
|
||||
expect(barWeightFor(S, ez)).toBe(10)
|
||||
expect(barWeightFor({ unit: 'kg', barWeights: { [ez]: 0 } }, ez)).toBe(10)
|
||||
expect(hasBarOverride({ unit: 'kg', barWeights: { [ez]: 0 } }, ez)).toBe(false)
|
||||
})
|
||||
|
||||
test('is null for anything without a bar', () => {
|
||||
const dumbbell = EXDB.find(e => e.eq === 'dumbbell')
|
||||
expect(barWeightFor({ unit: 'kg', barWeights: {} }, dumbbell.id)).toBeNull()
|
||||
expect(barWeightFor({ unit: 'kg', barWeights: {} }, 'no-such-id')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('plateSplit', () => {
|
||||
test('splits what is beyond the bar evenly per side', () => {
|
||||
expect(plateSplit(62.5, 20)).toBe(21.25)
|
||||
expect(plateSplit(100, 20)).toBe(40)
|
||||
expect(plateSplit(30, 10)).toBe(10)
|
||||
})
|
||||
|
||||
test('rounds to 2 decimals', () => {
|
||||
expect(plateSplit(65.55, 20)).toBe(22.78)
|
||||
expect(plateSplit(21.2, 20)).toBe(0.6)
|
||||
})
|
||||
|
||||
test('is null when there is nothing sensible to show', () => {
|
||||
expect(plateSplit(20, 20)).toBe(null) // bar only
|
||||
expect(plateSplit(15, 20)).toBe(null) // below the bar
|
||||
expect(plateSplit(0, 20)).toBe(null)
|
||||
expect(plateSplit(100, 0)).toBe(null)
|
||||
expect(plateSplit(null, 20)).toBe(null)
|
||||
expect(plateSplit(100, null)).toBe(null)
|
||||
expect(plateSplit(undefined, undefined)).toBe(null)
|
||||
})
|
||||
})
|
||||
@@ -27,11 +27,11 @@ describe('Brazilian Portuguese locale', () => {
|
||||
.sort(byCodeUnit)
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
|
||||
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(535)
|
||||
expect(inherited).toHaveLength(542)
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(539)
|
||||
expect(inherited).toHaveLength(545)
|
||||
// If this fails, review the changed keys and wording before accepting a new hash. From
|
||||
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('9e13b3bcfd80c38ae15ceb5518094b9f2243a7cd0011feb9cd68e818065b9909')
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('206471a00deba14ead15903b2334353d9fcc1fadc645c00db985db2bc73d35ad')
|
||||
})
|
||||
|
||||
test('does not leak European Portuguese UI terms', () => {
|
||||
|
||||
@@ -1037,4 +1037,12 @@ export default {
|
||||
'What should change?': 'Was soll anders sein?',
|
||||
'Coach is thinking…': 'Coach denkt nach…',
|
||||
'Message the Coach…': 'Nachricht an den Coach…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Stangengewicht',
|
||||
'Bar ({0})': 'Stange ({0})',
|
||||
'Bar {0}': 'Stange {0}',
|
||||
'Default for this bar type.': 'Standard für diesen Stangentyp.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Auf 0 stellen, um zum Standard ({0}) zurückzukehren.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Gilt überall für diese Übung, nicht nur in diesem Plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Eingetragen wird weiterhin das Gesamtgewicht — die Stange zählt nur für die Scheiben-Rechnung pro Seite.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': '¿Qué debería cambiar?',
|
||||
'Coach is thinking…': 'El Coach está pensando…',
|
||||
'Message the Coach…': 'Escribe al Coach…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Peso de la barra',
|
||||
'Bar ({0})': 'Barra ({0})',
|
||||
'Bar {0}': 'Barra {0}',
|
||||
'Default for this bar type.': 'Valor por defecto para este tipo de barra.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Pon 0 para volver al valor por defecto ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Se aplica a este ejercicio en todas partes, no solo en este plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Sigues registrando el peso total — la barra solo se usa para calcular los discos por lado.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'Que faut-il changer ?',
|
||||
'Coach is thinking…': 'Le Coach réfléchit…',
|
||||
'Message the Coach…': 'Écrire au Coach…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Poids de la barre',
|
||||
'Bar ({0})': 'Barre ({0})',
|
||||
'Bar {0}': 'Barre {0}',
|
||||
'Default for this bar type.': 'Valeur par défaut pour ce type de barre.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Mets 0 pour revenir à la valeur par défaut ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'S’applique à cet exercice partout, pas seulement dans ce plan.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Tu enregistres toujours le poids total — la barre ne sert qu’au calcul des disques par côté.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'क्या बदलना चाहिए?',
|
||||
'Coach is thinking…': 'कोच सोच रहा है…',
|
||||
'Message the Coach…': 'कोच को संदेश…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'बार का वज़न',
|
||||
'Bar ({0})': 'बार ({0})',
|
||||
'Bar {0}': 'बार {0}',
|
||||
'Default for this bar type.': 'इस तरह की बार का डिफ़ॉल्ट मान।',
|
||||
'Set to 0 to go back to the default ({0}).': 'डिफ़ॉल्ट ({0}) पर लौटने के लिए 0 सेट करें।',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'यह इस एक्सरसाइज़ पर हर जगह लागू होता है, सिर्फ़ इसी प्लान पर नहीं।',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'आप अब भी कुल वज़न ही दर्ज करते हैं — बार सिर्फ़ हर तरफ़ की प्लेट गिनती में काम आता है।',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'Cosa dovrebbe cambiare?',
|
||||
'Coach is thinking…': 'Il Coach sta pensando…',
|
||||
'Message the Coach…': 'Scrivi al Coach…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Peso del bilanciere',
|
||||
'Bar ({0})': 'Bilanciere ({0})',
|
||||
'Bar {0}': 'Bilanciere {0}',
|
||||
'Default for this bar type.': 'Valore predefinito per questo tipo di bilanciere.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Imposta 0 per tornare al valore predefinito ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Vale per questo esercizio ovunque, non solo in questo piano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Registri comunque il peso totale — il bilanciere serve solo al calcolo dei dischi per lato.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': '무엇을 바꿀까요?',
|
||||
'Coach is thinking…': '코치가 생각 중…',
|
||||
'Message the Coach…': '코치에게 메시지…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': '바 무게',
|
||||
'Bar ({0})': '바 ({0})',
|
||||
'Bar {0}': '바 {0}',
|
||||
'Default for this bar type.': '이 바 종류의 기본값입니다.',
|
||||
'Set to 0 to go back to the default ({0}).': '0으로 두면 기본값({0})으로 돌아갑니다.',
|
||||
'Applies to this exercise everywhere, not just this plan.': '이 플랜만이 아니라 어디서든 이 운동에 적용됩니다.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': '기록은 여전히 총 무게입니다 — 바 무게는 한쪽에 끼울 원판 계산에만 쓰입니다.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'Co powinno się zmienić?',
|
||||
'Coach is thinking…': 'Trener myśli…',
|
||||
'Message the Coach…': 'Napisz do trenera…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Ciężar gryfu',
|
||||
'Bar ({0})': 'Gryf ({0})',
|
||||
'Bar {0}': 'Gryf {0}',
|
||||
'Default for this bar type.': 'Wartość domyślna dla tego typu gryfu.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Ustaw 0, aby wrócić do wartości domyślnej ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Dotyczy tego ćwiczenia wszędzie, nie tylko w tym planie.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Nadal zapisujesz ciężar całkowity — gryf służy tylko do wyliczenia talerzy na stronę.',
|
||||
}
|
||||
@@ -553,7 +553,13 @@ export const PT_BR_OVERRIDES = {
|
||||
'Coming back after a break': 'Voltando depois de uma pausa',
|
||||
'Training regularly': 'Treino regularmente',
|
||||
'Back muscles': 'Costas',
|
||||
'{0}: what’s planned': '{0}: previsto'
|
||||
'{0}: what’s planned': '{0}: previsto',
|
||||
|
||||
// --- bar weight (plate math) --- ('Peso da barra', 'Barra ({0})', 'Barra {0}' inherit)
|
||||
'Default for this bar type.': 'Padrão para este tipo de barra.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Defina 0 para voltar ao padrão ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Vale para este exercício em todos os lugares, não só neste plano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Você continua registrando o peso total — a barra só entra no cálculo das anilhas por lado.'
|
||||
}
|
||||
|
||||
export default { ...pt, ...PT_BR_OVERRIDES }
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'O que deve mudar?',
|
||||
'Coach is thinking…': 'O Coach está a pensar…',
|
||||
'Message the Coach…': 'Escreve ao Coach…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Peso da barra',
|
||||
'Bar ({0})': 'Barra ({0})',
|
||||
'Bar {0}': 'Barra {0}',
|
||||
'Default for this bar type.': 'Predefinição para este tipo de barra.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Coloca 0 para voltar à predefinição ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Aplica-se a este exercício em todo o lado, não só neste plano.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Continuas a registar o peso total — a barra só conta para o cálculo dos discos por lado.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'Что изменить?',
|
||||
'Coach is thinking…': 'Тренер думает…',
|
||||
'Message the Coach…': 'Написать тренеру…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Вес грифа',
|
||||
'Bar ({0})': 'Гриф ({0})',
|
||||
'Bar {0}': 'Гриф {0}',
|
||||
'Default for this bar type.': 'Значение по умолчанию для этого типа грифа.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Поставь 0, чтобы вернуться к значению по умолчанию ({0}).',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Действует для этого упражнения везде, а не только в этом плане.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Записывается по-прежнему общий вес — гриф нужен только для расчёта блинов на сторону.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': 'Ne değişmeli?',
|
||||
'Coach is thinking…': 'Koç düşünüyor…',
|
||||
'Message the Coach…': 'Koça yaz…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': 'Bar ağırlığı',
|
||||
'Bar ({0})': 'Bar ({0})',
|
||||
'Bar {0}': 'Bar {0}',
|
||||
'Default for this bar type.': 'Bu bar türü için varsayılan.',
|
||||
'Set to 0 to go back to the default ({0}).': 'Varsayılana ({0}) dönmek için 0 yap.',
|
||||
'Applies to this exercise everywhere, not just this plan.': 'Yalnızca bu planda değil, bu egzersiz için her yerde geçerli.',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': 'Yine de toplam ağırlığı kaydedersin — bar yalnızca taraf başına plaka hesabına girer.',
|
||||
}
|
||||
@@ -1018,4 +1018,12 @@ export default {
|
||||
'What should change?': '需要改什么?',
|
||||
'Coach is thinking…': '教练思考中…',
|
||||
'Message the Coach…': '给教练留言…',
|
||||
// --- bar weight (plate math) ---
|
||||
'Bar weight': '杠铃杆重量',
|
||||
'Bar ({0})': '杆 ({0})',
|
||||
'Bar {0}': '杆 {0}',
|
||||
'Default for this bar type.': '此类杠铃杆的默认值。',
|
||||
'Set to 0 to go back to the default ({0}).': '设为 0 即恢复默认值({0})。',
|
||||
'Applies to this exercise everywhere, not just this plan.': '对这个动作处处生效,不只在此计划中。',
|
||||
'You still log the total weight — the bar only feeds the per-side plate math.': '记录的仍是总重量——杆重只用于每侧杠铃片的计算。',
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipme
|
||||
import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'
|
||||
import { fmtDate, fmtNum, fmtVol, fmtDur, durPart, todayISO, uid, exCount, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'
|
||||
import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
|
||||
import { usesBar, barWeightFor, defaultBarWeight, hasBarOverride } from './lib/bar.js'
|
||||
import { beep, vibrate } from './lib/sound.js'
|
||||
import { t, instrFor, exerciseNameFor, getLang, INSTR_LANGS } from './lib/i18n.js'
|
||||
import { nav } from './lib/nav.js'
|
||||
@@ -265,6 +266,44 @@ function GoalSheet({ close }) {
|
||||
}
|
||||
export const goalSheet = () => ui().openSheet(close => <GoalSheet close={close} />)
|
||||
|
||||
/* ============================ bar weight ============================ */
|
||||
// One editor for every place the bar weight shows up (exercise detail, exercise config,
|
||||
// mid-workout sheet): a stepper over the effective value. What it saves is per exercise
|
||||
// and lives in S.barWeights, in the profile unit (see lib/bar.js) — stepping or typing
|
||||
// down to 0 clears the override and the field falls back to the default for the bar
|
||||
// type, the same "0 drops the key" shape a nullable set field has.
|
||||
function BarWeightEditor({ ex, extra }) {
|
||||
const st = useStore(s => s.S)
|
||||
const explicit = hasBarOverride(st, ex.id)
|
||||
const def = defaultBarWeight(ex.eq, st.unit)
|
||||
const setBar = v => update(s => {
|
||||
s.barWeights = s.barWeights || {}
|
||||
const n = Math.max(0, Math.round((v || 0) * 100) / 100)
|
||||
if (n > 0) s.barWeights[ex.id] = n; else delete s.barWeights[ex.id]
|
||||
})
|
||||
return <>
|
||||
<div className="row cfgrow" style={{ marginBottom: 6 }}>
|
||||
<Stepper label={t('Bar ({0})', st.unit)} value={barWeightFor(st, ex) || 0} step={2.5} onChange={setBar} />
|
||||
</div>
|
||||
<div className="small dim" style={{ marginBottom: 18 }}>
|
||||
{explicit ? t('Set to 0 to go back to the default ({0}).', fmtNum(def) + ' ' + st.unit) : t('Default for this bar type.')}
|
||||
{extra ? ' ' + extra : ''}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
|
||||
// Tiny mid-workout sheet behind the "Bar … · … per side" chip — same value, same editor.
|
||||
function BarWeightSheet({ exId, close }) {
|
||||
const ex = exOr(exId)
|
||||
return <>
|
||||
<h3>{t('Bar weight')}</h3>
|
||||
<div className="muted small capitalize" style={{ marginBottom: 12 }}>{exerciseNameFor(ex)}</div>
|
||||
<BarWeightEditor ex={ex} extra={t('Applies to this exercise everywhere, not just this plan.')} />
|
||||
<Button variant="primary" onClick={close}>{t('Done')}</Button>
|
||||
</>
|
||||
}
|
||||
export const barWeightSheet = exId => ui().openSheet(close => <BarWeightSheet exId={exId} close={close} />)
|
||||
|
||||
/* ============================ exercise detail ============================ */
|
||||
// Estimated 1RM for one exercise (issue #18): what the log already implies, plus a calculator
|
||||
// for a set you have not done — so the number is reachable before there is any history.
|
||||
@@ -314,6 +353,10 @@ function ExerciseDetail({ ex, close }) {
|
||||
<Button icon="pencil" style={{ flex: 1 }} onClick={() => { close(); customExSheet(ex) }}>{t('Edit')}</Button>
|
||||
<Button variant="danger" icon="trash" style={{ flex: 1 }} onClick={() => deleteCustomEx(ex, close)}>{t('Delete')}</Button>
|
||||
</div>}
|
||||
{usesBar(ex) && <>
|
||||
<h4 className="sec">{t('Bar weight')}</h4>
|
||||
<BarWeightEditor ex={ex} extra={t('You still log the total weight — the bar only feeds the per-side plate math.')} />
|
||||
</>}
|
||||
{!isCardio(ex) && <OneRM ex={ex} />}
|
||||
{instrFor(ex).length > 0 &&<><h4 className="sec">{t('How to')}{!INSTR_LANGS.includes(getLang()) && <span className="dim" style={{ textTransform: 'none', letterSpacing: 0 }}> · {t('instructions in English')}</span>}</h4><ol className="steps-list">{instrFor(ex).map((s, i) => <li key={i}>{s}</li>)}</ol></>}
|
||||
</>
|
||||
@@ -763,6 +806,12 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
|
||||
: t('Every set becomes rest-pause: {0} reps to start, then {1} more split into short bursts, {2}s rest before each, roughly halving each time.', c.reps || 0, c.intensifier.totalReps, c.intensifier.restSec)}
|
||||
</div>}
|
||||
</>}
|
||||
{/* The bar's own weight, for the plate math — per exercise, not per plan, so it sits
|
||||
apart from the config fields above and writes straight to S.barWeights. */}
|
||||
{usesBar(ex) && <>
|
||||
<h4 className="sec">{t('Bar weight')}</h4>
|
||||
<BarWeightEditor ex={ex} extra={t('Applies to this exercise everywhere, not just this plan.')} />
|
||||
</>}
|
||||
<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')}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { exOr } from '../lib/exercises.js'
|
||||
import { usesBar, barWeightFor, plateSplit } from '../lib/bar.js'
|
||||
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, freestyleConfig, defaultConfig, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
|
||||
import { beep, vibrate } from '../lib/sound.js'
|
||||
@@ -10,7 +11,7 @@ import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { api } from '../lib/api.js'
|
||||
import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from '../lib/supersetFlow.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet } from '../sheets.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, barWeightSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button, Check, NumberField } from '../components/ui.jsx'
|
||||
import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'
|
||||
@@ -190,6 +191,23 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
</div>}
|
||||
{entry.note && <div className="exnote">{entry.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>}
|
||||
{/* Bar + plates for barbell work: what to load per side for the set in front of you
|
||||
(first undone set; the heaviest row once everything is checked). The logged number
|
||||
stays the total — this chip is the split, and tapping it edits the bar's own weight
|
||||
(S.barWeights, per exercise) mid-workout. Weight ≤ bar leaves just the bar. */}
|
||||
{!cardio && !(bw && !added) && usesBar(ex) && (() => {
|
||||
const bar = barWeightFor(S, entry.id)
|
||||
if (!(bar > 0)) return null
|
||||
const nextW = entry.sets.find(s => !s.done)?.w
|
||||
const refW = nextW > 0 ? nextW : Math.max(0, ...entry.sets.map(s => s.w || 0))
|
||||
const split = plateSplit(refW, bar)
|
||||
return <div style={{ marginBottom: 6 }}>
|
||||
<button className="chip nocap" style={{ display: 'inline-flex', alignItems: 'center', gap: 5 }} onClick={() => barWeightSheet(entry.id)}>
|
||||
<Icon name="dumbbell" style={{ fontSize: 12 }} />
|
||||
{t('Bar {0}', fmtNum(bar) + ' ' + S.unit)}{split != null ? ' · ' + t('{0} per side', fmtNum(split) + ' ' + S.unit) : ''}
|
||||
</button>
|
||||
</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'} />
|
||||
<span>{t(...plan.why)}</span>
|
||||
|
||||
Reference in new issue
Block a user