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.

By muscle gets the Favourites chip the exercise list has (#669)

Duarte Santosb7b92b259222
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 746294bd9..80e6f0f83 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,7 @@ asking for anything, promise.
**Fixes**
- Jumping jacks, burpees and the other cardio moves can be counted in sets x reps (or timed):
their settings now offer Cardio, Reps and Time, Cardio still the default (#678).
+- Add exercise → By muscle has the Favourites chip too, for the muscle you picked (#669).
## v1.4.2 (2026-10-18)
diff --git a/frontend/src/components/MuscleExplorer.jsx b/frontend/src/components/MuscleExplorer.jsx
index de6313558..ae7902c8e 100644
--- a/frontend/src/components/MuscleExplorer.jsx
+++ b/frontend/src/components/MuscleExplorer.jsx
@@ -13,7 +13,9 @@ import ExerciseViewToggle from './ExerciseViewToggle.jsx'
import { Button } from './ui.jsx'
import { tappable } from '../lib/use-sheet-keyboard.js'
import { useAutoMore } from '../lib/use-auto-more.js'
-import { isFav, sortFavouritesFirst } from '../lib/favourites.js'
+import { favIds, isFav, sortFavouritesFirst } from '../lib/favourites.js'
+
+const FAV = '☆'
// One explorer for the Library and every catalogue picker. Supplying `onPick` turns
// a result into a selection; without it the explorer behaves like the normal Library.
@@ -38,7 +40,10 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan, pickIcon = 'p
])), [catalog])
const pick = muscle => { setSelected(muscle === selected ? null : muscle); setEq(''); setShown(40) }
const targeted = selected ? catalog.filter(e => musclesOf(e)[selected]) : []
- const base = searchExercises(targeted.filter(e => !bp || e.bp === bp), q)
+ // The picker's Favourites chip (#669), here for the chosen muscle: '☆' in place of a body part.
+ const favOn = bp === FAV
+ const favHere = targeted.filter(e => isFav(S, e.id)).length
+ const base = searchExercises(targeted.filter(e => favOn ? isFav(S, e.id) : (!bp || e.bp === bp)), q)
const eqOpts = equipmentOf(base)
const eqOn = eqOpts.includes(eq) ? eq : ''
// Favourites float to the top of whatever the filters left (issue #6), the rest keeps its order.
@@ -82,6 +87,7 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan, pickIcon = 'p
eqOn fallback above drops it only for this view if the new body part has nothing under
it, without forgetting the choice. "All" clears it, since it spans every body part. */}
<div className="chips" style={{ marginBottom: eqOpts.length > 1 ? 8 : 12 }}>
+ {favIds(S).length > 0 && <button className={'chip' + (favOn ? ' on' : '')} onClick={() => { setBp(FAV); setEq(''); setShown(40) }}><Icon name="starFill" className="fav-star" />{t('Favourites')} ({favHere})</button>}
<button className={'chip nocap' + (!bp ? ' on' : '')} onClick={() => { setBp(''); setEq(''); setShown(40) }}>{t('All')}</button>
{BODYPARTS.map(b => <button key={b} className={'chip' + (bp === b ? ' on' : '')} onClick={() => { setBp(b); setShown(40) }}>{t(b)}</button>)}
</div>
diff --git a/frontend/src/components/MuscleExplorer.test.jsx b/frontend/src/components/MuscleExplorer.test.jsx
index f4488b269..72c38c5ff 100644
--- a/frontend/src/components/MuscleExplorer.test.jsx
+++ b/frontend/src/components/MuscleExplorer.test.jsx
@@ -119,3 +119,34 @@ describe('MuscleExplorer opened on a muscle', () => {
expect(host.textContent).toContain('Exercises for Biceps')
})
})
+
+// #669: the Add exercise picker's "By muscle" lost the Favourites chip its list view has.
+describe('MuscleExplorer Favourites chip', () => {
+ it('lists the favourites that train the chosen muscle', async () => {
+ const { EXDB } = await import('../lib/exercises.js')
+ const { musclesOf } = await import('../lib/muscles.js')
+ const curl = EXDB.find(e => musclesOf(e).biceps === 1)
+ const press = EXDB.find(e => !musclesOf(e).biceps && e.bp === 'chest')
+ mocks.S.favEx = [curl.id, press.id]
+ const onPick = vi.fn()
+ const host = render({ onPick })
+ act(() => { muscleChip(host, 'Biceps').click() })
+ const fav = muscleChip(host, 'Favourites')
+ expect(fav, 'a Favourites chip next to All').toBeTruthy()
+ expect(fav.textContent).toContain('(1)')
+ act(() => { fav.click() })
+ expect(isOn(muscleChip(host, 'Favourites'))).toBe(true)
+ const rows = [...host.querySelectorAll('.list .item')]
+ expect(rows).toHaveLength(1)
+ act(() => { rows[0].click() })
+ expect(onPick).toHaveBeenCalledWith(expect.objectContaining({ id: curl.id }))
+ act(() => { chipByText(host, 'All').click() })
+ expect(host.querySelectorAll('.list .item').length).toBeGreaterThan(1)
+ })
+
+ it('is not there without favourites', () => {
+ const host = render({ onPick: vi.fn() })
+ act(() => { muscleChip(host, 'Biceps').click() })
+ expect(muscleChip(host, 'Favourites')).toBeUndefined()
+ })
+})