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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Muscle names in the picker row, config sheet, Muscles rows and the workout tag go through MUSCLE_NAME — "gluteal", "forearm" and "hip-flexors" leaked as raw ids, and "forearm" stayed English in German (QA C9)
Duarte Santos2bf86a531853
diff --git a/frontend/src/components/MuscleExplorer.jsx b/frontend/src/components/MuscleExplorer.jsxindex 9916377ed..f628d95d1 100644--- a/frontend/src/components/MuscleExplorer.jsx+++ b/frontend/src/components/MuscleExplorer.jsx@@ -84,7 +84,7 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan }) {const primary = musclesOf(e)[selected] === 1return <div key={e.id} className="item" {...tappable(() => choose(e))}><Thumb ex={e} />- <div className="grow"><div className="tt capitalize">{isFav(S, e.id) && <Icon name="starFill" className="fav-star" />}{exerciseNameFor(e)}</div><div className="ss">{t(primary ? 'Primary target' : 'Also trains')} · <span className="capitalize">{t(e.tg || e.bp)} · {t(e.eq)}</span></div></div>+ <div className="grow"><div className="tt capitalize">{isFav(S, e.id) && <Icon name="starFill" className="fav-star" />}{exerciseNameFor(e)}</div><div className="ss">{t(primary ? 'Primary target' : 'Also trains')} · <span className="capitalize">{t(MUSCLE_NAME[e.tg] || e.tg || e.bp)} · {t(e.eq)}</span></div></div>{onPick ? <Icon name="plus" className="chev" /> : <>{best > 0 && <span className="tag acc">{fmtNum(best)}</span>}<Button size="sm" variant="tinted" icon="plus" onClick={ev => { ev.stopPropagation(); onPlan(e) }}>{t('Plan')}</Button>diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 6b872a58a..e5ef020e1 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -946,7 +946,7 @@ function ExercisePicker({ onPick, close }) {<div className="grow"><div className="tt">{t('Create your own exercise')}</div><div className="ss">{t('name + body part, no animation')}</div></div><Icon name="plus" className="chev" /></div>}{f.slice(0, shown).map(e => <div key={e.id} className="item" {...tappable(() => onPick(e))}>- <Thumb ex={e} /><div className="grow"><div className="tt capitalize">{isFav(st, e.id) && <Icon name="starFill" className="fav-star" />}{exerciseNameFor(e)}</div><div className="ss capitalize">{t(e.tg || e.bp)} · {t(e.eq)}</div></div>+ <Thumb ex={e} /><div className="grow"><div className="tt capitalize">{isFav(st, e.id) && <Icon name="starFill" className="fav-star" />}{exerciseNameFor(e)}</div><div className="ss capitalize">{t(MUSCLE_NAME[e.tg] || e.tg || e.bp)} · {t(e.eq)}</div></div>{/* Accent tag = already in a routine/log ("Chosen"); the yellow star by the name = favourite. */}{usage[e.id] && <span className="tag acc"><Icon name="starFill" /></span>}{/* A "+" glyph reads as "add this now" — it used to just open the same detail sheet as@@ -1225,12 +1225,14 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {<Media ex={ex} />{/* The same tags the exercise detail sheet shows, secondaries included: choosing what goesinto a plan is exactly when "what else does this hit" matters, and until now that was- only visible from the Exercises tab, after the fact. */}+ only visible from the Exercises tab, after the fact. Custom exercises and the newer+ metadata name muscles by the map's ids ("forearm", "gluteal"), which only MUSCLE_NAME+ turns into a translatable label. */}<div className="row" style={{ gap: 6, flexWrap: 'wrap', margin: '10px 0 14px' }}>{cardio && <span className="tag acc"><Icon name="figureRun" />{t('Cardio')}</span>}- <span className="tag">{t(ex.tg || ex.bp)}</span><span className="tag">{t(ex.eq)}</span>+ <span className="tag">{t(MUSCLE_NAME[ex.tg] || ex.tg || ex.bp)}</span><span className="tag">{t(ex.eq)}</span>{!cardio && (ex.secondaries?.length ? ex.secondaries : smOf(ex)).slice(0, 3)- .map((s, i) => <span key={i} className="tag dim">{t(s)}</span>)}+ .map((s, i) => <span key={i} className="tag dim">{t(MUSCLE_NAME[s] || s)}</span>)}</div>{ex.desc && <div className="exnote">{ex.desc}</div>}{!cardio && <div style={{ marginBottom: 14 }}>diff --git a/frontend/src/sheets.muscle-names.test.jsx b/frontend/src/sheets.muscle-names.test.jsxnew file mode 100644index 000000000..fdb3c9a41--- /dev/null+++ b/frontend/src/sheets.muscle-names.test.jsx@@ -0,0 +1,107 @@+// @vitest-environment happy-dom+// QA C9. Custom exercises and the newer exercise metadata name muscles by the map's ids. The+// picker row, the routine config sheet and the Muscles rows printed those ids ("gluteal",+// "forearm", "hip-flexors") where the detail sheet already said Glutes / Forearms / Hip flexors —+// and in German "forearm" stayed English, because only the display names have translations.+import React, { act } from 'react'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { createRoot } from 'react-dom/client'+import { EXIDX, registerCustom } from './lib/exercises.js'+import { DEF, useStore } from './store/useStore.js'+import { useUI } from './store/useUI.js'+import { _setLangState } from './lib/i18n-core.js'+import de from './locales/de.js'+import { exercisePicker, exConfigSheet } from './sheets.jsx'+import MuscleExplorer from './components/MuscleExplorer.jsx'++const mounted = []+const S = () => useStore.getState().S++// Renders whatever sheet is on top and returns its host element.+function renderTop() {+ const sheet = useUI.getState().sheets.at(-1)+ const host = document.createElement('div')+ document.body.appendChild(host)+ const root = createRoot(host)+ mounted.push(root)+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))+ return host+}+function render(node) {+ const host = document.createElement('div')+ document.body.appendChild(host)+ const root = createRoot(host)+ mounted.push(root)+ act(() => root.render(node))+ return host+}+function type(el, value) {+ Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value)+ el.dispatchEvent(new Event('input', { bubbles: true }))+}+const rowFor = (host, name) => [...host.querySelectorAll('.item')].find(e => e.textContent.includes(name))+const custom = (over = {}) => ({+ id: 'cqa1', n: 'QA Custom Thrust', bp: 'upper legs', eq: 'barbell', custom: true, desc: '',+ tg: 'gluteal', sm: ['forearm', 'hip-flexors'], primaries: ['gluteal'], secondaries: ['forearm', 'hip-flexors'],+ muscleGroups: ['gluteal', 'forearm', 'hip-flexors'], ...over,+})+function seed(ex) {+ useStore.setState(s => ({ S: { ...s.S, customEx: [ex] } }))+ registerCustom([ex])+}++beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ useUI.setState({ sheets: [], toastMsg: '' })+ useStore.setState({ S: structuredClone(DEF), user: null })+ registerCustom([])+ _setLangState('en', null, null, null)+ document.body.innerHTML = ''+})++afterEach(() => {+ act(() => { mounted.splice(0).forEach(root => root.unmount()) })+ _setLangState('en', null, null, null)+ registerCustom([])+})++describe('muscle names in the rows and tags (QA C9)', () => {+ it('picker row shows the display name, not the map id', () => {+ seed(custom())+ exercisePicker(vi.fn())+ const host = renderTop()+ act(() => type(host.querySelector('input.input'), 'QA Custom'))+ expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Glutes · barbell')+ })++ it('config sheet tags read like the detail sheet, for a custom exercise and for power clean', () => {+ seed(custom())+ exConfigSheet(EXIDX.cqa1, null, vi.fn())+ const tags = h => [...h.querySelectorAll('.tag')].map(e => e.textContent.trim())+ expect(tags(renderTop())).toEqual(['Glutes', 'barbell', 'Forearms', 'Hip flexors'])+ // #207 Olympic lifts list their secondaries as map ids ('forearm', 'deltoids').+ exConfigSheet(EXIDX['0648'], null, vi.fn())+ expect(tags(renderTop())).toEqual(['hamstrings', 'barbell', 'Calves', 'Forearms', 'Shoulders'])+ })++ it('translates them in German too — "forearm" was staying English', () => {+ _setLangState('de', de, null, null)+ seed(custom())+ exConfigSheet(EXIDX['0648'], null, vi.fn())+ const tags = [...renderTop().querySelectorAll('.tag')].map(e => e.textContent.trim())+ expect(tags).toEqual(['Beinbeuger', 'Langhantel', 'Waden', 'Unterarme', 'Schultern'])+ exercisePicker(vi.fn())+ const host = renderTop()+ act(() => type(host.querySelector('input.input'), 'QA Custom'))+ expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Gesäß · Langhantel')+ })++ it('Muscles explorer row names the target the same way', () => {+ seed(custom())+ const host = render(<MuscleExplorer onDetail={vi.fn()} onPlan={vi.fn()} />)+ const chip = [...host.querySelectorAll('.chip[aria-pressed]')].find(e => e.textContent.startsWith('Glutes'))+ act(() => chip.click())+ act(() => type(host.querySelector('.search input'), 'QA Custom'))+ expect(rowFor(host, 'QA Custom Thrust').querySelector('.ss').textContent).toBe('Primary target · Glutes · barbell')+ })+})diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex 89a474b90..1ff110698 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -21,6 +21,7 @@ import { progressionGuidance } from '../lib/progression-copy.js'import { glyphOf } from '../lib/glyphs.js'import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps, isSideSet, makeSideSet, setSideField, toggleSide, addSideDrop, removeSideDropAt, setSideDropAt, addSideCluster, removeSideClusterAt, setSideClusterAt } from '../lib/workout-model.js'import { canMoveActiveWorkoutUnit, moveActiveWorkoutUnit } from '../lib/active-workout-order.js'+import { MUSCLE_NAME } from '../lib/muscles.js'const SWIPE_MIN_DISTANCE = 48const SWIPE_AXIS_RATIO = 1.25@@ -378,7 +379,7 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie"{n} per side" chip — which halved the combined total for display — is gone: the splitis no longer derived, it is what you enter. The tag only flags that this is per-side. */}{!cardio && !timed && isPerSide(cfg) && <span className="tag acc nocap"><Icon name="shuffle" />{t('Per side')}</span>}- {(ex.tg || ex.bp) && <span className="tag">{t(ex.tg || ex.bp)}</span>}+ {(ex.tg || ex.bp) && <span className="tag">{t(MUSCLE_NAME[ex.tg] || ex.tg || ex.bp)}</span>}{ex.eq && <span className="tag">{t(ex.eq)}</span>}{best > 0 && <span className="tag nocap">{t('Best:')} {fmtNum(best)} {S.unit}</span>}</div>diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsxindex 7a737e387..49b9f0fa6 100644--- a/frontend/src/views/Workout.test.jsx+++ b/frontend/src/views/Workout.test.jsx@@ -1369,3 +1369,18 @@ describe('per-side effort completion', () => {expect(mocks.startRest).toHaveBeenCalledTimes(calls)})})++// QA C9: custom exercises store their target as a muscle-map id ("gluteal"); the tag under the+// exercise name has to show the same label the detail sheet does (Glutes), not the raw id.+describe('Workout exercise tags', () => {+ it('names a custom exercise\'s target muscle by its display name', async () => {+ const { registerCustom } = await import('../lib/exercises.js')+ registerCustom([{ id: 'cqa1', n: 'QA Custom Thrust', bp: 'upper legs', eq: 'barbell', custom: true, tg: 'gluteal', sm: [], primaries: ['gluteal'], secondaries: [], muscleGroups: ['gluteal'] }])+ try {+ await mount([exercise('cqa1', [false])])+ const tags = [...container.querySelectorAll('.tag')].map(tag => tag.textContent.trim())+ expect(tags).toContain('Glutes')+ expect(tags).not.toContain('gluteal')+ } finally { registerCustom([]) }+ })+})