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.

mrbatch (!87): Muskel-Explorer folgt dem Geraete-Profil wie Library/Picker, Zurueck-Pfeil links, Satz nicht doppelt, Library-Tab bleibt markiert

Duarte Santos80cccdd2e09a
diff --git a/frontend/src/components/MuscleExplorer.jsx b/frontend/src/components/MuscleExplorer.jsx
index d796a3b76..e0cdfb649 100644
--- a/frontend/src/components/MuscleExplorer.jsx
+++ b/frontend/src/components/MuscleExplorer.jsx
@@ -1,6 +1,7 @@
import { useMemo, useState } from 'react'
import { useStore } from '../store/useStore.js'
import { 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 { MUSCLES, MUSCLE_NAME, musclesOf } from '../lib/muscles.js'
@@ -20,7 +21,14 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan }) {
const [bp, setBp] = useState('')
const [eq, setEq] = useState('')
const [shown, setShown] = useState(40)
- const catalog = useMemo(() => allExercises(S), [S.customEx])
+ const [showAll, setShowAll] = useState(false) // ignore the active equipment profile for this session
+ // Same rule as the Library and the picker: the active equipment profile narrows the catalogue
+ // (and the per-muscle counts) unless the user asks for everything.
+ const profile = activeProfile(S)
+ const catalog = useMemo(() => {
+ const all = allExercises(S)
+ return (profile && !showAll) ? all.filter(e => exAvailable(S, e)) : all
+ }, [S.customEx, S.equipFilterOn, S.activeEquipId, S.equipProfiles, showAll])
const counts = useMemo(() => Object.fromEntries(MUSCLES.map(m => [m,
catalog.filter(e => musclesOf(e)[m]).length
])), [catalog])
@@ -33,6 +41,13 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan }) {
const choose = ex => onPick ? onPick(ex) : onDetail(ex)
return <>
+ {profile && <div className="small dim row" style={{ margin: '-4px 2px 10px', gap: 6, alignItems: 'center' }}>
+ <Icon name="dumbbell" style={{ fontSize: 13 }} />
+ {showAll ? t('Showing all equipment') : t('Showing what you have in "{0}"', profile.name)}
+ <button className="chip nocap" style={{ marginLeft: 'auto', padding: '3px 10px', fontSize: 12 }} onClick={() => { setShowAll(v => !v); setEq(''); setShown(40) }}>
+ {showAll ? t('Filter by "{0}"', profile.name) : t('Show all equipment')}
+ </button>
+ </div>}
<div className="card">
<BodyMap className="tappable" body={S.body} selected={selected} onMuscle={pick} />
<div className="chips" style={{ marginTop: 10 }}>
@@ -43,7 +58,7 @@ export default function MuscleExplorer({ onPick, onDetail, onPlan }) {
</div>
</div>
- {!selected && <div className="empty"><div className="ico"><Icon name="target" /></div>{t('Choose a muscle to see exercises that train it.')}</div>}
+ {!selected && onPick && <div className="empty"><div className="ico"><Icon name="target" /></div>{t('Choose a muscle to see exercises that train it.')}</div>}
{selected && <>
<div className="row between" style={{ margin: '2px 0 10px' }}>
diff --git a/frontend/src/components/TabBar.jsx b/frontend/src/components/TabBar.jsx
index 156d4d7f5..d54e31cc3 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')
+ const on = k => cur === k || (cur === 'history' && k === 'stats') || (cur === 'settings' && k === 'home') || (cur === 'muscles' && k === 'library')
const startWorkout = () => {
if (!S.active) {
diff --git a/frontend/src/views/Muscles.jsx b/frontend/src/views/Muscles.jsx
index 330a48906..a1de3db90 100644
--- a/frontend/src/views/Muscles.jsx
+++ b/frontend/src/views/Muscles.jsx
@@ -7,10 +7,8 @@ import Icon from '../components/Icon.jsx'
export default function Muscles() {
const nav = useNavigate()
return <>
- <div className="hdr">
- <div><h1>{t('Explore muscles')}</h1><div className="sub">{t('Choose a muscle to see exercises that train it.')}</div></div>
- <button className="iconbtn" onClick={() => nav('/library')} aria-label={t('Exercises')}><Icon name="chevronLeft" /></button>
- </div>
+ <div className="hdr"><button className="iconbtn" onClick={() => nav('/library')} aria-label={t('Exercises')}><Icon name="chevronLeft" /></button>
+ <div style={{ flex: 1, marginLeft: 12 }}><h1>{t('Explore muscles')}</h1><div className="sub">{t('Choose a muscle to see exercises that train it.')}</div></div></div>
<MuscleExplorer onDetail={exerciseDetailSheet} onPlan={addToRoutineSheet} />
</>