Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

feat(stats): Structural Balance — find your weakest lift against Poliquin/Thibaudeau/ATG ratios

Josevicc3aa9b0637c
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 9bc2ab4f4..22cd99b3d 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -33,6 +33,7 @@ import Stats from './views/Stats.jsx'
import History from './views/History.jsx'
import Library from './views/Library.jsx'
import Muscles from './views/Muscles.jsx'
+import StructuralBalance from './views/StructuralBalance.jsx'
import Settings from './views/Settings.jsx'
import Admin from './views/Admin.jsx'
import CoachChat from './views/CoachChat.jsx'
@@ -156,6 +157,7 @@ function Shell() {
<Route path="/history" element={<History />} />
<Route path="/library" element={<Library />} />
<Route path="/muscles" element={<Muscles />} />
+ <Route path="/structural-balance" element={<StructuralBalance />} />
<Route path="/settings" element={<Settings />} />
{/* The Coach screens gate themselves on the instance config; the routes exist
unconditionally so a deep link from a notification lands somewhere sane
diff --git a/frontend/src/components/TabBar.jsx b/frontend/src/components/TabBar.jsx
index d33c7a2a6..5569a6f05 100644
--- a/frontend/src/components/TabBar.jsx
+++ b/frontend/src/components/TabBar.jsx
@@ -13,7 +13,7 @@ export default function TabBar({ onStart }) {
const isGuest = useStore(s => s.isGuest())
if (!user && !isGuest) return null
const cur = loc.pathname.split('/')[1] || 'home'
- const on = k => cur === k || (cur === 'history' && k === 'stats') || (cur === 'settings' && k === 'home') || (cur === 'muscles' && k === 'library')
+ const on = k => cur === k || (cur === 'history' && k === 'stats') || (cur === 'settings' && k === 'home') || (cur === 'muscles' && k === 'library') || (cur === 'structural-balance' && k === 'stats')
const startWorkout = () => {
if (!S.active) {
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 680046ae9..fdc65905b 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -27,7 +27,7 @@ describe('Brazilian Portuguese locale', () => {
.sort(byCodeUnit)
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
- expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(679)
+ expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(713)
expect(inherited).toHaveLength(674)
// If this fails, review the changed keys and wording before accepting a new hash. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
diff --git a/frontend/src/lib/structuralBalance-view.js b/frontend/src/lib/structuralBalance-view.js
new file mode 100644
index 000000000..9404753a3
--- /dev/null
+++ b/frontend/src/lib/structuralBalance-view.js
@@ -0,0 +1,13 @@
+import { BALANCE_STATUSES } from './structuralBalanceTemplates.js'
+
+// Status -> UI label/severity (0 = best). Kept as a tiny boundary selector so the view and its
+// tests can't drift from the engine's status values, same rationale as fatigueStateOf() in
+// recovery-view.js.
+export function balanceStatusView(status) {
+ switch (status) {
+ case BALANCE_STATUSES.BALANCED: return { label: 'Balanced', severity: 0 }
+ case BALANCE_STATUSES.BORDERLINE: return { label: 'Borderline', severity: 1 }
+ case BALANCE_STATUSES.WEAK: return { label: 'Weak', severity: 2 }
+ default: return { label: 'No data', severity: 3 }
+ }
+}
diff --git a/frontend/src/lib/structuralBalance-view.test.js b/frontend/src/lib/structuralBalance-view.test.js
new file mode 100644
index 000000000..c56cfcf86
--- /dev/null
+++ b/frontend/src/lib/structuralBalance-view.test.js
@@ -0,0 +1,15 @@
+import { describe, expect, it } from 'vitest'
+import { balanceStatusView } from './structuralBalance-view.js'
+
+describe('balanceStatusView', () => {
+ it('maps every known status to a label and severity', () => {
+ expect(balanceStatusView('balanced')).toEqual({ label: 'Balanced', severity: 0 })
+ expect(balanceStatusView('borderline')).toEqual({ label: 'Borderline', severity: 1 })
+ expect(balanceStatusView('weak')).toEqual({ label: 'Weak', severity: 2 })
+ expect(balanceStatusView('no-data')).toEqual({ label: 'No data', severity: 3 })
+ })
+
+ it('falls back to no-data for an unknown status', () => {
+ expect(balanceStatusView('bogus')).toEqual({ label: 'No data', severity: 3 })
+ })
+})
diff --git a/frontend/src/lib/structuralBalance.js b/frontend/src/lib/structuralBalance.js
new file mode 100644
index 000000000..ab09806a3
--- /dev/null
+++ b/frontend/src/lib/structuralBalance.js
@@ -0,0 +1,171 @@
+import { estimate1RM } from './onerm.js'
+import { LB_TO_KG } from './recovery.js'
+import { isBw } from './history.js'
+import { isSideSet, isWarmupRow } from './workout-model.js'
+import { BALANCE_STATUSES, BORDERLINE_BAND_PCT, EVALUATION_MODES } from './structuralBalanceTemplates.js'
+
+const kgOf = (n, unit) => (unit === 'lb' ? Number(n) * LB_TO_KG : Number(n))
+
+// Mirrors the Stats.jsx `MuscleBalance` bodyweight read exactly (sort by date string, `.at(-1)`,
+// convert lb -> kg) rather than the unsorted-assuming `lastBW()` in history.js.
+export function bodyweightKgOf(S) {
+ const entries = S.bodyweight || []
+ if (!entries.length) return null
+ const last = entries.slice().sort((a, b) => String(a.d).localeCompare(String(b.d))).at(-1)
+ if (!last || !(last.w > 0)) return null
+ return kgOf(last.w, S.unit)
+}
+
+// What one completed set actually moved, in kg. On a bodyweight-configured entry `w` holds only
+// what was *added* (history.js: "`w` means *added* weight"), so the lifter's own mass has to be
+// added back: a chin-up with +10 kg is not a 10 kg lift, and Poliquin's dip/pull-up ratios are
+// against bodyweight + load. The weigh-in stamped on that session is the honest figure for an
+// old workout, with the profile's latest as the fallback; with neither, the set is left unscored
+// rather than scored against an invented body mass.
+function setLoadKg(S, workout, entry, set, bodyweightKg) {
+ const added = kgOf(set.w || 0, S.unit)
+ const bodyweight = entry.target?.bodyweight ?? entry.bodyweight
+ if (!isBw({ id: entry.id, bodyweight })) return added
+ const stamped = workout?.bw > 0 ? kgOf(workout.bw, S.unit) : null
+ const body = stamped ?? bodyweightKg
+ return body > 0 ? body + added : null
+}
+
+// Best estimated 1RM across a whitelist of exercise ids, in kg. Scans the log directly instead of
+// calling onerm.js's best1RM(), which reads `s.w` raw and so cannot see the body mass a dip or a
+// pull-up moves; the estimate itself still goes through the shared estimate1RM() so the formula,
+// its rounding and its rep cap stay in one place.
+export function resolveCurrent(S, exerciseIds, bodyweightKg) {
+ let best = null
+ for (const exId of exerciseIds) {
+ for (const workout of S.workouts || []) {
+ const entry = (workout.entries || []).find(e => e.id === exId)
+ if (!entry) continue
+ for (const set of entry.sets || []) {
+ if (!set.done || isWarmupRow(set)) continue
+ const loadKg = setLoadKg(S, workout, entry, set, bodyweightKg)
+ if (loadKg === null) continue
+ const estKg = estimate1RM(loadKg, set.r)
+ if (estKg === null) continue
+ if (!best || estKg > best.estKg) {
+ best = { estKg, w: Number(set.w) || 0, r: Math.round(Number(set.r)), d: workout.d, t: workout.start, exId }
+ }
+ }
+ }
+ }
+ return best
+}
+
+// Best completed-set rep count across a whitelist, ignoring load entirely. `best1RM()` requires
+// weight > 0 (a rep with no load isn't an estimate of anything), which makes it unusable for
+// rep-count roles that are meant to be scored at pure bodyweight (pull-ups, dips, Nordic curl —
+// no added-weight expected at all): a lifelong-bodyweight pull-up set would otherwise always
+// read as 'no-data'. This mirrors onerm.js's bestSetOf()'s done/warmup filtering but drops the
+// weight requirement, since reps — not an estimated 1RM — is the whole signal here.
+function bestRepsOf(entry) {
+ let best = null
+ for (const set of entry?.sets || []) {
+ if (!set.done || isWarmupRow(set)) continue
+ // A unilateral row's `r` is the both-sides total (workout-model.js), but a rep target like
+ // "10 pull-ups" is per limb, so the better side is what it should be read against.
+ const reps = Math.round(isSideSet(set)
+ ? Math.max(Number(set.sides.L?.r) || 0, Number(set.sides.R?.r) || 0)
+ : Number(set.r))
+ if (!isFinite(reps) || reps < 1) continue
+ if (!best || reps > best.r) best = { r: reps, w: Number(set.w) || 0 }
+ }
+ return best
+}
+
+export function resolveCurrentReps(S, exerciseIds) {
+ let best = null
+ for (const exId of exerciseIds) {
+ for (const workout of S.workouts || []) {
+ const entry = (workout.entries || []).find(e => e.id === exId)
+ const found = entry && bestRepsOf(entry)
+ if (found && (!best || found.r > best.r)) best = { ...found, d: workout.d, t: workout.start, exId }
+ }
+ }
+ return best
+}
+
+// Female target when the source table gives a distinct same-exercise figure, else the
+// male/default one.
+export function targetFor(role, S) {
+ const female = S.body === 'female'
+ if (role.evaluationMode === EVALUATION_MODES.REP_COUNT) {
+ return female && role.repsTargetFemale != null ? role.repsTargetFemale : role.repsTarget
+ }
+ return female && role.targetPctFemale != null ? role.targetPctFemale : role.targetPct
+}
+
+export function overrideKey(template, role) {
+ return `${template.id}:${role.id}`
+}
+
+// The exercise ids to resolve "current" from: the user's chosen override if one exists for this
+// role, otherwise the role's curated whitelist.
+export function exerciseIdsFor(S, template, role) {
+ const override = S.balanceOverrides?.[overrideKey(template, role)]
+ return override ? [override] : role.exerciseIds
+}
+
+// Actual percentage a role's current reading represents, given its evaluation mode. Returns
+// null when it can't be scored yet (anchor has no reading of its own, or bodyweight unknown).
+export function ratioFor(role, current, ctx) {
+ if (role.evaluationMode === EVALUATION_MODES.LOAD_RATIO) {
+ if (!ctx.anchorCurrent || !(ctx.anchorCurrent.estKg > 0)) return null
+ return (current.estKg / ctx.anchorCurrent.estKg) * 100
+ }
+ if (role.evaluationMode === EVALUATION_MODES.BODYWEIGHT_RATIO) {
+ if (!(ctx.bodyweightKg > 0)) return null
+ return (current.estKg / ctx.bodyweightKg) * 100
+ }
+ // rep-count: the best completed-set rep count (resolveCurrentReps), as a percentage of the
+ // target rep count.
+ return (current.r / ctx.targetPct) * 100
+}
+
+export function classify(actualPct, targetPct) {
+ if (actualPct === null || actualPct === undefined || !isFinite(actualPct)) return BALANCE_STATUSES.NO_DATA
+ if (actualPct >= targetPct) return BALANCE_STATUSES.BALANCED
+ if (actualPct >= targetPct - BORDERLINE_BAND_PCT) return BALANCE_STATUSES.BORDERLINE
+ return BALANCE_STATUSES.WEAK
+}
+
+function evaluateRole(template, role, currentByRoleId, bodyweightKg, S) {
+ const current = currentByRoleId.get(role.id)
+ // For load-ratio/bodyweight-ratio, `targetPct` is a percentage — the same scale classify()
+ // compares actualPct against. For rep-count it's a raw rep count (used as ratioFor()'s
+ // denominator), so classify() must compare against 100 instead — actualPct is already
+ // normalized to "% of the rep target" by the time it gets there.
+ const targetPct = targetFor(role, S)
+ const classifyTarget = role.evaluationMode === EVALUATION_MODES.REP_COUNT ? 100 : targetPct
+ const override = S.balanceOverrides?.[overrideKey(template, role)]
+ // Which exercise this role is set to, whether or not it has ever been logged — the view needs
+ // it to name the role's exercise (and to show an override back to the user who chose it).
+ const configuredExerciseId = override || role.exerciseIds[0] || null
+ const base = { roleId: role.id, configuredExerciseId, targetPct, isOverridden: Boolean(override) }
+ if (!current) {
+ return { ...base, mappedExerciseId: null, current: null, actualPct: null, status: BALANCE_STATUSES.NO_DATA }
+ }
+ // An anchor role (no anchorRoleId) is compared against itself — always 100% when it has data.
+ const anchorCurrent = role.anchorRoleId ? currentByRoleId.get(role.anchorRoleId) : current
+ const actualPct = ratioFor(role, current, { anchorCurrent, bodyweightKg, targetPct })
+ return { ...base, mappedExerciseId: current.exId, current, actualPct, status: classify(actualPct, classifyTarget) }
+}
+
+// Pure ratio-computation engine entry point.
+export function computeBalance(S, template) {
+ const bodyweightKg = bodyweightKgOf(S)
+ const currentByRoleId = new Map(
+ template.roles.map(role => {
+ const ids = exerciseIdsFor(S, template, role)
+ const current = role.evaluationMode === EVALUATION_MODES.REP_COUNT
+ ? resolveCurrentReps(S, ids)
+ : resolveCurrent(S, ids, bodyweightKg)
+ return [role.id, current]
+ })
+ )
+ return template.roles.map(role => evaluateRole(template, role, currentByRoleId, bodyweightKg, S))
+}
diff --git a/frontend/src/lib/structuralBalance.test.js b/frontend/src/lib/structuralBalance.test.js
new file mode 100644
index 000000000..45517ecc0
--- /dev/null
+++ b/frontend/src/lib/structuralBalance.test.js
@@ -0,0 +1,374 @@
+import { describe, expect, it } from 'vitest'
+import { computeBalance, classify, ratioFor, resolveCurrent, resolveCurrentReps, targetFor, overrideKey } from './structuralBalance.js'
+import { TEMPLATES, EVALUATION_MODES, BALANCE_STATUSES, BORDERLINE_BAND_PCT } from './structuralBalanceTemplates.js'
+
+const NOW = Date.parse('2026-01-15T00:00:00Z')
+
+const workoutAt = (id, start, sets) => ({
+ d: new Date(start).toISOString(),
+ start,
+ entries: [{ id, sets }],
+})
+const setDone = (w, r) => ({ done: true, w, r })
+
+const findRole = (template, roleId) => template.roles.find(r => r.id === roleId)
+
+describe('classify', () => {
+ it('is balanced at or above target, borderline within the band, weak further below, no-data otherwise', () => {
+ expect(classify(75, 75)).toBe(BALANCE_STATUSES.BALANCED)
+ expect(classify(80, 75)).toBe(BALANCE_STATUSES.BALANCED)
+ expect(classify(70, 75)).toBe(BALANCE_STATUSES.BORDERLINE) // exactly at the 5-point edge
+ expect(classify(69.9, 75)).toBe(BALANCE_STATUSES.WEAK)
+ expect(classify(50, 75)).toBe(BALANCE_STATUSES.WEAK)
+ expect(classify(null, 75)).toBe(BALANCE_STATUSES.NO_DATA)
+ expect(classify(NaN, 75)).toBe(BALANCE_STATUSES.NO_DATA)
+ })
+})
+
+describe('computeBalance — load-ratio mode (Thibaudeau powerlifting)', () => {
+ const template = TEMPLATES.thibaudeauPowerlifting
+
+ it('balanced/borderline/weak edges for a non-anchor role', () => {
+ const S = (benchW) => ({
+ unit: 'kg',
+ workouts: [
+ workoutAt('0043', NOW - 1000, [setDone(100, 1)]), // squat anchor: 100kg 1RM
+ workoutAt('0025', NOW, [setDone(benchW, 1)]),
+ ],
+ })
+ const bench = template.roles.find(r => r.id === 'bench') // targetPct 75
+
+ let results = computeBalance(S(75), template)
+ expect(results.find(r => r.roleId === 'bench').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'bench').actualPct).toBeCloseTo(75)
+
+ results = computeBalance(S(70), template) // exactly BORDERLINE_BAND_PCT under target
+ expect(results.find(r => r.roleId === 'bench').status).toBe(BALANCE_STATUSES.BORDERLINE)
+
+ results = computeBalance(S(69), template)
+ expect(results.find(r => r.roleId === 'bench').status).toBe(BALANCE_STATUSES.WEAK)
+ })
+
+ it('scores the anchor role itself at 100% whenever it has any data, and no-data when it has none', () => {
+ const withSquat = computeBalance({ unit: 'kg', workouts: [workoutAt('0043', NOW, [setDone(120, 1)])] }, template)
+ const squat = withSquat.find(r => r.roleId === 'squat')
+ expect(squat.actualPct).toBeCloseTo(100)
+ expect(squat.status).toBe(BALANCE_STATUSES.BALANCED)
+
+ const withoutSquat = computeBalance({ unit: 'kg', workouts: [] }, template)
+ expect(withoutSquat.find(r => r.roleId === 'squat').status).toBe(BALANCE_STATUSES.NO_DATA)
+ })
+
+ it('a non-anchor role is no-data when the anchor itself has no data, even if the role does', () => {
+ const S = { unit: 'kg', workouts: [workoutAt('0025', NOW, [setDone(80, 1)])] } // bench logged, squat never
+ const results = computeBalance(S, template)
+ expect(results.find(r => r.roleId === 'bench').status).toBe(BALANCE_STATUSES.NO_DATA)
+ expect(results.find(r => r.roleId === 'bench').actualPct).toBe(null)
+ })
+
+ it('no-data when the role itself was never logged', () => {
+ const S = { unit: 'kg', workouts: [workoutAt('0043', NOW, [setDone(100, 1)])] } // squat only
+ const results = computeBalance(S, template)
+ const bench = results.find(r => r.roleId === 'bench')
+ expect(bench.status).toBe(BALANCE_STATUSES.NO_DATA)
+ expect(bench.current).toBe(null)
+ })
+})
+
+describe('computeBalance — bodyweight-ratio mode (ATG)', () => {
+ const template = TEMPLATES.atg
+
+ const sWithBw = (bwKg, rdlW) => ({
+ unit: 'kg',
+ body: 'male',
+ bodyweight: [{ d: '2026-01-01', w: bwKg }],
+ workouts: [workoutAt('0085', NOW, [setDone(rdlW, 1)])],
+ })
+
+ it('balanced/borderline/weak edges against bodyweight (male target 100%)', () => {
+ let results = computeBalance(sWithBw(80, 80), template)
+ expect(results.find(r => r.roleId === 'romanianDeadlift').status).toBe(BALANCE_STATUSES.BALANCED)
+
+ results = computeBalance(sWithBw(80, 76), template) // 95% -> exactly borderline edge
+ expect(results.find(r => r.roleId === 'romanianDeadlift').status).toBe(BALANCE_STATUSES.BORDERLINE)
+
+ results = computeBalance(sWithBw(80, 75), template) // 93.75% -> weak
+ expect(results.find(r => r.roleId === 'romanianDeadlift').status).toBe(BALANCE_STATUSES.WEAK)
+ })
+
+ it('uses the female target when S.body is female', () => {
+ const S = { ...sWithBw(80, 64), body: 'female' } // 80% of 80kg = 64kg -> exactly female target (80%)
+ const results = computeBalance(S, template)
+ expect(results.find(r => r.roleId === 'romanianDeadlift').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'romanianDeadlift').targetPct).toBe(80)
+ })
+
+ it('no-data when bodyweight was never logged', () => {
+ const S = { unit: 'kg', workouts: [workoutAt('0085', NOW, [setDone(80, 1)])], bodyweight: [] }
+ const results = computeBalance(S, template)
+ expect(results.find(r => r.roleId === 'romanianDeadlift').status).toBe(BALANCE_STATUSES.NO_DATA)
+ })
+})
+
+describe('computeBalance — rep-count mode (ATG)', () => {
+ const template = TEMPLATES.atg
+
+ it('scores pure-bodyweight sets (w=0) correctly — the best1RM()-only bug this engine avoids', () => {
+ const S = { unit: 'kg', workouts: [workoutAt('0652', NOW, [setDone(0, 10)])] } // 10 strict pull-ups, no added weight
+ const results = computeBalance(S, template)
+ const pullups = results.find(r => r.roleId === 'pullups')
+ expect(pullups.status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(pullups.actualPct).toBeCloseTo(100)
+ })
+
+ it('uses the female rep target (1 rep) for pull-ups', () => {
+ const S = { unit: 'kg', body: 'female', workouts: [workoutAt('0652', NOW, [setDone(0, 1)])] }
+ const results = computeBalance(S, template)
+ expect(results.find(r => r.roleId === 'pullups').status).toBe(BALANCE_STATUSES.BALANCED)
+ })
+
+ it('no-data when the exercise was never logged (glute-ham raise / Nordic curl role)', () => {
+ const S = { unit: 'kg', workouts: [] }
+ const results = computeBalance(S, template)
+ const nordic = results.find(r => r.roleId === 'nordicCurl')
+ expect(nordic.status).toBe(BALANCE_STATUSES.NO_DATA)
+ expect(nordic.mappedExerciseId).toBe(null)
+ })
+
+ it('balanced/borderline/weak edges use a synthetic larger rep target, since real ATG targets (1/10) are too small for a clean 5-point band', () => {
+ const role = { id: 'synthetic', evaluationMode: EVALUATION_MODES.REP_COUNT, exerciseIds: ['0652'], repsTarget: 20 }
+ const template20 = { id: 'synthetic-template', roles: [role] }
+ const build = r => ({ unit: 'kg', workouts: [workoutAt('0652', NOW, [setDone(0, r)])] })
+
+ expect(computeBalance(build(20), template20)[0].status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(computeBalance(build(19), template20)[0].status).toBe(BALANCE_STATUSES.BORDERLINE) // 95%
+ expect(computeBalance(build(18), template20)[0].status).toBe(BALANCE_STATUSES.WEAK) // 90%
+ })
+})
+
+describe('resolveCurrent / resolveCurrentReps — best variant among a whitelist wins', () => {
+ it('load-ratio: picks the exercise id with the higher estimate, not the first-listed or most recent', () => {
+ const S = {
+ unit: 'kg',
+ workouts: [
+ workoutAt('0841', NOW - 1000, [setDone(20, 5)]), // weighted pull-up: higher est
+ workoutAt('0841', NOW, [setDone(10, 5)]), // weighted pull-up: lower est, more recent
+ ],
+ }
+ const current = resolveCurrent(S, ['0032', '0841'], null)
+ expect(current.exId).toBe('0841')
+ expect(current.w).toBe(20)
+ })
+
+ it('rep-count: picks the higher rep count among whitelisted ids', () => {
+ const S = {
+ unit: 'kg',
+ workouts: [
+ workoutAt('0652', NOW - 1000, [setDone(0, 8)]),
+ workoutAt('0841', NOW, [setDone(5, 6)]),
+ ],
+ }
+ const current = resolveCurrentReps(S, ['0652', '0841'])
+ expect(current.r).toBe(8)
+ expect(current.exId).toBe('0652')
+ })
+
+ it('returns null for an empty whitelist without throwing', () => {
+ expect(resolveCurrent({ unit: 'kg', workouts: [] }, [], null)).toBe(null)
+ expect(resolveCurrentReps({ unit: 'kg', workouts: [] }, [])).toBe(null)
+ })
+})
+
+// The bug this whole block exists for: `w` on a bodyweight exercise is what was *added* to the
+// lifter, so scoring a dip or a pull-up on `w` alone reported a +10 kg chin-up as a 10 kg lift —
+// which turned a lifter who is balanced on Poliquin's table into "weak" by 80 points.
+describe('bodyweight exercises count the lifter, not just the belt', () => {
+ const template = TEMPLATES.poliquin
+ const bwLifter = sets => ({
+ unit: 'kg',
+ bodyweight: [{ d: '2026-01-01', w: 80 }],
+ workouts: [{
+ d: '2026-01-10', start: NOW,
+ entries: [{ id: '0030', sets: [setDone(100, 1)] }, ...sets], // close-grip bench anchor at 100 kg
+ }],
+ })
+
+ it('adds bodyweight to the added load on a bodyweight entry', () => {
+ // +10 kg on an 80 kg lifter is a 90 kg pull-up — 90% of a 100 kg bench, over the 87% target.
+ const S = bwLifter([{ id: '0652', sets: [setDone(10, 1)] }])
+ const pullups = computeBalance(S, template).find(r => r.roleId === 'supinePullups')
+ expect(pullups.actualPct).toBeCloseTo(90)
+ expect(pullups.status).toBe(BALANCE_STATUSES.BALANCED)
+ })
+
+ it('scores an unloaded bodyweight set as the lifter’s own mass', () => {
+ const S = bwLifter([{ id: '0251', sets: [setDone(0, 1)] }])
+ const dips = computeBalance(S, template).find(r => r.roleId === 'dips')
+ expect(dips.actualPct).toBeCloseTo(80) // 80 kg of lifter against a 100 kg bench
+ expect(dips.status).toBe(BALANCE_STATUSES.WEAK) // target is 117%
+ })
+
+ it('prefers the weigh-in stamped on the session over the profile’s current bodyweight', () => {
+ const S = bwLifter([{ id: '0652', sets: [setDone(0, 1)] }])
+ S.workouts[0].bw = 70 // the lifter weighed 70 kg that day, not the 80 kg on file now
+ const pullups = computeBalance(S, template).find(r => r.roleId === 'supinePullups')
+ expect(pullups.actualPct).toBeCloseTo(70)
+ })
+
+ it('leaves a bodyweight entry unscored when no bodyweight is known, rather than inventing one', () => {
+ const S = { unit: 'kg', workouts: [{ d: '2026-01-10', start: NOW, entries: [
+ { id: '0030', sets: [setDone(100, 1)] },
+ { id: '0652', sets: [setDone(10, 1)] },
+ ] }] }
+ const pullups = computeBalance(S, template).find(r => r.roleId === 'supinePullups')
+ expect(pullups.status).toBe(BALANCE_STATUSES.NO_DATA)
+ })
+
+ it('honours the per-exercise bodyweight flag over the equipment default', () => {
+ // A barbell lift the user flagged as bodyweight (a dip machine logged under a barbell id, say)
+ // counts their mass; the flag turned off on a bodyweight exercise stops it counting.
+ const flagged = bwLifter([{ id: '0032', target: { bodyweight: true }, sets: [setDone(20, 1)] }])
+ const deadlift = computeBalance(flagged, template).find(r => r.roleId === 'deadlift')
+ expect(deadlift.current.estKg).toBeCloseTo(100) // 80 + 20, not 20
+
+ const unflagged = bwLifter([{ id: '0652', target: { bodyweight: false }, sets: [setDone(20, 1)] }])
+ const pullups = computeBalance(unflagged, template).find(r => r.roleId === 'supinePullups')
+ expect(pullups.current.estKg).toBeCloseTo(20)
+ })
+})
+
+describe('rep-count on a unilateral set', () => {
+ it('reads the better side, not the both-sides total', () => {
+ // workout-model.js keeps `r` as L.r + R.r on a per-side row; a "10 reps" target is per limb.
+ const S = { unit: 'kg', workouts: [workoutAt('0652', NOW, [
+ { done: true, w: 0, r: 12, sides: { L: { r: 5, done: true }, R: { r: 7, done: true } } },
+ ])] }
+ const current = resolveCurrentReps(S, ['0652'])
+ expect(current.r).toBe(7)
+ })
+})
+
+describe('unit consistency (lb profile)', () => {
+ it('bodyweight-ratio gives the same result in lb as in kg', () => {
+ const kgResult = computeBalance({
+ unit: 'kg', body: 'male',
+ bodyweight: [{ d: '2026-01-01', w: 80 }],
+ workouts: [workoutAt('0085', NOW, [setDone(80, 1)])],
+ }, TEMPLATES.atg).find(r => r.roleId === 'romanianDeadlift')
+
+ const lbResult = computeBalance({
+ unit: 'lb', body: 'male',
+ bodyweight: [{ d: '2026-01-01', w: 176.37 }], // ~80kg in lb
+ workouts: [workoutAt('0085', NOW, [setDone(176.37, 1)])],
+ }, TEMPLATES.atg).find(r => r.roleId === 'romanianDeadlift')
+
+ expect(lbResult.actualPct).toBeCloseTo(kgResult.actualPct, 0)
+ })
+})
+
+describe('exercise override', () => {
+ const template = TEMPLATES.atg
+ const nordicRole = findRole(template, 'nordicCurl')
+
+ it('reads from the overridden exercise instead of the curated whitelist, and flags isOverridden', () => {
+ const key = overrideKey(template, nordicRole)
+ const S = {
+ unit: 'kg',
+ balanceOverrides: { [key]: '0599' }, // a machine leg curl instead of the default glute-ham raise
+ workouts: [workoutAt('0599', NOW, [setDone(40, 1)])],
+ }
+ const results = computeBalance(S, template)
+ const nordic = results.find(r => r.roleId === 'nordicCurl')
+ expect(nordic.isOverridden).toBe(true)
+ expect(nordic.mappedExerciseId).toBe('0599')
+ })
+
+ it('is not overridden and uses the curated whitelist when no override is set', () => {
+ const results = computeBalance({ unit: 'kg', workouts: [] }, template)
+ expect(results.find(r => r.roleId === 'nordicCurl').isOverridden).toBe(false)
+ })
+
+ it('clearing the override reverts to the curated whitelist', () => {
+ const key = overrideKey(template, nordicRole)
+ const withOverride = { unit: 'kg', balanceOverrides: { [key]: '0599' }, workouts: [workoutAt('3193', NOW, [setDone(0, 1)])] }
+ const overridden = computeBalance(withOverride, template).find(r => r.roleId === 'nordicCurl')
+ expect(overridden.status).toBe(BALANCE_STATUSES.NO_DATA) // logged the default exercise, but override points elsewhere
+
+ const { balanceOverrides, ...withoutOverride } = withOverride
+ const reverted = computeBalance(withoutOverride, template).find(r => r.roleId === 'nordicCurl')
+ expect(reverted.isOverridden).toBe(false)
+ expect(reverted.status).toBe(BALANCE_STATUSES.BALANCED) // now reads the logged glute-ham raise set again
+ })
+})
+
+describe('computeBalance — full template end-to-end (Poliquin)', () => {
+ it('resolves every role in order, mixing logged and unlogged roles', () => {
+ const template = TEMPLATES.poliquin
+ const S = {
+ unit: 'kg',
+ bodyweight: [{ d: '2026-01-01', w: 80 }],
+ workouts: [
+ workoutAt('0030', NOW - 5000, [setDone(100, 1)]), // narrowBench anchor: 100kg
+ workoutAt('0047', NOW - 4000, [setDone(91, 1)]), // inclineBench: exactly 91% -> balanced
+ workoutAt('0251', NOW - 3000, [setDone(37, 1)]), // dips: 80kg lifter + 37 = 117% -> balanced
+ // supinePullups: deliberately never logged
+ workoutAt('0031', NOW - 2000, [setDone(30, 1)]), // barbellCurl: 30% -> weak (target 40)
+ workoutAt('1436', NOW - 1000, [setDone(150, 1)]), // highBarSquat anchor: 150kg
+ workoutAt('0042', NOW, [setDone(127.5, 1)]), // frontSquat: 85% -> balanced
+ ],
+ }
+ const results = computeBalance(S, template)
+
+ expect(results.map(r => r.roleId)).toEqual(template.roles.map(r => r.id))
+ expect(results.find(r => r.roleId === 'narrowBench').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'inclineBench').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'dips').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'supinePullups').status).toBe(BALANCE_STATUSES.NO_DATA)
+ expect(results.find(r => r.roleId === 'barbellCurl').status).toBe(BALANCE_STATUSES.WEAK)
+ expect(results.find(r => r.roleId === 'highBarSquat').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'frontSquat').status).toBe(BALANCE_STATUSES.BALANCED)
+ expect(results.find(r => r.roleId === 'deadlift').status).toBe(BALANCE_STATUSES.NO_DATA)
+ expect(results.find(r => r.roleId === 'powerClean').status).toBe(BALANCE_STATUSES.NO_DATA)
+ })
+
+ it('names the exercise a role is set to even when it has no data, so the view can show it', () => {
+ const template = TEMPLATES.poliquin
+ const deadlift = findRole(template, 'deadlift')
+ const S = { unit: 'kg', workouts: [], balanceOverrides: { [overrideKey(template, deadlift)]: '0085' } }
+ const results = computeBalance(S, template)
+
+ const unlogged = results.find(r => r.roleId === 'powerClean')
+ expect(unlogged.mappedExerciseId).toBe(null)
+ expect(unlogged.configuredExerciseId).toBe('0648') // the whitelist's first choice
+
+ const overridden = results.find(r => r.roleId === 'deadlift')
+ expect(overridden.configuredExerciseId).toBe('0085') // the exercise the user picked
+ expect(overridden.isOverridden).toBe(true)
+ })
+})
+
+describe('targetFor', () => {
+ it('falls back to the male/default figure when S.body is not female or no female figure exists', () => {
+ const role = findRole(TEMPLATES.atg, 'romanianDeadlift')
+ expect(targetFor(role, { body: 'male' })).toBe(100)
+ expect(targetFor(role, {})).toBe(100)
+ expect(targetFor(role, { body: 'female' })).toBe(80)
+ })
+
+ it('load-ratio roles have no female figure and are unaffected by S.body', () => {
+ const role = findRole(TEMPLATES.thibaudeauPowerlifting, 'bench')
+ expect(targetFor(role, { body: 'female' })).toBe(75)
+ })
+})
+
+describe('ratioFor', () => {
+ it('returns null for a load-ratio role when the anchor has no reading', () => {
+ const role = findRole(TEMPLATES.thibaudeauPowerlifting, 'bench')
+ expect(ratioFor(role, { estKg: 80 }, { anchorCurrent: null })).toBe(null)
+ })
+
+ it('returns null for a bodyweight-ratio role when bodyweight is unknown', () => {
+ const role = findRole(TEMPLATES.atg, 'romanianDeadlift')
+ expect(ratioFor(role, { estKg: 80 }, { bodyweightKg: null })).toBe(null)
+ })
+})
diff --git a/frontend/src/lib/structuralBalanceTemplates.js b/frontend/src/lib/structuralBalanceTemplates.js
new file mode 100644
index 000000000..6a3208257
--- /dev/null
+++ b/frontend/src/lib/structuralBalanceTemplates.js
@@ -0,0 +1,234 @@
+// Structural-balance ratio tables, sourced from
+// https://anticulturista.substack.com/p/30-equilibrio-estructural-tu-proximo (Poliquin /
+// Thibaudeau / ATG). Numbers are transcribed verbatim from the article. Each table is trimmed
+// to its compound/anchor lifts (see SPEC-structural-balance-core.md open question #1) — minor
+// isolation/shoulder-health accessories (Powell raise, trap raises, external rotation, french
+// press, scott curl) and Thibaudeau's general-strength/weightlifting sub-tables (different
+// anchor lifts) are out of scope.
+
+export const EVALUATION_MODES = Object.freeze({
+ LOAD_RATIO: 'load-ratio',
+ BODYWEIGHT_RATIO: 'bodyweight-ratio',
+ REP_COUNT: 'rep-count',
+})
+
+export const BALANCE_STATUSES = Object.freeze({
+ BALANCED: 'balanced',
+ BORDERLINE: 'borderline',
+ WEAK: 'weak',
+ NO_DATA: 'no-data',
+})
+
+// Percentage points below target that still count as 'borderline' rather than 'weak'.
+export const BORDERLINE_BAND_PCT = 5
+
+// Role shape:
+// id stable string, unique within its template
+// label i18n key (english source string)
+// evaluationMode 'load-ratio' | 'bodyweight-ratio' | 'rep-count'
+// exerciseIds curated whitelist, most-preferred variant first — resolveCurrent() picks the
+// user's best-data variant among these (overridable per-role via
+// S.balanceOverrides, see structuralBalance.js)
+// anchorRoleId load-ratio only: the role this one is compared against, within the same
+// template. The anchor role itself has no anchorRoleId and targetPct: 100.
+// targetPct load-ratio (% of anchor's 1RM) / bodyweight-ratio (% of bodyweight)
+// targetPctFemale bodyweight-ratio only, when the source gives a distinct female figure for
+// the same exercise — picked when S.body === 'female'
+// repsTarget rep-count only: target rep count at bodyweight
+// repsTargetFemale rep-count only, when the source gives a distinct female rep target
+
+export const TEMPLATES = {
+ poliquin: {
+ id: 'poliquin',
+ label: 'Poliquin',
+ roles: [
+ {
+ id: 'narrowBench',
+ label: 'Close-grip bench press (anchor)',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ exerciseIds: ['0030', '1719'], // barbell close-grip bench press, incline close-grip variant
+ targetPct: 100,
+ },
+ {
+ id: 'inclineBench',
+ label: 'Incline bench press',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'narrowBench',
+ exerciseIds: ['0047'], // barbell incline bench press
+ targetPct: 91,
+ },
+ {
+ id: 'dips',
+ label: 'Dips (bodyweight + load)',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'narrowBench',
+ exerciseIds: ['0251'], // chest dip
+ targetPct: 117,
+ },
+ {
+ id: 'supinePullups',
+ label: 'Supine pull-ups (bodyweight + load)',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'narrowBench',
+ exerciseIds: ['0652', '0841'], // pull-up, weighted pull-up
+ targetPct: 87,
+ },
+ {
+ id: 'barbellCurl',
+ label: 'Standing barbell curl',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'narrowBench',
+ exerciseIds: ['0031'], // barbell curl
+ targetPct: 40,
+ },
+ {
+ id: 'highBarSquat',
+ label: 'High-bar back squat (anchor)',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ exerciseIds: ['1436', '0043'], // barbell high bar squat, fallback to full squat
+ targetPct: 100,
+ },
+ {
+ id: 'frontSquat',
+ label: 'Front squat',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'highBarSquat',
+ exerciseIds: ['0042'],
+ targetPct: 85,
+ },
+ {
+ id: 'deadlift',
+ label: 'Deadlift',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'highBarSquat',
+ exerciseIds: ['0032'],
+ targetPct: 125,
+ },
+ {
+ id: 'powerClean',
+ label: 'Power clean',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'highBarSquat',
+ exerciseIds: ['0648'],
+ targetPct: 61,
+ },
+ ],
+ },
+
+ thibaudeauPowerlifting: {
+ id: 'thibaudeauPowerlifting',
+ label: 'Thibaudeau — Powerlifting',
+ roles: [
+ {
+ id: 'squat',
+ label: 'Squat (anchor)',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ exerciseIds: ['0043', '1436'],
+ targetPct: 100,
+ },
+ {
+ id: 'bench',
+ label: 'Bench press',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'squat',
+ exerciseIds: ['0025'],
+ targetPct: 75,
+ },
+ {
+ id: 'deadlift',
+ label: 'Deadlift',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'squat',
+ exerciseIds: ['0032'],
+ targetPct: 120,
+ },
+ {
+ id: 'militaryPress',
+ label: 'Military press',
+ evaluationMode: EVALUATION_MODES.LOAD_RATIO,
+ anchorRoleId: 'squat',
+ exerciseIds: ['0091', '1456', '1457', '0086'],
+ targetPct: 45,
+ },
+ ],
+ },
+
+ atg: {
+ id: 'atg',
+ label: 'ATG',
+ roles: [
+ {
+ id: 'romanianDeadlift',
+ label: 'Romanian deadlift (12 reps)',
+ evaluationMode: EVALUATION_MODES.BODYWEIGHT_RATIO,
+ exerciseIds: ['0085'],
+ targetPct: 100,
+ targetPctFemale: 80,
+ },
+ {
+ id: 'goodMorning',
+ label: 'Seated good morning (10 reps)',
+ evaluationMode: EVALUATION_MODES.BODYWEIGHT_RATIO,
+ exerciseIds: ['0090'],
+ targetPct: 66,
+ targetPctFemale: 40,
+ },
+ {
+ id: 'stepUp',
+ label: 'Poliquin step-up (15 reps)',
+ evaluationMode: EVALUATION_MODES.BODYWEIGHT_RATIO,
+ exerciseIds: ['0114', '0431'],
+ targetPct: 50,
+ targetPctFemale: 40,
+ },
+ {
+ id: 'nordicCurl',
+ label: 'Nordic curl (1 rep)',
+ evaluationMode: EVALUATION_MODES.REP_COUNT,
+ // No exercise literally named "Nordic curl" exists in EXDB. Glute-ham raise is the
+ // closest mechanical relative (eccentric knee flexion, foot anchored) — an
+ // approximation, not the same exercise. The 1-rep target is the Nordic curl's own,
+ // not recalibrated for the substitute. Users can override this via the exercise
+ // picker (see structuralBalance.js's exerciseIdsFor) if they'd rather map it elsewhere.
+ exerciseIds: ['3193'], // glute-ham raise
+ repsTarget: 1,
+ },
+ {
+ id: 'pullups',
+ label: 'Pull-ups (10 reps, bodyweight)',
+ evaluationMode: EVALUATION_MODES.REP_COUNT,
+ exerciseIds: ['0652'],
+ repsTarget: 10,
+ repsTargetFemale: 1,
+ },
+ {
+ id: 'atgDips',
+ label: 'Dips (10 reps, bodyweight)',
+ evaluationMode: EVALUATION_MODES.REP_COUNT,
+ exerciseIds: ['0251'],
+ repsTarget: 10,
+ },
+ {
+ id: 'inclineDbPress',
+ // MVP simplification: source specifies 40%/20% bodyweight AND x8 reps; only the load
+ // percentage is scored (see plan §5 fidelity trade-off).
+ label: 'Incline DB press (each hand, 8 reps)',
+ evaluationMode: EVALUATION_MODES.BODYWEIGHT_RATIO,
+ exerciseIds: ['0314', '3545'],
+ targetPct: 40,
+ targetPctFemale: 20,
+ },
+ {
+ id: 'dbShoulderPress',
+ label: 'DB shoulder press (each hand, 8 reps)',
+ evaluationMode: EVALUATION_MODES.BODYWEIGHT_RATIO,
+ exerciseIds: ['0405', '0404', '0361', '0360'],
+ targetPct: 33,
+ targetPctFemale: 15,
+ },
+ ],
+ },
+}
+
+export const TEMPLATE_LIST = Object.values(TEMPLATES)
+export const DEFAULT_TEMPLATE_ID = 'poliquin'
diff --git a/frontend/src/lib/sync-merge.js b/frontend/src/lib/sync-merge.js
index 1e4b1704f..f8e55c176 100644
--- a/frontend/src/lib/sync-merge.js
+++ b/frontend/src/lib/sync-merge.js
@@ -16,7 +16,7 @@
* - favEx: ordered set union, the newer copy first
* - exWeights: union by exercise, the better `w` for that exercise — larger for an ordinary
* lift, smaller on an assistance machine (a PR logged on the other device must not be
- * forgotten, whichever way it runs); exNotes, barWeights: key union
+ * forgotten, whichever way it runs); exNotes, barWeights, balanceOverrides: key union
* - `_ts`: the later of the two; `_rev` dropped (the server sets it); `active` left to the caller
*
* Known limit: with no record of what each side deleted, an entry removed on one device inside
@@ -104,7 +104,7 @@ export function mergeStates(a, b, { prefer } = {}) {
out.bodyweight = mergeBodyweight(n.bodyweight, o.bodyweight).map(clone)
if (list(n.favEx).length || list(o.favEx).length) out.favEx = [...new Set([...list(n.favEx), ...list(o.favEx)])]
out.exWeights = clone(mergeExWeights(n.exWeights, o.exWeights))
- for (const f of ['exNotes', 'barWeights']) {
+ for (const f of ['exNotes', 'barWeights', 'balanceOverrides']) {
if (n[f] || o[f]) out[f] = clone({ ...(o[f] || {}), ...(n[f] || {}) })
}
out._ts = Math.max(a._ts || 0, b._ts || 0)
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index d736fc60a..5a161d084 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1320,4 +1320,39 @@ export default {
'Plan: {0}': 'Plan: {0}',
'today {0}': 'heute {0}',
'reps from your last session': 'Wdh. aus deiner letzten Einheit',
+ // --- structural balance ---
+ 'Structural Balance': 'Strukturelle Balance',
+ 'See which lift is holding back the rest.': 'Sieh, welche Übung den Rest ausbremst.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Vergleiche deine Übungen mit einer veröffentlichten Verhältnistabelle, um das schwache Glied zu finden.',
+ 'Open': 'Öffnen',
+ 'Balanced': 'Ausgeglichen',
+ 'Borderline': 'Grenzwertig',
+ 'Weak': 'Schwach',
+ 'No data': 'Keine Daten',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Powerlifting',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Enges Bankdrücken (Anker)',
+ 'Incline bench press': 'Schrägbankdrücken',
+ 'Dips (bodyweight + load)': 'Dips (Körpergewicht + Zusatzgewicht)',
+ 'Supine pull-ups (bodyweight + load)': 'Klimmzüge im Untergriff (Körpergewicht + Zusatzgewicht)',
+ 'Standing barbell curl': 'Bizepscurls mit der Langhantel im Stehen',
+ 'High-bar back squat (anchor)': 'High-Bar-Kniebeuge (Anker)',
+ 'Front squat': 'Frontkniebeuge',
+ 'Deadlift': 'Kreuzheben',
+ 'Power clean': 'Power Clean',
+ 'Squat (anchor)': 'Kniebeuge (Anker)',
+ 'Bench press': 'Bankdrücken',
+ 'Military press': 'Schulterdrücken (Military Press)',
+ 'Romanian deadlift (12 reps)': 'Rumänisches Kreuzheben (12 Wdh.)',
+ 'Seated good morning (10 reps)': 'Good Morning im Sitzen (10 Wdh.)',
+ 'Poliquin step-up (15 reps)': 'Poliquin-Step-up (15 Wdh.)',
+ 'Nordic curl (1 rep)': 'Nordic Curl (1 Wdh.)',
+ 'Pull-ups (10 reps, bodyweight)': 'Klimmzüge (10 Wdh., Körpergewicht)',
+ 'Dips (10 reps, bodyweight)': 'Dips (10 Wdh., Körpergewicht)',
+ 'Incline DB press (each hand, 8 reps)': 'Kurzhantel-Schrägbankdrücken (je Hand, 8 Wdh.)',
+ 'DB shoulder press (each hand, 8 reps)': 'Kurzhantel-Schulterdrücken (je Hand, 8 Wdh.)',
+ 'Change exercise': 'Übung ändern',
+ 'Use default exercise': 'Standardübung verwenden',
+ 'Custom': 'Angepasst',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 5764277a7..d3282c5b9 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'Plan: {0}',
'today {0}': 'hoy {0}',
'reps from your last session': 'reps de tu última sesión',
+ // --- structural balance ---
+ 'Structural Balance': 'Balance estructural',
+ 'See which lift is holding back the rest.': 'Descubre qué ejercicio está frenando al resto.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Compara tus levantamientos con una tabla de ratios publicada para encontrar el eslabón débil.',
+ 'Open': 'Abrir',
+ 'Balanced': 'Equilibrado',
+ 'Borderline': 'Al límite',
+ 'Weak': 'Débil',
+ 'No data': 'Sin datos',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Powerlifting',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Press banca agarre cerrado (ancla)',
+ 'Incline bench press': 'Press inclinado',
+ 'Dips (bodyweight + load)': 'Fondos (peso corporal + carga)',
+ 'Supine pull-ups (bodyweight + load)': 'Dominadas supinas (peso corporal + carga)',
+ 'Standing barbell curl': 'Curl con barra de pie',
+ 'High-bar back squat (anchor)': 'Sentadilla alta (ancla)',
+ 'Front squat': 'Sentadilla frontal',
+ 'Deadlift': 'Peso muerto',
+ 'Power clean': 'Cargada de potencia',
+ 'Squat (anchor)': 'Sentadilla (ancla)',
+ 'Bench press': 'Press de banca',
+ 'Military press': 'Press militar',
+ 'Romanian deadlift (12 reps)': 'Peso muerto rumano (12 reps)',
+ 'Seated good morning (10 reps)': 'Buenos días sentado (10 reps)',
+ 'Poliquin step-up (15 reps)': 'Step-up Poliquin (15 reps)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 rep)',
+ 'Pull-ups (10 reps, bodyweight)': 'Dominadas (10 reps, peso corporal)',
+ 'Dips (10 reps, bodyweight)': 'Fondos (10 reps, peso corporal)',
+ 'Incline DB press (each hand, 8 reps)': 'Press inclinado con mancuerna (cada mano, 8 reps)',
+ 'DB shoulder press (each hand, 8 reps)': 'Press de hombro con mancuerna (cada mano, 8 reps)',
+ 'Change exercise': 'Cambiar ejercicio',
+ 'Use default exercise': 'Usar ejercicio por defecto',
+ 'Custom': 'Personalizado',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 277c4dbc0..60b3a2cfb 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'Plan : {0}',
'today {0}': 'aujourd’hui {0}',
'reps from your last session': 'reps de ta dernière séance',
+ // --- structural balance ---
+ 'Structural Balance': 'Équilibre structurel',
+ 'See which lift is holding back the rest.': 'Découvrez quel mouvement freine les autres.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Comparez vos mouvements à un tableau de ratios publié pour trouver le maillon faible.',
+ 'Open': 'Ouvrir',
+ 'Balanced': 'Équilibré',
+ 'Borderline': 'Limite',
+ 'Weak': 'Faible',
+ 'No data': 'Aucune donnée',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Force athlétique',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Développé couché prise serrée (référence)',
+ 'Incline bench press': 'Développé incliné',
+ 'Dips (bodyweight + load)': 'Dips (poids du corps + charge)',
+ 'Supine pull-ups (bodyweight + load)': 'Tractions en supination (poids du corps + charge)',
+ 'Standing barbell curl': 'Curl barre debout',
+ 'High-bar back squat (anchor)': 'Squat barre haute (référence)',
+ 'Front squat': 'Squat avant',
+ 'Deadlift': 'Soulevé de terre',
+ 'Power clean': 'Épaulé-jeté (power clean)',
+ 'Squat (anchor)': 'Squat (référence)',
+ 'Bench press': 'Développé couché',
+ 'Military press': 'Développé militaire',
+ 'Romanian deadlift (12 reps)': 'Soulevé de terre roumain (12 reps)',
+ 'Seated good morning (10 reps)': 'Good morning assis (10 reps)',
+ 'Poliquin step-up (15 reps)': 'Step-up Poliquin (15 reps)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 rep)',
+ 'Pull-ups (10 reps, bodyweight)': 'Tractions (10 reps, poids du corps)',
+ 'Dips (10 reps, bodyweight)': 'Dips (10 reps, poids du corps)',
+ 'Incline DB press (each hand, 8 reps)': 'Développé incliné haltères (chaque main, 8 reps)',
+ 'DB shoulder press (each hand, 8 reps)': 'Développé épaules haltères (chaque main, 8 reps)',
+ 'Change exercise': 'Changer d\'exercice',
+ 'Use default exercise': 'Utiliser l\'exercice par défaut',
+ 'Custom': 'Personnalisé',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 303289210..ef9cae5b8 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'प्लान: {0}',
'today {0}': 'आज {0}',
'reps from your last session': 'रेप्स आपके पिछले सेशन से',
+ // --- structural balance ---
+ 'Structural Balance': 'संरचनात्मक संतुलन',
+ 'See which lift is holding back the rest.': 'देखें कौन-सी लिफ्ट बाकी को पीछे खींच रही है।',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'प्रकाशित अनुपात तालिका के आधार पर अपनी लिफ्ट्स की तुलना करें और कमज़ोर कड़ी पहचानें।',
+ 'Open': 'खोलें',
+ 'Balanced': 'संतुलित',
+ 'Borderline': 'सीमारेखा पर',
+ 'Weak': 'कमज़ोर',
+ 'No data': 'कोई डेटा नहीं',
+ 'Poliquin': 'पोलिक्विन',
+ 'Thibaudeau — Powerlifting': 'थिबोदो — पावरलिफ्टिंग',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'क्लोज़-ग्रिप बेंच प्रेस (आधार)',
+ 'Incline bench press': 'इनक्लाइन बेंच प्रेस',
+ 'Dips (bodyweight + load)': 'डिप्स (शरीर का वज़न + भार)',
+ 'Supine pull-ups (bodyweight + load)': 'सुपाइन पुल-अप्स (शरीर का वज़न + भार)',
+ 'Standing barbell curl': 'स्टैंडिंग बारबेल कर्ल',
+ 'High-bar back squat (anchor)': 'हाई-बार बैक स्क्वाट (आधार)',
+ 'Front squat': 'फ्रंट स्क्वाट',
+ 'Deadlift': 'डेडलिफ्ट',
+ 'Power clean': 'पावर क्लीन',
+ 'Squat (anchor)': 'स्क्वाट (आधार)',
+ 'Bench press': 'बेंच प्रेस',
+ 'Military press': 'मिलिट्री प्रेस',
+ 'Romanian deadlift (12 reps)': 'रोमानियन डेडलिफ्ट (12 प्रतिनिधि)',
+ 'Seated good morning (10 reps)': 'बैठकर गुड मॉर्निंग (10 प्रतिनिधि)',
+ 'Poliquin step-up (15 reps)': 'पोलिक्विन स्टेप-अप (15 प्रतिनिधि)',
+ 'Nordic curl (1 rep)': 'नॉर्डिक कर्ल (1 प्रतिनिधि)',
+ 'Pull-ups (10 reps, bodyweight)': 'पुल-अप्स (10 प्रतिनिधि, शरीर का वज़न)',
+ 'Dips (10 reps, bodyweight)': 'डिप्स (10 प्रतिनिधि, शरीर का वज़न)',
+ 'Incline DB press (each hand, 8 reps)': 'इनक्लाइन डम्बल प्रेस (प्रत्येक हाथ, 8 प्रतिनिधि)',
+ 'DB shoulder press (each hand, 8 reps)': 'डम्बल शोल्डर प्रेस (प्रत्येक हाथ, 8 प्रतिनिधि)',
+ 'Change exercise': 'व्यायाम बदलें',
+ 'Use default exercise': 'डिफ़ॉल्ट व्यायाम उपयोग करें',
+ 'Custom': 'कस्टम',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 28c1a24a8..13ac40173 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1303,4 +1303,39 @@ export default {
'Plan: {0}': 'Terv: {0}',
'today {0}': 'ma {0}',
'reps from your last session': 'ismétlések az utolsó edzésedből',
+ // --- structural balance ---
+ 'Structural Balance': 'Strukturális egyensúly',
+ 'See which lift is holding back the rest.': 'Nézd meg, melyik gyakorlat fogja vissza a többit.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Hasonlítsd össze gyakorlataidat egy közzétett arány-táblázattal, hogy megtaláld a leggyengébb láncszemet.',
+ 'Open': 'Megnyitás',
+ 'Balanced': 'Kiegyensúlyozott',
+ 'Borderline': 'Határeset',
+ 'Weak': 'Gyenge',
+ 'No data': 'Nincs adat',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Erőemelés',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Szűk fogású fekvenyomás (viszonyítási alap)',
+ 'Incline bench press': 'Ferde fekvenyomás',
+ 'Dips (bodyweight + load)': 'Tolódzkodás (testsúly + plusz súly)',
+ 'Supine pull-ups (bodyweight + load)': 'Húzódzkodás alsó fogással (testsúly + plusz súly)',
+ 'Standing barbell curl': 'Álló rúdas bicepszhajlítás',
+ 'High-bar back squat (anchor)': 'Magas fogású guggolás (viszonyítási alap)',
+ 'Front squat': 'Elülső guggolás',
+ 'Deadlift': 'Felhúzás (deadlift)',
+ 'Power clean': 'Power clean (felkapás lendítéssel)',
+ 'Squat (anchor)': 'Guggolás (viszonyítási alap)',
+ 'Bench press': 'Fekvenyomás',
+ 'Military press': 'Katonai nyomás (military press)',
+ 'Romanian deadlift (12 reps)': 'Román felhúzás (12 ismétlés)',
+ 'Seated good morning (10 reps)': 'Ülő jó reggelt (good morning, 10 ismétlés)',
+ 'Poliquin step-up (15 reps)': 'Poliquin fellépés (15 ismétlés)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 ismétlés)',
+ 'Pull-ups (10 reps, bodyweight)': 'Húzódzkodás (10 ismétlés, testsúllyal)',
+ 'Dips (10 reps, bodyweight)': 'Tolódzkodás (10 ismétlés, testsúllyal)',
+ 'Incline DB press (each hand, 8 reps)': 'Ferde fekvenyomás kézisúlyzóval (kezenként, 8 ismétlés)',
+ 'DB shoulder press (each hand, 8 reps)': 'Kézisúlyzós vállból nyomás (kezenként, 8 ismétlés)',
+ 'Change exercise': 'Gyakorlat módosítása',
+ 'Use default exercise': 'Alapértelmezett gyakorlat használata',
+ 'Custom': 'Egyéni',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 65fbe048b..09038bf36 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'Piano: {0}',
'today {0}': 'oggi {0}',
'reps from your last session': 'rip. dalla tua ultima sessione',
+ // --- structural balance ---
+ 'Structural Balance': 'Equilibrio strutturale',
+ 'See which lift is holding back the rest.': 'Scopri quale esercizio frena gli altri.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Confronta i tuoi sollevamenti con una tabella di rapporti pubblicata per trovare l\'anello debole.',
+ 'Open': 'Apri',
+ 'Balanced': 'Bilanciato',
+ 'Borderline': 'Al limite',
+ 'Weak': 'Debole',
+ 'No data': 'Nessun dato',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Powerlifting',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Panca presa stretta (riferimento)',
+ 'Incline bench press': 'Panca inclinata',
+ 'Dips (bodyweight + load)': 'Dip alle parallele (corpo libero + sovraccarico)',
+ 'Supine pull-ups (bodyweight + load)': 'Trazioni presa supina (corpo libero + sovraccarico)',
+ 'Standing barbell curl': 'Curl con bilanciere in piedi',
+ 'High-bar back squat (anchor)': 'Squat bilanciere alto (riferimento)',
+ 'Front squat': 'Front squat',
+ 'Deadlift': 'Stacco da terra',
+ 'Power clean': 'Power clean (girata di potenza)',
+ 'Squat (anchor)': 'Squat (riferimento)',
+ 'Bench press': 'Panca piana',
+ 'Military press': 'Military press (lento avanti)',
+ 'Romanian deadlift (12 reps)': 'Stacco rumeno (12 rip.)',
+ 'Seated good morning (10 reps)': 'Good morning da seduto (10 rip.)',
+ 'Poliquin step-up (15 reps)': 'Step-up Poliquin (15 rip.)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 rip.)',
+ 'Pull-ups (10 reps, bodyweight)': 'Trazioni (10 rip., corpo libero)',
+ 'Dips (10 reps, bodyweight)': 'Dip (10 rip., corpo libero)',
+ 'Incline DB press (each hand, 8 reps)': 'Panca inclinata con manubri (per mano, 8 rip.)',
+ 'DB shoulder press (each hand, 8 reps)': 'Military press con manubri (per mano, 8 rip.)',
+ 'Change exercise': 'Cambia esercizio',
+ 'Use default exercise': 'Usa esercizio predefinito',
+ 'Custom': 'Personalizzato',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 9018a95d3..186cdd83b 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': '계획: {0}',
'today {0}': '오늘 {0}',
'reps from your last session': '지난 세션의 횟수',
+ // --- structural balance ---
+ 'Structural Balance': '구조적 밸런스',
+ 'See which lift is holding back the rest.': '어떤 운동이 나머지를 방해하는지 확인하세요.',
+ 'Compare your lifts against a published ratio table to find the weak link.': '공개된 비율 표와 운동 기록을 비교해 약점을 찾아보세요.',
+ 'Open': '열기',
+ 'Balanced': '균형',
+ 'Borderline': '경계선',
+ 'Weak': '약함',
+ 'No data': '데이터 없음',
+ 'Poliquin': '폴리퀸',
+ 'Thibaudeau — Powerlifting': '티보도 — 파워리프팅',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': '클로즈그립 벤치프레스 (기준)',
+ 'Incline bench press': '인클라인 벤치프레스',
+ 'Dips (bodyweight + load)': '딥스 (체중 + 중량)',
+ 'Supine pull-ups (bodyweight + load)': '언더핸드 풀업 (체중 + 중량)',
+ 'Standing barbell curl': '스탠딩 바벨 컬',
+ 'High-bar back squat (anchor)': '하이바 백스쿼트 (기준)',
+ 'Front squat': '프론트 스쿼트',
+ 'Deadlift': '데드리프트',
+ 'Power clean': '파워클린',
+ 'Squat (anchor)': '스쿼트 (기준)',
+ 'Bench press': '벤치프레스',
+ 'Military press': '밀리터리프레스',
+ 'Romanian deadlift (12 reps)': '루마니안 데드리프트 (12회)',
+ 'Seated good morning (10 reps)': '시티드 굿모닝 (10회)',
+ 'Poliquin step-up (15 reps)': '폴리퀸 스텝업 (15회)',
+ 'Nordic curl (1 rep)': '노르딕컬 (1회)',
+ 'Pull-ups (10 reps, bodyweight)': '풀업 (10회, 맨몸)',
+ 'Dips (10 reps, bodyweight)': '딥스 (10회, 맨몸)',
+ 'Incline DB press (each hand, 8 reps)': '인클라인 덤벨프레스 (한 손당 8회)',
+ 'DB shoulder press (each hand, 8 reps)': '덤벨숄더프레스 (한 손당 8회)',
+ 'Change exercise': '운동 변경',
+ 'Use default exercise': '기본 운동 사용',
+ 'Custom': '사용자 지정',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 668ec24b2..a8da8c436 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'Plan: {0}',
'today {0}': 'dziś {0}',
'reps from your last session': 'powt. z ostatniej sesji',
+ // --- structural balance ---
+ 'Structural Balance': 'Balans strukturalny',
+ 'See which lift is holding back the rest.': 'Sprawdź, które ćwiczenie hamuje resztę.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Porównaj swoje wyniki z opublikowaną tabelą proporcji, aby znaleźć najsłabsze ogniwo.',
+ 'Open': 'Otwórz',
+ 'Balanced': 'Zrównoważony',
+ 'Borderline': 'Na granicy',
+ 'Weak': 'Słaby',
+ 'No data': 'Brak danych',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Trójbój siłowy',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Wyciskanie wąskim chwytem (punkt odniesienia)',
+ 'Incline bench press': 'Wyciskanie na ławce skośnej',
+ 'Dips (bodyweight + load)': 'Dipy (masa ciała + obciążenie)',
+ 'Supine pull-ups (bodyweight + load)': 'Podciąganie podchwytem (masa ciała + obciążenie)',
+ 'Standing barbell curl': 'Uginanie ramion ze sztangą w staniu',
+ 'High-bar back squat (anchor)': 'Przysiad wysoki (punkt odniesienia)',
+ 'Front squat': 'Przysiad przedni',
+ 'Deadlift': 'Martwy ciąg',
+ 'Power clean': 'Rwanie mocy (power clean)',
+ 'Squat (anchor)': 'Przysiad (punkt odniesienia)',
+ 'Bench press': 'Wyciskanie na ławce',
+ 'Military press': 'Wyciskanie żołnierskie',
+ 'Romanian deadlift (12 reps)': 'Martwy ciąg rumuński (12 powtórzeń)',
+ 'Seated good morning (10 reps)': 'Good morning w siadzie (10 powtórzeń)',
+ 'Poliquin step-up (15 reps)': 'Wejścia Poliquina (15 powtórzeń)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 powtórzenie)',
+ 'Pull-ups (10 reps, bodyweight)': 'Podciąganie (10 powtórzeń, masa ciała)',
+ 'Dips (10 reps, bodyweight)': 'Dipy (10 powtórzeń, masa ciała)',
+ 'Incline DB press (each hand, 8 reps)': 'Wyciskanie hantli na ławce skośnej (na rękę, 8 powtórzeń)',
+ 'DB shoulder press (each hand, 8 reps)': 'Wyciskanie hantli nad głowę (na rękę, 8 powtórzeń)',
+ 'Change exercise': 'Zmień ćwiczenie',
+ 'Use default exercise': 'Użyj domyślnego ćwiczenia',
+ 'Custom': 'Niestandardowe',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 54b70d992..3aaa6c64e 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -709,6 +709,41 @@ export const PT_BR_OVERRIDES = {
'First time in this routine — starting from its own target.': 'Primeira vez nesta rotina — você começa pela meta dela.',
'No weight logged last time — enter what you lift and progression takes it from there.': 'Nenhum peso registrado na última vez — informe quanto você levanta e a progressão segue a partir daí.',
'reps from your last session': 'reps da sua última sessão',
+ // --- structural balance ---
+ 'Structural Balance': 'Balanço estrutural',
+ 'See which lift is holding back the rest.': 'Veja qual exercício está segurando os outros.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Compare seus levantamentos com uma tabela de proporções publicada para encontrar o elo fraco.',
+ 'Open': 'Abrir',
+ 'Balanced': 'Equilibrado',
+ 'Borderline': 'No limite',
+ 'Weak': 'Fraco',
+ 'No data': 'Sem dados',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Powerlifting',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Supino pegada fechada (referência)',
+ 'Incline bench press': 'Supino inclinado',
+ 'Dips (bodyweight + load)': 'Paralelas (peso corporal + carga)',
+ 'Supine pull-ups (bodyweight + load)': 'Barra supinada (peso corporal + carga)',
+ 'Standing barbell curl': 'Rosca direta com barra em pé',
+ 'High-bar back squat (anchor)': 'Agachamento barra alta (referência)',
+ 'Front squat': 'Agachamento frontal',
+ 'Deadlift': 'Levantamento terra',
+ 'Power clean': 'Power clean (arranque de potência)',
+ 'Squat (anchor)': 'Agachamento (referência)',
+ 'Bench press': 'Supino reto',
+ 'Military press': 'Desenvolvimento militar',
+ 'Romanian deadlift (12 reps)': 'Levantamento terra romeno (12 reps)',
+ 'Seated good morning (10 reps)': 'Bom dia sentado (10 reps)',
+ 'Poliquin step-up (15 reps)': 'Step-up Poliquin (15 reps)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 rep)',
+ 'Pull-ups (10 reps, bodyweight)': 'Barra fixa (10 reps, peso corporal)',
+ 'Dips (10 reps, bodyweight)': 'Paralelas (10 reps, peso corporal)',
+ 'Incline DB press (each hand, 8 reps)': 'Supino inclinado com halteres (cada mão, 8 reps)',
+ 'DB shoulder press (each hand, 8 reps)': 'Desenvolvimento com halteres (cada mão, 8 reps)',
+ 'Change exercise': 'Trocar exercício',
+ 'Use default exercise': 'Usar exercício padrão',
+ 'Custom': 'Personalizado',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index fb5d3ef38..2227468cc 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'Plano: {0}',
'today {0}': 'hoje {0}',
'reps from your last session': 'reps da tua última sessão',
+ // --- structural balance ---
+ 'Structural Balance': 'Equilíbrio estrutural',
+ 'See which lift is holding back the rest.': 'Vê qual exercício está a travar os outros.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Compara os teus levantamentos com uma tabela de rácios publicada para encontrar o elo mais fraco.',
+ 'Open': 'Abrir',
+ 'Balanced': 'Equilibrado',
+ 'Borderline': 'No limite',
+ 'Weak': 'Fraco',
+ 'No data': 'Sem dados',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Poderlevantamento',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Supino pega fechada (referência)',
+ 'Incline bench press': 'Supino inclinado',
+ 'Dips (bodyweight + load)': 'Paralelas (peso corporal + carga)',
+ 'Supine pull-ups (bodyweight + load)': 'Barra supinada (peso corporal + carga)',
+ 'Standing barbell curl': 'Rosca direta com barra em pé',
+ 'High-bar back squat (anchor)': 'Agachamento barra alta (referência)',
+ 'Front squat': 'Agachamento frontal',
+ 'Deadlift': 'Levantamento terra',
+ 'Power clean': 'Power clean',
+ 'Squat (anchor)': 'Agachamento (referência)',
+ 'Bench press': 'Supino reto',
+ 'Military press': 'Desenvolvimento militar',
+ 'Romanian deadlift (12 reps)': 'Levantamento terra romeno (12 reps)',
+ 'Seated good morning (10 reps)': 'Bom dia sentado (10 reps)',
+ 'Poliquin step-up (15 reps)': 'Step-up Poliquin (15 reps)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 rep)',
+ 'Pull-ups (10 reps, bodyweight)': 'Barra fixa (10 reps, peso corporal)',
+ 'Dips (10 reps, bodyweight)': 'Paralelas (10 reps, peso corporal)',
+ 'Incline DB press (each hand, 8 reps)': 'Supino inclinado com halteres (cada mão, 8 reps)',
+ 'DB shoulder press (each hand, 8 reps)': 'Desenvolvimento com halteres (cada mão, 8 reps)',
+ 'Change exercise': 'Trocar exercício',
+ 'Use default exercise': 'Usar exercício predefinido',
+ 'Custom': 'Personalizado',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 9bfac9658..483c12744 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'План: {0}',
'today {0}': 'сегодня {0}',
'reps from your last session': 'повт. с прошлой тренировки',
+ // --- structural balance ---
+ 'Structural Balance': 'Структурный баланс',
+ 'See which lift is holding back the rest.': 'Узнайте, какое упражнение сдерживает остальные.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Сравните свои результаты с опубликованной таблицей соотношений, чтобы найти слабое звено.',
+ 'Open': 'Открыть',
+ 'Balanced': 'Сбалансировано',
+ 'Borderline': 'Погранично',
+ 'Weak': 'Слабое',
+ 'No data': 'Нет данных',
+ 'Poliquin': 'Полкен',
+ 'Thibaudeau — Powerlifting': 'Тибодо — Пауэрлифтинг',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Жим лёжа узким хватом (опорное упражнение)',
+ 'Incline bench press': 'Жим на наклонной скамье',
+ 'Dips (bodyweight + load)': 'Отжимания на брусьях (свой вес + отягощение)',
+ 'Supine pull-ups (bodyweight + load)': 'Подтягивания супинированным хватом (свой вес + отягощение)',
+ 'Standing barbell curl': 'Подъём штанги на бицепс стоя',
+ 'High-bar back squat (anchor)': 'Присед со штангой на спине, высокий хват (опорное упражнение)',
+ 'Front squat': 'Фронтальные приседания',
+ 'Deadlift': 'Становая тяга',
+ 'Power clean': 'Силовой подъём на грудь (power clean)',
+ 'Squat (anchor)': 'Присед (опорное упражнение)',
+ 'Bench press': 'Жим лёжа',
+ 'Military press': 'Армейский жим',
+ 'Romanian deadlift (12 reps)': 'Румынская тяга (12 повторений)',
+ 'Seated good morning (10 reps)': 'Гуд морнинг сидя (10 повторений)',
+ 'Poliquin step-up (15 reps)': 'Зашагивание Полкена (15 повторений)',
+ 'Nordic curl (1 rep)': 'Нордическое сгибание (1 повторение)',
+ 'Pull-ups (10 reps, bodyweight)': 'Подтягивания (10 повторений, свой вес)',
+ 'Dips (10 reps, bodyweight)': 'Отжимания на брусьях (10 повторений, свой вес)',
+ 'Incline DB press (each hand, 8 reps)': 'Жим гантелей на наклонной скамье (на руку, 8 повторений)',
+ 'DB shoulder press (each hand, 8 reps)': 'Жим гантелей сидя (на руку, 8 повторений)',
+ 'Change exercise': 'Изменить упражнение',
+ 'Use default exercise': 'Использовать упражнение по умолчанию',
+ 'Custom': 'Свой вариант',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 952e70287..7ff5bcda3 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1311,4 +1311,39 @@ export default {
'Plan: {0}': 'แผน: {0}',
'today {0}': 'วันนี้ {0}',
'reps from your last session': 'จำนวนครั้งจากเซสชันล่าสุด',
+ // --- structural balance ---
+ 'Structural Balance': 'สมดุลโครงสร้าง',
+ 'See which lift is holding back the rest.': 'ดูว่าท่าไหนที่ฉุดท่าอื่นไว้',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'เปรียบเทียบท่าฝึกของคุณกับตารางอัตราส่วนที่เผยแพร่ เพื่อหาจุดอ่อน',
+ 'Open': 'เปิด',
+ 'Balanced': 'สมดุล',
+ 'Borderline': 'ก้ำกึ่ง',
+ 'Weak': 'อ่อนแอ',
+ 'No data': 'ไม่มีข้อมูล',
+ 'Poliquin': 'โพลีควิน',
+ 'Thibaudeau — Powerlifting': 'ธิโบโด — เพาเวอร์ลิฟติ้ง',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'เบนช์เพรสจับแคบ (ท่าอ้างอิง)',
+ 'Incline bench press': 'อินไคลน์เบนช์เพรส',
+ 'Dips (bodyweight + load)': 'ดิป (น้ำหนักตัว + น้ำหนักเสริม)',
+ 'Supine pull-ups (bodyweight + load)': 'พูลอัพคว่ำมือจับหงาย (น้ำหนักตัว + น้ำหนักเสริม)',
+ 'Standing barbell curl': 'บาร์เบลเคิร์ลยืน',
+ 'High-bar back squat (anchor)': 'สควอทวางบาร์สูง (ท่าอ้างอิง)',
+ 'Front squat': 'ฟรอนท์สควอท',
+ 'Deadlift': 'เดดลิฟต์',
+ 'Power clean': 'พาวเวอร์คลีน',
+ 'Squat (anchor)': 'สควอท (ท่าอ้างอิง)',
+ 'Bench press': 'เบนช์เพรส',
+ 'Military press': 'มิลิทารีเพรส',
+ 'Romanian deadlift (12 reps)': 'โรมาเนียนเดดลิฟต์ (12 ครั้ง)',
+ 'Seated good morning (10 reps)': 'กูดมอร์นิ่งท่านั่ง (10 ครั้ง)',
+ 'Poliquin step-up (15 reps)': 'โพลีควินสเต็ปอัพ (15 ครั้ง)',
+ 'Nordic curl (1 rep)': 'นอร์ดิกเคิร์ล (1 ครั้ง)',
+ 'Pull-ups (10 reps, bodyweight)': 'พูลอัพ (10 ครั้ง, น้ำหนักตัว)',
+ 'Dips (10 reps, bodyweight)': 'ดิป (10 ครั้ง, น้ำหนักตัว)',
+ 'Incline DB press (each hand, 8 reps)': 'ดัมเบลอินไคลน์เพรส (ข้างละ 8 ครั้ง)',
+ 'DB shoulder press (each hand, 8 reps)': 'ดัมเบลโชลเดอร์เพรส (ข้างละ 8 ครั้ง)',
+ 'Change exercise': 'เปลี่ยนท่าฝึก',
+ 'Use default exercise': 'ใช้ท่าฝึกเริ่มต้น',
+ 'Custom': 'กำหนดเอง',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 6f0a9eca2..a0f33214b 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': 'Plan: {0}',
'today {0}': 'bugün {0}',
'reps from your last session': 'tekrarlar son seansından',
+ // --- structural balance ---
+ 'Structural Balance': 'Yapısal denge',
+ 'See which lift is holding back the rest.': 'Hangi hareketin diğerlerini geride bıraktığını gör.',
+ 'Compare your lifts against a published ratio table to find the weak link.': 'Hareketlerini yayımlanmış bir oran tablosuyla karşılaştırarak zayıf halkayı bul.',
+ 'Open': 'Aç',
+ 'Balanced': 'Dengeli',
+ 'Borderline': 'Sınırda',
+ 'Weak': 'Zayıf',
+ 'No data': 'Veri yok',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — Halter (Powerlifting)',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': 'Dar tutuş bench press (referans)',
+ 'Incline bench press': 'Eğimli bench press',
+ 'Dips (bodyweight + load)': 'Dip (vücut ağırlığı + ek yük)',
+ 'Supine pull-ups (bodyweight + load)': 'Supine barfiks (vücut ağırlığı + ek yük)',
+ 'Standing barbell curl': 'Ayakta barbell curl',
+ 'High-bar back squat (anchor)': 'Yüksek bar squat (referans)',
+ 'Front squat': 'Ön squat',
+ 'Deadlift': 'Deadlift',
+ 'Power clean': 'Power clean',
+ 'Squat (anchor)': 'Squat (referans)',
+ 'Bench press': 'Bench press',
+ 'Military press': 'Askeri press',
+ 'Romanian deadlift (12 reps)': 'Romen deadlift (12 tekrar)',
+ 'Seated good morning (10 reps)': 'Oturarak good morning (10 tekrar)',
+ 'Poliquin step-up (15 reps)': 'Poliquin step-up (15 tekrar)',
+ 'Nordic curl (1 rep)': 'Nordic curl (1 tekrar)',
+ 'Pull-ups (10 reps, bodyweight)': 'Barfiks (10 tekrar, vücut ağırlığı)',
+ 'Dips (10 reps, bodyweight)': 'Dip (10 tekrar, vücut ağırlığı)',
+ 'Incline DB press (each hand, 8 reps)': 'Eğimli dambıl press (elde 8 tekrar)',
+ 'DB shoulder press (each hand, 8 reps)': 'Dambıl omuz press (elde 8 tekrar)',
+ 'Change exercise': 'Egzersizi değiştir',
+ 'Use default exercise': 'Varsayılan egzersizi kullan',
+ 'Custom': 'Özel',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 5ad7f7998..7e7d97199 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1300,4 +1300,39 @@ export default {
'Plan: {0}': '计划:{0}',
'today {0}': '今天 {0}',
'reps from your last session': '次数沿用上次训练',
+ // --- structural balance ---
+ 'Structural Balance': '结构平衡',
+ 'See which lift is holding back the rest.': '看看哪个动作拖了其他动作的后腿。',
+ 'Compare your lifts against a published ratio table to find the weak link.': '将你的动作成绩与已发布的比例表对比,找出最薄弱的环节。',
+ 'Open': '打开',
+ 'Balanced': '平衡',
+ 'Borderline': '临界',
+ 'Weak': '薄弱',
+ 'No data': '无数据',
+ 'Poliquin': 'Poliquin',
+ 'Thibaudeau — Powerlifting': 'Thibaudeau — 力量举',
+ 'ATG': 'ATG',
+ 'Close-grip bench press (anchor)': '窄距卧推(锚点)',
+ 'Incline bench press': '上斜卧推',
+ 'Dips (bodyweight + load)': '双杠臂屈伸(自重+负重)',
+ 'Supine pull-ups (bodyweight + load)': '反手引体向上(自重+负重)',
+ 'Standing barbell curl': '站姿杠铃弯举',
+ 'High-bar back squat (anchor)': '高杠深蹲(锚点)',
+ 'Front squat': '前蹲',
+ 'Deadlift': '硬拉',
+ 'Power clean': '高翻(power clean)',
+ 'Squat (anchor)': '深蹲(锚点)',
+ 'Bench press': '卧推',
+ 'Military press': '军式推举',
+ 'Romanian deadlift (12 reps)': '罗马尼亚硬拉(12次)',
+ 'Seated good morning (10 reps)': '坐姿早安式(10次)',
+ 'Poliquin step-up (15 reps)': 'Poliquin踏步蹲(15次)',
+ 'Nordic curl (1 rep)': '北欧腿弯举(1次)',
+ 'Pull-ups (10 reps, bodyweight)': '引体向上(10次,自重)',
+ 'Dips (10 reps, bodyweight)': '双杠臂屈伸(10次,自重)',
+ 'Incline DB press (each hand, 8 reps)': '哑铃上斜卧推(单手8次)',
+ 'DB shoulder press (each hand, 8 reps)': '哑铃肩推(单手8次)',
+ 'Change exercise': '更换动作',
+ 'Use default exercise': '使用默认动作',
+ 'Custom': '自定义',
}
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index b97f9cc7b..54e229622 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -11,6 +11,7 @@ import { countChanges, syncFingerprint } from '../lib/sync-changes.js'
import { appBase } from '../lib/app-base.js'
import { loadRemote, chooseLocal, forgetRemote, connect, normalizeServerUrl, renewToken } from '../lib/remote.js'
import { loadCoachDevice, saveCoachDevice, coachDeviceSettings } from '../lib/coach-device.js'
+import { DEFAULT_TEMPLATE_ID } from '../lib/structuralBalanceTemplates.js'
import { WC_DEFAULT } from '../lib/workout-controls.js'
@@ -101,6 +102,11 @@ export const DEF = {
// weight; 'last' carries the reps over from the last session, the way it always worked before.
// Absent reads as 'plan' too, which is what the MCP bridge sees on a raw state file.
startFrom: 'plan',
+ // Structural Balance (views/StructuralBalance.jsx): which built-in ratio template is active,
+ // and per-role exercise overrides keyed by `${templateId}:${roleId}` — see
+ // lib/structuralBalance.js's overrideKey(). An override replaces that role's curated
+ // exercise-id whitelist with a single user-chosen exercise id.
+ balanceTemplate: DEFAULT_TEMPLATE_ID, balanceOverrides: {},
}
const clone = o => JSON.parse(JSON.stringify(o))
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index 3af72bb3b..a0afb5a61 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -451,6 +451,11 @@ export default function Stats() {
</div>
{workouts.length > 0 && <MuscleBalance S={S} />}
+ {workouts.length > 0 && <div className="card row between" style={{ alignItems: 'center' }}>
+ <div><h2 style={{ margin: 0 }}>{t('Structural Balance')}</h2>
+ <div className="sub">{t('See which lift is holding back the rest.')}</div></div>
+ <Button size="sm" variant="tinted" icon="scale" onClick={() => nav('/structural-balance')}>{t('Open')}</Button>
+ </div>}
{hasEffort(S) && <EffortCard S={S} />}
<div className="cols">
diff --git a/frontend/src/views/StructuralBalance.jsx b/frontend/src/views/StructuralBalance.jsx
new file mode 100644
index 000000000..b29d65bf0
--- /dev/null
+++ b/frontend/src/views/StructuralBalance.jsx
@@ -0,0 +1,85 @@
+import { useMemo } from 'react'
+import { useNavigate } from 'react-router-dom'
+import { useStore } from '../store/useStore.js'
+import { EXIDX } from '../lib/exercises.js'
+import { t, exerciseNameFor } from '../lib/i18n.js'
+import Icon from '../components/Icon.jsx'
+import { Button, Segmented } from '../components/ui.jsx'
+import { exercisePicker } from '../sheets.jsx'
+import { computeBalance, overrideKey } from '../lib/structuralBalance.js'
+import { balanceStatusView } from '../lib/structuralBalance-view.js'
+import { TEMPLATES, TEMPLATE_LIST, DEFAULT_TEMPLATE_ID, EVALUATION_MODES } from '../lib/structuralBalanceTemplates.js'
+
+const STATUS_COLOR = {
+ balanced: 'var(--green)',
+ borderline: 'var(--yellow)',
+ weak: 'var(--red)',
+ 'no-data': 'var(--label-3)',
+}
+
+const exerciseName = id => (id && EXIDX[id] ? exerciseNameFor(EXIDX[id]) : null)
+
+export default function StructuralBalance() {
+ const nav = useNavigate()
+ const S = useStore(s => s.S)
+ const update = useStore(s => s.update)
+ const templateId = TEMPLATES[S.balanceTemplate] ? S.balanceTemplate : DEFAULT_TEMPLATE_ID
+ const template = TEMPLATES[templateId]
+ const results = useMemo(() => computeBalance(S, template), [S, template])
+
+ const setOverride = (role, exId) => update(s => {
+ s.balanceOverrides = { ...s.balanceOverrides, [overrideKey(template, role)]: exId }
+ })
+ const clearOverride = role => update(s => {
+ const next = { ...s.balanceOverrides }
+ delete next[overrideKey(template, role)]
+ s.balanceOverrides = next
+ })
+ const changeExercise = role => {
+ const picker = exercisePicker(ex => { setOverride(role, ex.id); picker.close() })
+ }
+
+ return <>
+ <div className="hdr"><button className="iconbtn" onClick={() => nav('/stats')} aria-label={t('Stats')}><Icon name="chevronLeft" /></button>
+ <div style={{ flex: 1, marginLeft: 12 }}><h1>{t('Structural Balance')}</h1>
+ <div className="sub">{t('Compare your lifts against a published ratio table to find the weak link.')}</div></div></div>
+
+ <Segmented className="seg-range" value={templateId}
+ onChange={id => update(s => { s.balanceTemplate = id })}
+ options={TEMPLATE_LIST.map(tpl => ({ value: tpl.id, label: t(tpl.label) }))} />
+
+ <div className="card">
+ {results.map(r => {
+ const role = template.roles.find(role => role.id === r.roleId)
+ const view = balanceStatusView(r.status)
+ // The exercise the number came from when there is one, otherwise the one this role is
+ // set to — a role you just pointed at an exercise should name it, logged or not.
+ const name = exerciseName(r.mappedExerciseId || r.configuredExerciseId)
+ const reps = role.evaluationMode === EVALUATION_MODES.REP_COUNT
+ const actual = r.status === 'no-data' ? '—' : reps ? r.current.r : `${Math.round(r.actualPct)}%`
+ const valueText = `${actual} / ${r.targetPct}${reps ? '' : '%'}`
+ return (
+ <div key={r.roleId} className="mrow" data-role-id={r.roleId} data-status={r.status}
+ style={{ flexDirection: 'column', alignItems: 'stretch', gap: 6, paddingBlock: 10 }}>
+ <div style={{ display: 'flex', justifyContent: 'space-between', gap: 12 }}>
+ <span className="nm" style={{ minWidth: 0 }}>
+ <span style={{ display: 'block' }}>{t(role.label)}</span>
+ <span className="small dim" style={{ display: 'block' }}>
+ {name}{r.isOverridden ? ` · ${t('Custom')}` : ''}
+ </span>
+ </span>
+ <span className="v" style={{ textAlign: 'right', flexShrink: 0 }}>
+ <span style={{ color: STATUS_COLOR[r.status] }}>{t(view.label)}</span>
+ <span className="dim small" style={{ display: 'block' }}>{valueText}</span>
+ </span>
+ </div>
+ <div style={{ display: 'flex', gap: 8 }}>
+ <Button size="sm" variant="ghost" icon="pencil" onClick={() => changeExercise(role)}>{t('Change exercise')}</Button>
+ {r.isOverridden && <Button size="sm" variant="ghost" onClick={() => clearOverride(role)}>{t('Use default exercise')}</Button>}
+ </div>
+ </div>
+ )
+ })}
+ </div>
+ </>
+}
diff --git a/frontend/src/views/StructuralBalance.test.jsx b/frontend/src/views/StructuralBalance.test.jsx
new file mode 100644
index 000000000..254806938
--- /dev/null
+++ b/frontend/src/views/StructuralBalance.test.jsx
@@ -0,0 +1,98 @@
+// @vitest-environment happy-dom
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest'
+import { DEF, useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import StructuralBalance from './StructuralBalance.jsx'
+
+const navSpy = vi.fn()
+vi.mock('react-router-dom', () => ({ useNavigate: () => navSpy }))
+
+const clone = value => JSON.parse(JSON.stringify(value))
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+
+const mounted = []
+function render() {
+ const host = document.createElement('div')
+ document.body.appendChild(host)
+ const root = createRoot(host)
+ mounted.push(root)
+ act(() => root.render(<StructuralBalance />))
+ return host
+}
+
+function setDoneSet(w, r) { return { done: true, w, r } }
+function workoutAt(id, start, sets) {
+ return { d: new Date(start).toISOString(), start, entries: [{ id, sets }] }
+}
+
+beforeEach(() => {
+ navSpy.mockClear()
+ localStorage.clear()
+ useUI.setState({ sheets: [] })
+ const S = clone(DEF)
+ S.workouts = [workoutAt('0030', Date.now(), [setDoneSet(100, 1)])] // narrowBench anchor logged
+ useStore.setState({ S, user: null })
+ document.body.innerHTML = ''
+})
+
+afterEach(() => {
+ act(() => { mounted.splice(0).forEach(root => root.unmount()) })
+})
+
+describe('StructuralBalance view', () => {
+ it('renders every role of the default (Poliquin) template', () => {
+ const host = render()
+ const rows = host.querySelectorAll('[data-role-id]')
+ expect(rows.length).toBe(9)
+ expect(host.querySelector('[data-role-id="narrowBench"]').textContent).toContain('Balanced')
+ expect(host.querySelector('[data-role-id="deadlift"]').textContent).toContain('No data')
+ })
+
+ it('switching templates via the Segmented control recomputes the role list', () => {
+ const host = render()
+ const atgButton = [...host.querySelectorAll('.seg button')].find(b => b.textContent === 'ATG')
+ expect(atgButton).toBeTruthy()
+ act(() => atgButton.click())
+
+ expect(useStore.getState().S.balanceTemplate).toBe('atg')
+ const rows = host.querySelectorAll('[data-role-id]')
+ expect(rows.length).toBe(8)
+ expect(host.querySelector('[data-role-id="nordicCurl"]')).toBeTruthy()
+ })
+
+ it('a role with no matching exercise ever logged shows "No data" without throwing', () => {
+ const host = render()
+ const deadlift = host.querySelector('[data-role-id="deadlift"]')
+ expect(deadlift.textContent).toContain('No data')
+ })
+
+ it('the back chevron navigates to /stats', () => {
+ const host = render()
+ act(() => host.querySelector('.iconbtn').click())
+ expect(navSpy).toHaveBeenCalledWith('/stats')
+ })
+
+ it('changing a role\'s exercise via the picker saves an override and marks it custom', () => {
+ const host = render()
+ const row = host.querySelector('[data-role-id="inclineBench"]')
+ const changeBtn = [...row.querySelectorAll('button')].find(b => b.textContent.includes('Change exercise'))
+ act(() => changeBtn.click())
+
+ const picker = useUI.getState().sheets.at(-1)
+ expect(picker).toBeTruthy()
+ const pickerView = picker.render(picker.close)
+ act(() => pickerView.props.onPick({ id: '0043' })) // barbell full squat — deliberately not in inclineBench's whitelist
+
+ expect(useStore.getState().S.balanceOverrides['poliquin:inclineBench']).toBe('0043')
+
+ const updatedRow = host.querySelector('[data-role-id="inclineBench"]')
+ expect(updatedRow.textContent).toContain('Custom')
+
+ const resetBtn = [...updatedRow.querySelectorAll('button')].find(b => b.textContent.includes('Use default exercise'))
+ expect(resetBtn).toBeTruthy()
+ act(() => resetBtn.click())
+ expect(useStore.getState().S.balanceOverrides['poliquin:inclineBench']).toBeUndefined()
+ })
+})