diff --git a/frontend/src/lib/bar.test.js b/frontend/src/lib/bar.test.js
new file mode 100644
index 0000000..e8a94e6
--- /dev/null
+++ b/frontend/src/lib/bar.test.js
@@ -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)
+ })
+})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index ce3f1d6..84f5f09 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -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', () => {
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 8a2d989..6dacb67 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -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.',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 3d2ff9e..a99fb65 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -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.',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index c3efe6d..22f22b5 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -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é.',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 0eced0b..289f7f5 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -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.': 'आप अब भी कुल वज़न ही दर्ज करते हैं — बार सिर्फ़ हर तरफ़ की प्लेट गिनती में काम आता है।',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 912aa05..13feac7 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -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.',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index bddfb99..8b48f16 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -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.': '기록은 여전히 총 무게입니다 — 바 무게는 한쪽에 끼울 원판 계산에만 쓰입니다.',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 7c5bb97..7b37062 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -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ę.',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 56ede45..81a853f 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -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 }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 44da335..6fc6c87 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -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.',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index f82d7a8..0789686 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -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.': 'Записывается по-прежнему общий вес — гриф нужен только для расчёта блинов на сторону.',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 2ea69c2..cedd563 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -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.',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 8576945..9fe484f 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -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.': '记录的仍是总重量——杆重只用于每侧杠铃片的计算。',
}
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 6ca69e0..6a38c10 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -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 =>