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
Merge merge request !1 (equipment profiles)
Duarte Santos5a1f1d673f26
diff --cc frontend/src/sheets.jsxindex b86551258,4d2c5ec36..5b0eb309e--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@@ -1,7 -1,8 +1,8 @@@import { useEffect, useRef, useState } from 'react'import { useStore } from './store/useStore.js'import { useUI } from './store/useUI.js'-import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf } from './lib/exercises.js'+import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf, matchExercise } from './lib/exercises.js'+ import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'import { fmtDate, fmtNum, fmtVol, fmtDur, durPart, todayISO, uid, exCount, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide, sideReps, workSetsDone } from './lib/history.js'import { beep, vibrate } from './lib/sound.js'@@@ -421,16 -422,20 +422,19 @@@ function ExercisePicker({ onPick, closconst [q, setQ] = useState('')const [bp, setBp] = useState('') // '' = all, '★' = chosen, else a body partconst [eq, setEq] = useState('') // '' = any equipment+ const [showAll, setShowAll] = useState(false)const [shown, setShown] = useState(50)- const ql = q.toLowerCase().trim()const all = allExercises(st)+ const profile = activeProfile(st)let base = all.filter(e =>(bp === '★' ? usage[e.id] : (!bp || e.bp === bp)) &&- (!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql) || (e.desc || '').toLowerCase().includes(ql)))+ matchExercise(e, q))if (bp === '★') base = [...base].sort((a, b) => (usage[b.id] - usage[a.id]) || (a.n < b.n ? -1 : 1))- const eqOpts = equipmentOf(base)+ const eqFiltered = (profile && !showAll) ? base.filter(e => exAvailable(st, e)) : base+ const eqOpts = equipmentOf(eqFiltered)// Drop the equipment filter if the search narrowed it away, so you never hit a dead end.const eqOn = eqOpts.includes(eq) ? eq : ''- const f = eqOn ? base.filter(e => e.eq === eqOn) : base+ const f = eqOn ? eqFiltered.filter(e => e.eq === eqOn) : eqFilteredconst chosenCount = Object.keys(usage).lengthreturn <><h3>{t('Add exercise')}</h3>diff --cc frontend/src/views/Library.jsxindex cb1c70e1b,df0412243..0815455a5--- a/frontend/src/views/Library.jsx+++ b/frontend/src/views/Library.jsx@@@ -1,6 -1,7 +1,7 @@@import { useState } from 'react'import { useStore } from '../store/useStore.js'-import { EXDB, BODYPARTS, allExercises, equipmentOf } from '../lib/exercises.js'+import { EXDB, BODYPARTS, allExercises, equipmentOf, matchExercise } from '../lib/exercises.js'+ import { activeProfile, exAvailable } from '../lib/equipment.js'import { bestWeightFor } from '../lib/history.js'import { fmtNum } from '../lib/format.js'import { t } from '../lib/i18n.js'@@@ -14,12 -15,16 +15,15 @@@ export default function Library()const [q, setQ] = useState('')const [bp, setBp] = useState('')const [eq, setEq] = useState('')+ const [showAll, setShowAll] = useState(false) // ignore the active equipment profile for this sessionconst [shown, setShown] = useState(40)- const ql = q.toLowerCase().trim()+ const profile = activeProfile(S)- const base = allExercises(S).filter(e => (!bp || e.bp === bp) && (!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql) || (e.desc || '').toLowerCase().includes(ql)))+ const base = allExercises(S).filter(e => (!bp || e.bp === bp) && matchExercise(e, q))- const eqOpts = equipmentOf(base)+ const eqFiltered = (profile && !showAll) ? base.filter(e => exAvailable(S, e)) : base+ const eqOpts = equipmentOf(eqFiltered)// Drop the equipment filter if the search narrowed it away, so you never hit a dead end.const eqOn = eqOpts.includes(eq) ? eq : ''- const f = eqOn ? base.filter(e => e.eq === eqOn) : base+ const f = eqOn ? eqFiltered.filter(e => e.eq === eqOn) : eqFilteredreturn <><div className="hdr"><div><h1>{t('Exercises')}</h1><div className="sub">{t('{0} exercises with animations', EXDB.length)}</div></div></div>diff --cc frontend/src/views/RoutineEdit.jsxindex 69cea19f8,0213de59a..70433644f--- a/frontend/src/views/RoutineEdit.jsx+++ b/frontend/src/views/RoutineEdit.jsx@@@ -67,8 -78,8 +78,9 @@@ export default function RoutineEdit()exConfigSheet(ex, e, cfg => edit(x => { x[i] = { id: x[i].id, sg: x[i].sg, ...cfg } }), () => edit(x => { x.splice(i, 1); cleanupSg(x) }), r)}}><Thumb ex={ex} />- <div className="grow"><div className="tt capitalize">{ex.n}</div><div className="ss">{exLine(e, S.unit)}</div></div>+ <div className="grow"><div className="tt capitalize">{ex.n}</div><div className="ss">{exLine(e, S.unit)}</div>+ {e.note && <div className="small dim" style={{ marginTop: 2 }}>{e.note}</div>}</div>+ {noEquip && <span className="tag" style={{ color: 'var(--orange)', borderColor: 'var(--orange)' }} title={t('Needs {0} — not in your active profile', t(ex.eq))}><Icon name="warning" /></span>}<div style={{ display: 'flex', flexDirection: 'column', gap: 2, flex: 'none', alignItems: 'center' }}>{i > 0 && <button className={'iconbtn' + (linkedPrev ? ' on-ss' : '')} title={t('Superset with exercise above')} style={{ width: 32, height: 28, borderRadius: 8, fontSize: 15 }} onClick={ev => { ev.stopPropagation(); toggleLink(i) }}><Icon name="link" /></button>}<div style={{ display: 'flex', gap: 2 }}>