Repository navigation
Instance-level equipment types: let the admin add gym kit the catalogue doesn't have #541
temperatio
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The problem
The equipment filter works from a fixed list of catalogue types (barbell, dumbbell, cable, …). A
real gym or home setup often has kit that isn't on it: a dip station, a landmine, parallettes, a
sled, a specific machine. Today there is no way to say "we have this" or "this exercise needs
that", so:
the equipment filter shows or hides it for the wrong reason;
shows up for every profile that has the catalogue equipment, even if the gym has no landmine.
What I built (in a fork, working on my own instance)
Equipment types per instance, curated by the admin.
x-id,so renaming never touches profiles or exercises. Catalogue types can't be renamed or deleted,
and a new name can't collide with any catalogue type in any language the app ships.
profiles, the custom-exercise form, the library filter, the workout tooltips.
equipment filter on, that exercise only shows for profiles that have them. The catalogue
itself isn't modified; this is a per-instance overlay.
still reference it treat it as nothing to filter on, so nothing breaks.
Users propose, the admin decides.
Settings → Equipment. The admin can approve it (optionally correcting the name), merge it into
an existing type, or reject it. The user sees the status of their proposals. At most 10
pending per user.
A name per language.
each of the app's languages. The admin's editor shows how many languages are covered (e.g.
"Languages: 5/19") and lists the missing ones first. Each user sees the name in their
language, falling back to the main name. When the admin corrects a proposal's name, the
proposer's original wording is kept as the name in their language.
Without a server. A guest, or the phone app in local mode, gets the same editor for its
own device-only list. That list is never uploaded and is kept apart from the server's.
How it's built
api/equipment.js) and a separateDATA_DIR/equipment.json(plaincatalogue data, 0644, kept apart from
db.jsonon purpose), written withatomicWrite.Routes:
GET /api/equipmentfor every signed-in user, plusGET/POST /api/equipment/proposalsand four/api/admin/equipment/*routes behindrequireAdmin. Adminactions go to
audit.log. Documented inopenapi.yaml.S, because it's the instance's, not the user's,and must not be merged between devices. It's cached in
localStorage(and mirrored to a fileon the phone, like the state) so it works offline. It refreshes at sign-in and when the app
comes back, at most once a minute.
helpers. New strings are in all 18 locales and
check-localespasses. The admin card is inEnglish, like the rest of the admin dashboard.
is lost.
Questions before I open a PR
catalogue-only?
equipment.jsonwith its own routes the right shape, or would you prefer itsomewhere else?
split it into two PRs (types + needs first, proposals and per-language names after).
Happy to adapt the design to whatever fits the project best.
All reactions