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.

choose equipment for custom exercises

Dror Amsalem42d5272b0b83
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index e945a4625..9016f9c96 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -756,6 +756,7 @@ function CustomExForm({ existing, prefill, onDone, close }) {
const onNameFocus = useSheetKeyboard(nameRef)
const [n, setN] = useState(existing ? existing.n : (prefill || ''))
const [bp, setBp] = useState(existing ? existing.bp : '')
+ const [eq, setEq] = useState(existing ? (existing.eq || '') : '')
const [desc, setDesc] = useState(existing ? (existing.desc || '') : '')
const [primaries, setPrimaries] = useState(() => {
if (existing && Array.isArray(existing.primaries) && existing.primaries.length) return [...existing.primaries]
@@ -774,6 +775,7 @@ function CustomExForm({ existing, prefill, onDone, close }) {
const name = n.trim()
if (!name) { toast(t('Give it a name')); return }
if (!bp) { toast(t('Pick a body part')); return }
+ if (!eq) { toast(t('Pick equipment')); return }
const dup = allExercises(S()).find(e => e.n.toLowerCase() === name.toLowerCase() && e.id !== (existing || {}).id)
if (dup) { toast(t('“{0}” already exists', dup.n)); return }
const d = desc.trim().slice(0, 1000)
@@ -782,11 +784,11 @@ function CustomExForm({ existing, prefill, onDone, close }) {
const groups = [...prim, ...sm]
let id = existing && existing.id
if (existing) update(s => { const c = (s.customEx || []).find(x => x.id === id); if (c) {
- c.n = name; c.bp = bp; c.desc = d; c.tg = prim[0] || ''; c.sm = sm; c.muscleGroups = groups; c.primaries = prim; c.secondaries = sm
+ c.n = name; c.bp = bp; c.desc = d; c.tg = prim[0] || ''; c.sm = sm; c.muscleGroups = groups; c.primaries = prim; c.secondaries = sm; c.eq = eq
} })
else {
id = 'c' + uid()
- update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, desc: d, tg: prim[0] || '', sm, muscleGroups: groups, primaries: prim, secondaries: sm, eq: 'custom', custom: true }) })
+ update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, desc: d, tg: prim[0] || '', sm, muscleGroups: groups, primaries: prim, secondaries: sm, eq, custom: true }) })
}
close()
toast(existing ? t('Saved') : t('“{0}” created', name))
@@ -799,6 +801,9 @@ function CustomExForm({ existing, prefill, onDone, close }) {
<div className="chips" style={{ margin: '12px 0' }}>
{BODYPARTS.map(b => <button key={b} className={'chip' + (bp === b ? ' on' : '')} onClick={() => setBp(b)}>{t(b)}</button>)}
</div>
+ <div className="chips" style={{ margin: '12px 0' }}>
+ {ALL_EQUIPMENT.map(k => (<button key={k} className={'chip' + (eq === k ? ' on' : '')} onClick={() => setEq(k)}>{t(k)}</button>))}
+ </div>
{bp && <>
{bp !== 'cardio' && <MultiSelectRow title={t('Primary muscle groups')} sheetTitle={t('Primary muscle groups')}
values={primaries}