+ {t('Name it after where you train — e.g. "Home" or "Gym" — then check what you have there.')}
+
+
+
+
+ {ALL_EQUIPMENT.map(k => (
+
+ ))}
+
+
+ {t('Body-weight exercises are always available, in every profile.')}
+
+
+ >
+}
+export const equipmentProfileSheet = profile => ui().openSheet(close => )
+
/* ============================ exercise config ============================ */
// Progression settings for one exercise (issue #17). Shown inside the config sheet because
// "how does this lift go up" belongs next to sets and reps, not in a separate screen. Left
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index 6da600e..d49e6f0 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -16,7 +16,10 @@ export const DEF = {
// that a profile which never chose (loaded state is overlaid on DEF, on every path: local,
// server pull, backup import) still falls back to the `showRir` boolean this replaced and
// keeps the column it had. See effortOf.
- reminder: { on: false, time: '08:00', tz: null }, effort: null
+ reminder: { on: false, time: '08:00', tz: null }, effort: null,
+ // Equipment profiles (issue: filter Library/picker/routines by what you actually own —
+ // e.g. "Home" vs "Gym" — building on the session-only equipment filter from issue #6).
+ equipProfiles: [], activeEquipId: null, equipFilterOn: false,
}
const clone = o => JSON.parse(JSON.stringify(o))
diff --git a/frontend/src/views/Library.jsx b/frontend/src/views/Library.jsx
index a3ba8cb..df04122 100644
--- a/frontend/src/views/Library.jsx
+++ b/frontend/src/views/Library.jsx
@@ -1,6 +1,7 @@
import { useState } from 'react'
import { useStore } from '../store/useStore.js'
import { EXDB, BODYPARTS, allExercises, equipmentOf } 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,18 +15,28 @@ 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 session
const [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 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) : eqFiltered
return <>
{t('Exercises')}
{t('{0} exercises with animations', EXDB.length)}
{ setQ(e.target.value); setShown(40) }} />
+ {profile &&
+
+ {showAll ? t('Showing all equipment') : t('Showing what you have in "{0}"', profile.name)}
+
+
}
1 ? 8 : 12 }}>
{BODYPARTS.map(b => )}
@@ -53,3 +64,4 @@ export default function Library() {
{f.length > shown && <>>}
>
}
+
diff --git a/frontend/src/views/RoutineEdit.jsx b/frontend/src/views/RoutineEdit.jsx
index d12adfb..0213de5 100644
--- a/frontend/src/views/RoutineEdit.jsx
+++ b/frontend/src/views/RoutineEdit.jsx
@@ -2,6 +2,7 @@ import { useNavigate, useParams } from 'react-router-dom'
import { useEffect } from 'react'
import { useStore } from '../store/useStore.js'
import { exOr } from '../lib/exercises.js'
+import { activeProfile, exAvailable } from '../lib/equipment.js'
import { uid } from '../lib/format.js'
import { t } from '../lib/i18n.js'
import { supersetUnits, cleanupSg, exLine } from '../lib/history.js'
@@ -36,6 +37,8 @@ export default function RoutineEdit() {
const units = supersetUnits(r.ex)
const unitFirst = new Set(units.filter(u => u.length > 1).map(u => u[0]))
const inSS = new Set(units.filter(u => u.length > 1).flat())
+ const profile = activeProfile(S)
+ const missingCount = profile ? r.ex.filter(e => !exAvailable(S, exOr(e.id))).length : 0
return
@@ -56,10 +59,18 @@ export default function RoutineEdit() {
{t('Applies to every exercise in this routine that does not set its own rule.')}
+ {missingCount > 0 &&
+
+
+
{t('{0} of {1} exercises need equipment outside "{2}"', missingCount, r.ex.length, profile.name)}
+
+
}
+
{r.ex.length ?
{r.ex.map((e, i) => {
// An unresolvable id is shown rather than skipped — hiding it left an entry you
// could neither see nor delete, but that still turned up in the workout.
const ex = exOr(e.id)
+ const noEquip = profile && !exAvailable(S, ex)
const linkedPrev = i > 0 && e.sg && r.ex[i - 1].sg === e.sg
return