+ {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 cb1c70e..0815455 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, 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,17 +15,27 @@ 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 profile = activeProfile(S)
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) : 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 => )}
@@ -52,3 +63,4 @@ export default function Library() {
{f.length > shown && <>>}
>
}
+
diff --git a/frontend/src/views/RoutineEdit.jsx b/frontend/src/views/RoutineEdit.jsx
index 69cea19..7043364 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
{unitFirst.has(i) &&
{t('Superset')}
}
@@ -69,6 +80,7 @@ export default function RoutineEdit() {
{ex.n}
{exLine(e, S.unit)}
{e.note &&
{e.note}
}
+ {noEquip && }
{i > 0 && }
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index d6d071b..47b2395 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -10,7 +10,7 @@ import { wakeLockSupported } from '../lib/wakelock.js'
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
import { DEMO, REPO } from '../lib/demo.js'
import { MOBILE, shareExport, syncReminder } from '../lib/mobile.js'
-import { loadStarterPlan, confirmSheet, importFromApp } from '../sheets.jsx'
+import { loadStarterPlan, confirmSheet, importFromApp, equipmentProfileSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Section, Row, SelectRow, Switch, Segmented, Button, TextField } from '../components/ui.jsx'
@@ -142,6 +142,9 @@ export default function Settings() {
{(user || MOBILE) && }
+ {/* ---------- equipment ---------- */}
+
+
{/* ---------- appearance ---------- */}
@@ -328,6 +331,37 @@ function PushCard({ S, update, toast }) {
>
}
+// Equipment profiles ("Home", "Gym", ...) — each an id/name/eq-list; the active one filters
+// the Library, exercise picker, and flags routine entries that need something outside it
+// (see lib/equipment.js). Purely local/synced state — no server changes needed.
+function EquipmentCard({ S, update }) {
+ const profiles = S.equipProfiles || []
+ const remove = p => confirmSheet({
+ title: t('Delete profile?'), message: t('"{0}" and its equipment list will be removed.', p.name),
+ confirmText: t('Delete'), danger: true,
+ onConfirm: () => update(s => {
+ s.equipProfiles = (s.equipProfiles || []).filter(x => x.id !== p.id)
+ if (s.activeEquipId === p.id) s.activeEquipId = (s.equipProfiles[0] && s.equipProfiles[0].id) || null
+ }),
+ })
+ return
+ {profiles.length > 0 &&
+ update(s => { s.equipFilterOn = v })} />
+ }
+ {profiles.length > 0 && update(s => { s.activeEquipId = v })}
+ options={profiles.map(p => ({ value: p.id, label: p.name }))} />}
+ {profiles.map(p => (
+ equipmentProfileSheet(p)}>
+
+
+ ))}
+ equipmentProfileSheet(null)} />
+
+}
+
// The same registration as the sign-in screen's, reached from Settings instead. It asks for
// the invite code on the same terms: an invite-only instance rejects a registration without
// one, so a form that cannot collect it is a form that cannot succeed.