Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fac45f9af9 | ||
|
|
cd77cfdd84 | ||
|
|
e9bf38f39b |
No files matched your search
@@ -0,0 +1,60 @@
|
||||
# Publishes the browser-only demo to GitHub Pages: https://duartesantos8.github.io/openGym/
|
||||
#
|
||||
# Pages serves static files only, so this build has no backend — VITE_DEMO=1 makes the app
|
||||
# boot straight into guest mode with a seeded example history (see frontend/src/lib/demo.js).
|
||||
# The exercise images/GIFs (~140 MB) are never committed here; the demo build points at the
|
||||
# upstream dataset on jsDelivr instead, pinned to a commit so the CDN can cache it forever.
|
||||
name: Deploy demo to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
- '.github/workflows/pages.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DATASET: https://cdn.jsdelivr.net/gh/hasaneyldrm/exercises-dataset@7455efae41b330c265e7cd4b78dfa848e7ce5ebd
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
- run: npm ci
|
||||
working-directory: frontend
|
||||
- run: npm run build
|
||||
working-directory: frontend
|
||||
env:
|
||||
VITE_DEMO: '1'
|
||||
VITE_IMG_BASE: ${{ env.DATASET }}/images/
|
||||
VITE_GIF_BASE: ${{ env.DATASET }}/videos/
|
||||
- uses: actions/configure-pages@v5
|
||||
- uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: frontend/dist
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deploy.outputs.page_url }}
|
||||
steps:
|
||||
- id: deploy
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -1,5 +1,39 @@
|
||||
# Changelog
|
||||
|
||||
## v1.2.1 — 2026-07-23
|
||||
|
||||
A muscle map across the app, and a live demo you can try without installing anything.
|
||||
|
||||
- 💪 **Muscle map.** Three places now show which muscles your training actually reaches, drawn on a
|
||||
front-and-back body diagram shaded like the activity heatmap — more accent means more work.
|
||||
- **Stats → Muscle balance** aggregates a week, 30 days, 90 days or everything, lists your
|
||||
hardest-worked muscles with their set counts, and names the ones that got *nothing* in that
|
||||
period. That last list is the point of the card: the gaps are what you'd otherwise never notice.
|
||||
Tap any muscle to read its name and volume.
|
||||
- **Routine editor** previews what a session hits as you build it, so a hole in the plan shows up
|
||||
before you train around it for a month.
|
||||
- **The finish screen** shows what you just trained.
|
||||
- Load is counted in *effective sets* — a set counts fully for the exercise's target muscle and
|
||||
partially for its supporting ones — not in kilograms, because 100 kg of leg press and 12 kg of
|
||||
lateral raise say nothing about which muscle worked harder. Shading is relative within the
|
||||
period you're looking at, so the map always reads as a balance rather than an absolute.
|
||||
- Settings → Appearance → **Body diagram** switches between a male and female figure.
|
||||
- The exercise dataset spells muscles inconsistently ("delts", "deltoids" and "shoulders" are one
|
||||
muscle); all 50 spellings it uses are normalised onto the 18 the diagram can draw. Custom
|
||||
exercises, which only carry a body part, fall back to it. The geometry is ~90 kB and loads on
|
||||
demand, so the initial bundle is unchanged.
|
||||
- 🐛 **Fixed: finishing a workout from its last exercise could blank the whole app.** The
|
||||
per-exercise weight sheet read the running workout without checking it was still there, and
|
||||
finishing clears it while that sheet is still on screen.
|
||||
- ▶️ **Live demo** at [duartesantos8.github.io/openGym](https://duartesantos8.github.io/openGym/) —
|
||||
a browser-only build (`VITE_DEMO=1`) published to GitHub Pages on every push to `main`. It boots
|
||||
into guest mode with a seeded example profile (12 weeks of Push/Pull/Legs, weigh-ins, PRs) so
|
||||
every screen has something to show, and it never talks to a server. Passkeys, sync and the admin
|
||||
dashboard stay exclusive to self-hosted instances, which is where the backend lives.
|
||||
- 🖼️ Builds can point the exercise media elsewhere via `VITE_IMG_BASE` / `VITE_GIF_BASE` — the demo
|
||||
serves the ~140 MB dataset from a CDN instead of shipping it. The default (`img/` and `gif/` next
|
||||
to the app) is unchanged.
|
||||
|
||||
## v1.2.0 — 2026-07-23
|
||||
|
||||
A complete visual redesign. Same app, same data — every screen redrawn.
|
||||
|
||||
@@ -3,6 +3,38 @@
|
||||
openGym — Copyright (C) 2026 Duarte Santos.
|
||||
openGym's own code is licensed under the **GNU AGPL v3.0** (see [LICENSE](LICENSE)).
|
||||
|
||||
## Body diagram geometry
|
||||
|
||||
The muscle outlines the body maps are drawn from (`frontend/src/lib/body-paths.js`) are derived
|
||||
from [**MuscleMap**](https://github.com/melihcolpan/MuscleMap) by Melih Colpan, used under the
|
||||
**MIT License** and reproduced below. MuscleMap ships its path data as Swift source rather than
|
||||
`.svg` files; the paths were converted to a JSON module, its sub-group shapes were dropped, and
|
||||
nothing else about the artwork was changed.
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Melih Colpan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
## Exercise data & media
|
||||
|
||||
The exercise names, instructions (English in `frontend/src/lib/exercises-data.js`, other
|
||||
|
||||
@@ -37,6 +37,16 @@ No account on someone else's server, no subscription, no ads. Just `docker compo
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
### [▶ Try the live demo](https://duartesantos8.github.io/openGym/)
|
||||
|
||||
No signup, nothing to install — it runs entirely in your browser on example data.<br>
|
||||
<sub>There's no server behind the demo, so passkey sign-in, sync across devices and the
|
||||
admin dashboard only exist in a self-hosted instance.</sub>
|
||||
|
||||
</div>
|
||||
|
||||
## Why
|
||||
|
||||
Most workout apps lock your data behind a login on their servers, nag you to upgrade, or
|
||||
@@ -55,6 +65,7 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a
|
||||
- 🔧 **Filter by equipment** — narrow the library to what you actually own; the options adapt to what you've picked, so every combination on screen has results behind it
|
||||
- ✨ **Your own exercises** — a name and a body part is enough; they behave like built-in ones everywhere, with an optional description instead of an animation
|
||||
- 🟩 **Activity heatmap** — a GitHub-style year view, shaded by time spent training
|
||||
- 💪 **Muscle map** — a front-and-back body diagram shaded by how much work each muscle got, over a week, a month or all time. It names the muscles you *haven't* trained in that period, previews what a routine hits while you build it, and shows what you just trained when you finish. Male or female figure, your pick
|
||||
- 🔔 **Push notifications** — rest-timer alerts even with the app closed, plus an optional reminder on days you have a workout planned but haven't logged one. Opt in per profile; keys are generated on first run, nothing to configure
|
||||
- 🔑 **Passkeys, not passwords** — Face ID / Touch ID / fingerprint login; each profile keeps its own data, synced across devices
|
||||
- 🛠️ **Admin dashboard** (optional) — for whoever runs the instance: who's training right now, per-user history, disable accounts, and invite-only signup. Off by default, so a fresh instance stays open with no admin
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gym-api",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "server.js",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "opengym-frontend",
|
||||
"private": true,
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { MUSCLES, INERT, MUSCLE_NAME, levelsOf } from '../lib/muscles.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
|
||||
// Front and back views of a body, each muscle shaded by how hard it was worked.
|
||||
//
|
||||
// The five shade steps are the same ones the activity heatmap uses (.hm-c.l0…l4), so
|
||||
// "more accent = more training" means one thing everywhere in the app rather than two.
|
||||
//
|
||||
// The geometry is ~90 KB and only some screens show a map, so it is fetched on first
|
||||
// render instead of riding along in the main bundle. Until it lands the component
|
||||
// renders nothing but keeps its height, so nothing below it jumps on arrival.
|
||||
|
||||
let CACHE = null // shared across every mounted map
|
||||
let PENDING = null
|
||||
|
||||
function useBodyPaths() {
|
||||
const [paths, setPaths] = useState(CACHE)
|
||||
useEffect(() => {
|
||||
if (CACHE) return
|
||||
let alive = true
|
||||
PENDING = PENDING || import('../lib/body-paths.js').then(m => (CACHE = m.default))
|
||||
PENDING.then(p => { if (alive) setPaths(p) }).catch(() => {})
|
||||
return () => { alive = false }
|
||||
}, [])
|
||||
return paths
|
||||
}
|
||||
|
||||
function View({ view, levels, onMuscle, selected }) {
|
||||
return (
|
||||
<svg className="bm-v" viewBox={view.vb} role="img">
|
||||
{INERT.map(slug => (view.p[slug] || []).map((d, i) =>
|
||||
<path key={slug + i} className="bm-sil" d={d} />))}
|
||||
{MUSCLES.map(slug => (view.p[slug] || []).map((d, i) =>
|
||||
<path
|
||||
key={slug + i}
|
||||
className={'bm-m l' + (levels[slug] || 0) + (selected === slug ? ' sel' : '')}
|
||||
d={d}
|
||||
onClick={onMuscle ? () => onMuscle(slug) : undefined}
|
||||
>
|
||||
<title>{t(MUSCLE_NAME[slug])}</title>
|
||||
</path>))}
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* <BodyMap load={{ chest: 12, … }} body="male" />
|
||||
* `load` is effective sets per muscle (see lib/muscles.js); shading is relative to
|
||||
* the hardest-worked muscle in that same load, so it always reads as a balance.
|
||||
*/
|
||||
export default function BodyMap({ load = {}, body = 'male', onMuscle, selected, className = '' }) {
|
||||
const paths = useBodyPaths()
|
||||
const levels = levelsOf(load)
|
||||
const g = paths && (paths[body] || paths.male)
|
||||
return (
|
||||
<div className={'bodymap ' + className}>
|
||||
{g ? <>
|
||||
<View view={g.front} levels={levels} onMuscle={onMuscle} selected={selected} />
|
||||
<View view={g.back} levels={levels} onMuscle={onMuscle} selected={selected} />
|
||||
</> : <div className="bm-ph" aria-hidden="true" />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function BodyMapLegend() {
|
||||
return <div className="hm-legend">
|
||||
{t('Less')} <div className="hm-c l0" /><div className="hm-c l1" /><div className="hm-c l2" />
|
||||
<div className="hm-c l3" /><div className="hm-c l4" /> {t('More')}
|
||||
</div>
|
||||
}
|
||||
@@ -664,6 +664,38 @@ h4.sec{
|
||||
}
|
||||
.hm-legend .hm-c{width:10px;height:10px}
|
||||
|
||||
/* --- muscle map --- */
|
||||
/* Reuses the .hm-c level ramp above, so one accent scale means one thing app-wide. */
|
||||
/* An untrained muscle is derived from the text colour rather than a fixed surface, so
|
||||
the body keeps the same contrast in both themes — pinned to --surface-2 it was all
|
||||
but invisible on a white card. */
|
||||
.bodymap{
|
||||
display:flex;gap:6px;justify-content:center;align-items:flex-start;
|
||||
--bm-base:color-mix(in srgb,var(--label) 11%,var(--surface));
|
||||
}
|
||||
.bm-v{flex:1;min-width:0;height:auto;max-height:min(46vh,340px)}
|
||||
.bm-ph{height:200px} /* holds the space while the geometry loads */
|
||||
.bm-sil{fill:color-mix(in srgb,var(--label) 18%,var(--surface))}
|
||||
.bm-m{fill:var(--bm-base);transition:fill var(--med) var(--ease)}
|
||||
.bm-m.l1{fill:color-mix(in srgb,var(--acc) 32%,var(--bm-base))}
|
||||
.bm-m.l2{fill:color-mix(in srgb,var(--acc) 56%,var(--bm-base))}
|
||||
.bm-m.l3{fill:color-mix(in srgb,var(--acc) 78%,var(--bm-base))}
|
||||
.bm-m.l4{fill:var(--acc)}
|
||||
.bm-m.sel{stroke:var(--label);stroke-width:7}
|
||||
.bodymap.tappable .bm-m{cursor:pointer}
|
||||
/* A hairline in the surface colour separates neighbouring muscles; the artwork has no
|
||||
outline path of its own, so without this the body reads as one flat blob. */
|
||||
.bm-v path{stroke:var(--surface);stroke-width:2.5;stroke-linejoin:round}
|
||||
|
||||
.mrow{display:flex;align-items:center;gap:9px;padding:5px 0}
|
||||
.mrow .nm{flex:1;min-width:0;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.mrow .bar{width:74px;height:5px;border-radius:3px;background:var(--surface-2);flex:none;overflow:hidden}
|
||||
.mrow .bar i{display:block;height:100%;background:var(--acc);border-radius:3px}
|
||||
.mrow .v{font-size:12px;color:var(--label-2);min-width:52px;text-align:right;flex:none}
|
||||
.mchips{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
|
||||
.mchip{font-size:12px;padding:4px 9px;border-radius:99px;background:var(--surface-2);color:var(--label-2)}
|
||||
.mchip.miss{background:color-mix(in srgb,var(--orange) 16%,transparent);color:var(--orange)}
|
||||
|
||||
/* --- stat tiles --- */
|
||||
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
|
||||
.tile{background:var(--surface);border-radius:var(--r-card);padding:14px}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Body geometry — the SVG outlines every muscle map in the app is drawn from.
|
||||
//
|
||||
// Converted from MuscleMap by Melih Colpan (MIT), whose path data ships as Swift
|
||||
// source rather than .svg files; see NOTICE.md. Four views (male/female ×
|
||||
// front/back), each a viewBox plus one path list per body part. Parts that are
|
||||
// not muscles — head, hair, neck, hands, feet, knees, ankles — are drawn as the
|
||||
// silhouette and never take a heat colour; see INERT in lib/muscles.js.
|
||||
//
|
||||
// MuscleMap's sub-groups (upper-abs, lower-chest, outer-quad, front-deltoid …)
|
||||
// are dropped: the exercise dataset resolves to whole muscles, so shading a
|
||||
// sub-region would imply a precision the data does not have.
|
||||
//
|
||||
// ~90 KB, so this module is imported dynamically and only lands in the bundle
|
||||
// once a muscle map is actually shown. Generated — do not hand-edit.
|
||||
|
||||
export default {"male":{"front":{"vb":"0 95 727 1280","p":{"chest":["M272.91 422.84c-18.95-17.19-22-57-12.64-78.79 5.57-12.99 26.54-24.37 39.97-25.87q20.36-2.26 37.02.75c9.74 1.76 16.13 15.64 18.41 25.04 3.99 16.48 3.23 31.38 1.67 48.06q-1.35 14.35-2.05 16.89c-6.52 23.5-38.08 29.23-58.28 24.53-9.12-2.12-17.24-4.38-24.1-10.61z","M416.04 435c-15.12.11-34.46-6.78-41.37-21.48q-1.88-3.99-2.84-12.18c-2.89-24.41-5.9-53.65 8.44-74.79 4.26-6.26 10.49-7.93 18.36-8.56q11.66-.92 23.32-.35c10.58.53 18.02 2.74 26.62 7.87 12.81 7.65 19.73 14.52 22.67 29.75 4.94 25.57.24 64.14-28.21 74.97q-12.26 4.67-26.99 4.77z"],"abs":["M311.02 531.71a.23.23 0 01-.19-.21q-.39-10.47 1.9-20.76c1.26-5.69 7.66-9.9 13.1-12.9 9.09-5.01 18.93-11.15 28.56-14.92a1.24 1.21-42.6 01.94.03c3.28 1.52 4.78 3.87 4.82 7.68q.13 13.16-.15 26.31c-.08 3.85.78 8.39-.87 13.1q-.17.46-.59.72-2.65 1.65-4.29 1.82-21.06 2.22-43.23-.87z","M321 577.76c-5.17-.33-8.71-.44-10-6.26q-3.2-14.44-.59-27.83.11-.53.64-.63c7.58-1.44 13.62-2.45 22.45-4.56q11.5-2.76 23.94-1.88c3.67.26 3.3 3.46 3.4 6.21q.46 12.55-.33 26.94-.25 4.41-1.81 8.08-.21.49-.73.6-1.39.28-3.22.29-16.89.14-33.75-.96z","M347.73 429.25c7.46-3.61 10.5 6.27 10.99 11.52.48 5.06 3.46 30.61-2.78 32.93q-4.17 1.55-6.89 3.33-17.56 11.54-35.88 21.46a1.6 1.59-21.9 01-2.3-.98c-2.87-10.41-10.59-43.96 1.66-50.95 11.3-6.45 23.96-11.86 35.2-17.31z","M350.35 712.81c-29.15-9.93-37.98-100.69-39.47-126.61a.99.99 0 01.33-.8c3.58-3.26 27.61-1.47 34.62-.93 4.41.34 15.27 1.31 15.26 7.53-.05 40.77.64 82.05-1.96 122.72a1.29 1.29 0 01-1.86 1.08c-2.3-1.14-4.12-2.04-6.92-2.99z","M371.94 473.31c-5.46-2.59-2.97-24.26-2.77-29.56.25-6.8 2.41-18.63 12.64-13.8q16.26 7.67 32.34 15.72 6.18 3.1 7.13 10.05c.58 4.26 1.35 8.49 1.07 12.72q-.84 12.55-4.33 26.56-.54 2.16-1.1 3.44-.25.58-.81.31c-15.78-7.29-30.79-19.08-44.17-25.44z","M382.57 533.27c-4.17-.18-9.56-.3-13.15-2.69q-.17-.11-.24-.31c-1.82-5.55-.86-11.17-.96-15.66-.18-8.4-.78-17.36.06-25.71.29-2.85 1.88-4.42 4.15-5.79q.42-.26.91-.19 1.71.25 3.21 1.03 12.48 6.44 24.75 13.26c4.96 2.75 12.21 7.02 13.72 12.41q2.93 10.56 2.39 21.49a.77.76-1.8 01-.67.71q-16.89 2.18-34.17 1.45z","M373.75 578.69c-2.47 0-4.31.22-5-2.7-1.8-7.7-3.05-34.29-.19-38.81q.27-.43.77-.47 13.14-1.24 25.77 1.83c8.41 2.04 14.51 3.01 21.85 4.36a1.29 1.28.6 011.05 1.07q2.16 14.12-.73 28.07c-1.08 5.24-5.22 5.26-10.36 5.63q-14.26 1.04-33.16 1.02z","M416.32 584.73q1.14.41 1.07 1.62c-1.62 26.44-9.96 116.68-40.43 126.74-2.27.75-4.15 2.12-6.35 2.73q-1.18.33-1.3-.89-.86-9.2-1.06-17.75c-.83-35.67-.91-71.2-1.01-106.88q0-.5.31-.89c4.95-6.46 41.69-7.25 48.77-4.68z"],"biceps":["M189.52 492.51c-2.43.62-7.38.57-7.51-3.08-.56-16.01-.42-35.49 5.11-50.26 3.19-8.54 13.89-30.22 23.27-32.72 10.08-2.68 12.68 16.59 12.6 22.8-.22 15.98-7.51 34.79-15.05 48.71-4.29 7.94-9.95 12.38-18.42 14.55z","M526.69 486.31c-9.9-8.61-17.75-33.21-20.65-47.73-1.41-7.06-1.34-29.61 8.58-32.16 10.33-2.66 23.81 25.34 26.6 32.91q2.6 7.04 3.6 16.13 1.62 14.66 1.66 32.28c.03 11.04-16.45 1.48-19.79-1.43z"],"triceps":["M206.2 514.2c-5.41-.67-6.55-7.29-4.69-11.42 11.08-24.55 22.84-50.62 30.54-75.51 1.37-4.41 3.08-8.59 3.95-12.45q2.94-13.12 5.79-26.26.42-1.98 1.82-3.39a.52.52 0 01.81.1q1.04 1.69 1.94 4.56 4.63 14.65 5.15 24.92c.57 11.36-5.11 24.55-8.65 35.5q-7.69 23.78-20.25 45.39c-2.45 4.23-11.51 19.18-16.41 18.56z","M517.69 512.06c-20.07-22.12-28.95-51.73-38.01-79.03-3.27-9.87-3.58-19.18-1.34-29.38 1.29-5.88 2.49-13.03 5.61-18.52q.32-.57.72-.06 1.35 1.67 1.79 3.69c2.67 12.33 5.14 24.49 9.07 36.52 8.25 25.28 18.58 49.8 31.1 77.2q1.42 3.1 1.05 5.33c-.81 4.89-5.46 9.25-9.99 4.25z"],"deltoids":["M274.06 311.69q3.94 2.77 4.33 8.14.04.48-.38.73c-9.98 5.88-24.35 7.45-28.82 19.75-2.31 6.36-.97 17.35-1.43 23.68q-.55 7.51-5.73 14.07-10.37 13.11-13.81 16.67c-3.41 3.53-6.81 1.76-10.69-.47-15.42-8.87-24.95-25.45-22.52-43.22 2.05-14.92 12.71-25.79 24.06-35.02 16.99-13.82 35.58-17.99 54.99-4.33z","M450.39 320.75q-.95-.52-.7-1.58c1.57-6.61 5.8-9.1 12.14-11.9 24.99-11.03 43.76 3.33 60.17 20.74 20.73 21.99 11.81 56.44-14.82 68.19-4.41 1.94-6.79-1.03-9.81-4.51-5.81-6.7-13.46-14.12-15.99-22.8-3.93-13.43 4.32-27.54-9.64-37.62q-8.22-5.93-17.99-9.08-1.84-.59-3.36-1.44z"],"obliques":["M264.21 435.53c-4.88-3.13-5.75-12.11-5.39-17.36q.03-.53.51-.75 1.8-.84 3.43.85 10.05 10.45 22.57 16.9c3.64 1.89 5.54 3.62 4.79 7.8q-.42 2.35-2.82 1.87-12.45-2.49-23.09-9.31z","M287.33 452.44c-4.05 4.46-10.38 11.38-16.28 14.3a.84.83 51.1 01-.9-.1c-6.29-5.17-12.54-18.97-14.21-25.09q-.91-3.34.85-8.81.12-.39.35-.05c2.41 3.65 4.59 7.74 8.67 9.76q10.18 5.05 21.27 9.01a.61.61 0 01.25.98z","M297.3 487.82c-7.36-4.23-16.68-11.37-20.55-17.57q-.32-.5.09-.92 8.72-9.04 19.84-17.87 1.46-1.17 2.81-1.67a.44.44 0 01.59.43c-.28 10.08-.4 20.42.65 30.43q.34 3.26-.68 6.15a1.9 1.9 0 01-2.75 1.02z","M257.35 456.18l13.68 16.63a1.86 1.82 22.9 01.4.95c.59 5.4-2.02 12.71-3.8 17.56q-.3.84-.84.13-11.85-15.55-9.77-35.17.04-.45.33-.1z","M271.69 494.07a1.53 1.52-61.8 01-.49-1.64l4.2-13.58a.98.98 0 011.51-.5c3.2 2.32 21.89 14.05 22.26 16.7q1.15 8.32.66 16.79aLine truncated
|
||||
@@ -0,0 +1,14 @@
|
||||
// Demo build (VITE_DEMO=1) — what runs on the GitHub Pages deployment.
|
||||
//
|
||||
// Pages can only serve static files, so there is no API: passkey sign-in, per-profile sync
|
||||
// and the admin dashboard all need the Node backend and are simply not part of a demo build.
|
||||
// The app therefore stays in guest mode (everything in localStorage) and boots with a seeded
|
||||
// example history (demoSeed.js), so the charts, heatmap, streaks and "last time you lifted…"
|
||||
// pre-fills have something to show instead of an empty shell.
|
||||
//
|
||||
// Only these three constants are shared with normal builds: Vite replaces VITE_DEMO at build
|
||||
// time, so the demo-only UI folds away and the seed generator — imported dynamically — never
|
||||
// lands in a self-hosted bundle.
|
||||
export const DEMO = import.meta.env.VITE_DEMO === '1'
|
||||
export const DEMO_SEEDED = 'gym_demo_seeded_v1'
|
||||
export const REPO = 'https://github.com/DuarteSantos8/openGym'
|
||||
@@ -0,0 +1,108 @@
|
||||
// The example profile behind the demo build (see demo.js). Imported dynamically, so it stays
|
||||
// out of the bundle self-hosters ship.
|
||||
import { isoOf, uid } from './format.js'
|
||||
import { starterRoutines } from './starter.js'
|
||||
|
||||
// Starting weight and weekly increment per exercise of the starter plan (kg).
|
||||
// Chest dips are body-weight only here, so they log reps at 0 added weight.
|
||||
const PROG = {
|
||||
'0025': [60, 1.25], '0047': [45, 1], '0426': [20, 0.5], '0334': [10, 0.25], '0241': [25, 0.75], '0251': [0, 0],
|
||||
'2330': [50, 1.25], '0027': [50, 1], '1323': [45, 1], '0031': [30, 0.5], '0313': [12, 0.3],
|
||||
'0043': [70, 1.5], '0085': [60, 1.25], '0739': [120, 3], '0585': [45, 1], '0586': [40, 1], '0605': [60, 1.5]
|
||||
}
|
||||
const WEEKS = 12 // how much history to fabricate
|
||||
const BW_FROM = 82.4, BW_TO = 78.3 // body-weight trend across those weeks
|
||||
const TARGET_W = 77
|
||||
|
||||
// Deterministic PRNG — the demo should look the same on every visit and in screenshots.
|
||||
function rng(seed) {
|
||||
let a = seed >>> 0
|
||||
return () => {
|
||||
a = (a + 0x6d2b79f5) >>> 0
|
||||
let t = Math.imul(a ^ (a >>> 15), 1 | a)
|
||||
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
|
||||
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
|
||||
}
|
||||
}
|
||||
const round = (w, step) => Math.round(w / step) * step
|
||||
const at = (date, h, m) => { const d = new Date(date); d.setHours(h, m, 0, 0); return d.getTime() }
|
||||
|
||||
// A full example profile: 12 weeks of Mon/Wed/Fri sessions on the starter plan, with linear
|
||||
// progression, the odd missed session, and twice-weekly weigh-ins trending toward the goal.
|
||||
export function buildDemoState() {
|
||||
const rnd = rng(20260723)
|
||||
const [push, pull, legs] = starterRoutines()
|
||||
const byWeekday = { 1: push, 3: pull, 5: legs }
|
||||
|
||||
const nowH = new Date().getHours()
|
||||
const today = new Date(); today.setHours(12, 0, 0, 0)
|
||||
const start = new Date(today); start.setDate(start.getDate() - WEEKS * 7)
|
||||
|
||||
const workouts = []
|
||||
const bodyweight = []
|
||||
const exWeights = {}
|
||||
const best = {}
|
||||
|
||||
for (let d = new Date(start); d <= today; d.setDate(d.getDate() + 1)) {
|
||||
const day = new Date(d)
|
||||
const iso = isoOf(day)
|
||||
const weekIdx = Math.floor((day - start) / (7 * 86400000))
|
||||
const p = Math.min(1, weekIdx / WEEKS)
|
||||
|
||||
// weigh-ins: Monday and Thursday mornings
|
||||
if (day.getDay() === 1 || day.getDay() === 4) {
|
||||
const w = BW_FROM + (BW_TO - BW_FROM) * p + (rnd() - 0.5) * 0.7
|
||||
bodyweight.push({ d: iso, w: Math.round(w * 10) / 10, t: at(day, 7, 30) })
|
||||
}
|
||||
|
||||
const routine = byWeekday[day.getDay()]
|
||||
if (!routine) continue
|
||||
if (rnd() < 0.09) continue // life happens — a few missed sessions
|
||||
if (iso === isoOf(today) && nowH < 18) continue // leave today's session to try out, unless it's already evening
|
||||
|
||||
const prs = []
|
||||
const entries = routine.ex.map(cfg => {
|
||||
const [base, inc] = PROG[cfg.id] || [20, 0.5]
|
||||
const step = base >= 40 ? 2.5 : 1.25
|
||||
const w = base ? Math.max(step, round(base + inc * weekIdx, step)) : 0
|
||||
const sets = []
|
||||
for (let i = 0; i < cfg.sets; i++) {
|
||||
// last set is where reps usually start slipping
|
||||
const drop = i === cfg.sets - 1 && rnd() < 0.55 ? (rnd() < 0.4 ? 2 : 1) : 0
|
||||
sets.push({ w, r: Math.max(4, cfg.reps - drop), done: true })
|
||||
}
|
||||
if (w > (best[cfg.id] || 0)) { best[cfg.id] = w; prs.push(cfg.id) }
|
||||
exWeights[cfg.id] = { w: Math.max(w, exWeights[cfg.id]?.w || 0), d: iso }
|
||||
return { id: cfg.id, sets, topW: w || null }
|
||||
})
|
||||
|
||||
const bw = bodyweight.length ? bodyweight[bodyweight.length - 1].w : BW_FROM
|
||||
const startMs = at(day, 18, 5 + Math.floor(rnd() * 25))
|
||||
const w = {
|
||||
id: uid(), d: iso, start: startMs, end: startMs + (46 + Math.floor(rnd() * 26)) * 60000,
|
||||
routineId: routine.id, name: routine.name, bw,
|
||||
entries,
|
||||
prs: weekIdx === 0 ? [] : prs // the very first session isn't a PR party
|
||||
}
|
||||
w.vol = entries.reduce((v, e) => v + e.sets.reduce((n, s) => n + s.w * s.r, 0), 0)
|
||||
workouts.push(w)
|
||||
}
|
||||
|
||||
// A visitor should always have something to press "Start" on, so if they land on a rest day
|
||||
// the next routine in the rotation is moved onto today — which also shows off rescheduling.
|
||||
const dayPlan = {}
|
||||
const tIso = isoOf(today)
|
||||
if (!byWeekday[today.getDay()] && !workouts.some(w => w.d === tIso)) {
|
||||
const order = [push, pull, legs]
|
||||
const lastName = workouts.length ? workouts[workouts.length - 1].name : legs.name
|
||||
dayPlan[tIso] = order[(order.findIndex(r => r.name === lastName) + 1) % order.length].id
|
||||
}
|
||||
|
||||
return {
|
||||
routines: [push, pull, legs],
|
||||
week: { 1: push.id, 3: pull.id, 5: legs.id },
|
||||
dayPlan,
|
||||
workouts, bodyweight, exWeights,
|
||||
targetW: TARGET_W
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,13 @@ export function registerCustom(list) {
|
||||
// Full searchable catalogue — customs first so your own exercises are easy to find.
|
||||
export const allExercises = st => [...(st.customEx || []), ...EXDB]
|
||||
|
||||
export const imgSrc = ex => 'img/' + ex.img
|
||||
export const gifSrc = ex => 'gif/' + ex.gif
|
||||
// Media normally sits next to the app (img/ and gif/, mounted into the web container).
|
||||
// A build can point them somewhere else — the demo build pulls them off a CDN instead of
|
||||
// shipping ~140 MB of images into the deployment.
|
||||
const IMG_BASE = import.meta.env.VITE_IMG_BASE || 'img/'
|
||||
const GIF_BASE = import.meta.env.VITE_GIF_BASE || 'gif/'
|
||||
export const imgSrc = ex => IMG_BASE + ex.img
|
||||
export const gifSrc = ex => GIF_BASE + ex.gif
|
||||
|
||||
// Cardio exercises log time + speed instead of weight × reps.
|
||||
export const isCardio = idOrEx => (typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.bp === 'cardio'
|
||||
@@ -0,0 +1,136 @@
|
||||
// Which muscles an exercise trains, and how hard — the data behind every muscle map.
|
||||
//
|
||||
// The exercise dataset names muscles in free text and is not consistent about it:
|
||||
// "shoulders", "deltoids" and "delts" are the same thing, so are "quads" and
|
||||
// "quadriceps", "lats" and "latissimus dorsi", "core" and "abdominals". Nineteen
|
||||
// primary and forty secondary spellings collapse onto the eighteen muscles the body
|
||||
// map can actually draw, via ALIAS below. Anything genuinely undrawable (hands,
|
||||
// ankles, "cardiovascular system") maps to null and is dropped rather than guessed at.
|
||||
|
||||
import { EXIDX } from './exercises.js'
|
||||
|
||||
// The muscles a map can shade, in head-to-toe order — also the order of any list
|
||||
// built from them, so "what am I neglecting" reads top-down like a body.
|
||||
export const MUSCLES = [
|
||||
'trapezius', 'deltoids', 'chest', 'upper-back', 'serratus',
|
||||
'biceps', 'triceps', 'forearm',
|
||||
'abs', 'obliques', 'lower-back',
|
||||
'gluteal', 'quadriceps', 'hamstring', 'adductors', 'hip-flexors',
|
||||
'calves', 'tibialis',
|
||||
]
|
||||
|
||||
// Drawn as the silhouette, never shaded: they carry no training load.
|
||||
export const INERT = ['head', 'hair', 'neck', 'hands', 'feet', 'knees', 'ankles']
|
||||
|
||||
// English display names; these strings are the i18n keys (see lib/i18n.js).
|
||||
export const MUSCLE_NAME = {
|
||||
trapezius: 'Traps', deltoids: 'Shoulders', chest: 'Chest', 'upper-back': 'Upper back',
|
||||
serratus: 'Serratus', biceps: 'Biceps', triceps: 'Triceps', forearm: 'Forearms',
|
||||
abs: 'Abs', obliques: 'Obliques', 'lower-back': 'Lower back', gluteal: 'Glutes',
|
||||
quadriceps: 'Quads', hamstring: 'Hamstrings', adductors: 'Adductors',
|
||||
'hip-flexors': 'Hip flexors', calves: 'Calves', tibialis: 'Shins',
|
||||
}
|
||||
|
||||
// Every spelling that occurs in the dataset's `tg` and `sm` fields. null = not drawable.
|
||||
const ALIAS = {
|
||||
// primaries
|
||||
abs: 'abs', pectorals: 'chest', biceps: 'biceps', glutes: 'gluteal', delts: 'deltoids',
|
||||
triceps: 'triceps', 'upper back': 'upper-back', lats: 'upper-back', calves: 'calves',
|
||||
quads: 'quadriceps', forearms: 'forearm', hamstrings: 'hamstring', spine: 'lower-back',
|
||||
traps: 'trapezius', adductors: 'adductors', 'serratus anterior': 'serratus',
|
||||
abductors: 'gluteal', 'levator scapulae': 'trapezius', 'cardiovascular system': null,
|
||||
// secondaries
|
||||
shoulders: 'deltoids', deltoids: 'deltoids', 'rear deltoids': 'deltoids',
|
||||
'rotator cuff': 'deltoids', quadriceps: 'quadriceps', core: 'abs', abdominals: 'abs',
|
||||
'lower abs': 'abs', chest: 'chest', 'upper chest': 'chest', 'hip flexors': 'hip-flexors',
|
||||
obliques: 'obliques', 'lower back': 'lower-back', rhomboids: 'upper-back',
|
||||
trapezius: 'trapezius', back: 'upper-back', 'latissimus dorsi': 'upper-back',
|
||||
brachialis: 'biceps', soleus: 'calves', shins: 'tibialis', wrists: 'forearm',
|
||||
'wrist flexors': 'forearm', 'wrist extensors': 'forearm', 'grip muscles': 'forearm',
|
||||
groin: 'adductors', 'inner thighs': 'adductors',
|
||||
ankles: null, feet: null, hands: null, 'ankle stabilizers': null,
|
||||
sternocleidomastoid: null,
|
||||
}
|
||||
|
||||
// Custom exercises carry only a body part, so they fall back to it. Weights inside a
|
||||
// group sum to 1 — "upper legs" spreads over three muscles rather than counting triple.
|
||||
const BY_BODYPART = {
|
||||
chest: { chest: 1 },
|
||||
back: { 'upper-back': 0.75, 'lower-back': 0.25 },
|
||||
shoulders: { deltoids: 1 },
|
||||
'upper arms': { biceps: 0.5, triceps: 0.5 },
|
||||
'lower arms': { forearm: 1 },
|
||||
waist: { abs: 0.7, obliques: 0.3 },
|
||||
'upper legs': { quadriceps: 0.4, hamstring: 0.35, gluteal: 0.25 },
|
||||
'lower legs': { calves: 0.8, tibialis: 0.2 },
|
||||
neck: { trapezius: 1 },
|
||||
cardio: {},
|
||||
}
|
||||
|
||||
const SECONDARY = 0.4 // a supporting muscle counts this much against a primary
|
||||
|
||||
/** Muscles one exercise trains: { slug: 0…1 }. */
|
||||
export function musclesOf(ex) {
|
||||
if (!ex) return {}
|
||||
const out = {}
|
||||
const add = (name, w) => {
|
||||
const slug = ALIAS[String(name || '').toLowerCase().trim()]
|
||||
if (slug) out[slug] = Math.max(out[slug] || 0, w)
|
||||
}
|
||||
add(ex.tg, 1)
|
||||
;(ex.sm || []).forEach(m => add(m, SECONDARY))
|
||||
// Nothing recognised (custom exercises, or a target we don't draw) — use the body part.
|
||||
if (!Object.keys(out).length) Object.assign(out, BY_BODYPART[ex.bp] || {})
|
||||
return out
|
||||
}
|
||||
|
||||
/**
|
||||
* Training load per muscle, in "effective sets".
|
||||
* `items` is [{ id, sets }] — sets being a count, so a 4×8 bench press weighs four
|
||||
* times a single set. Volume in kg is deliberately not used: 100 kg of leg press
|
||||
* against 12 kg of lateral raise says nothing about which muscle worked harder.
|
||||
*/
|
||||
export function loadOf(items) {
|
||||
const load = {}
|
||||
items.forEach(({ id, sets }) => {
|
||||
if (!sets) return
|
||||
const m = musclesOf(EXIDX[id])
|
||||
for (const slug in m) load[slug] = (load[slug] || 0) + m[slug] * sets
|
||||
})
|
||||
return load
|
||||
}
|
||||
|
||||
/** Load for finished workouts (only sets actually ticked off count). */
|
||||
export const loadOfWorkouts = workouts =>
|
||||
loadOf((workouts || []).flatMap(w =>
|
||||
(w.entries || []).map(e => ({ id: e.id, sets: (e.sets || []).filter(s => s.done).length }))))
|
||||
|
||||
/** Load a routine *would* produce, from its planned set counts. */
|
||||
export const loadOfRoutine = routine =>
|
||||
loadOf((routine?.ex || []).map(c => ({ id: c.id, sets: c.sets || 1 })))
|
||||
|
||||
/** Load for a workout still in progress — the sets ticked so far. */
|
||||
export const loadOfActive = active =>
|
||||
loadOf((active?.entries || []).map(e => ({ id: e.id, sets: (e.sets || []).filter(s => s.done).length })))
|
||||
|
||||
/**
|
||||
* Shade buckets 0–4 per muscle, relative to the hardest-worked muscle in the same
|
||||
* window. Relative rather than absolute on purpose: the map answers "is my training
|
||||
* balanced", which only means anything as a comparison within one period.
|
||||
*/
|
||||
export function levelsOf(load) {
|
||||
const max = Math.max(0, ...MUSCLES.map(m => load[m] || 0))
|
||||
const lv = {}
|
||||
MUSCLES.forEach(m => {
|
||||
const v = load[m] || 0
|
||||
lv[m] = !v ? 0 : max <= 0 ? 0 : Math.max(1, Math.min(4, Math.ceil(v / max * 4)))
|
||||
})
|
||||
return lv
|
||||
}
|
||||
|
||||
/** Muscles sorted hardest-worked first; untrained ones last, in body order. */
|
||||
export function rankOf(load) {
|
||||
const worked = MUSCLES.filter(m => (load[m] || 0) > 0).sort((a, b) => load[b] - load[a])
|
||||
const missed = MUSCLES.filter(m => !(load[m] > 0))
|
||||
return { worked, missed }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// The Push/Pull/Legs starter plan. Shared by the "Load starter plan" action in Settings
|
||||
// and by the demo build, which seeds a history on top of exactly these routines.
|
||||
import { uid } from './format.js'
|
||||
|
||||
const SPEC = [
|
||||
['Push Day', 'barbell', [['0025', 4, 8], ['0047', 3, 10], ['0426', 3, 10], ['0334', 3, 12], ['0241', 3, 12], ['0251', 3, 10]]],
|
||||
['Pull Day', 'pullup', [['2330', 4, 10], ['0027', 4, 8], ['1323', 3, 10], ['0031', 3, 10], ['0313', 3, 12]]],
|
||||
['Leg Day', 'legs', [['0043', 4, 8], ['0085', 3, 10], ['0739', 3, 12], ['0585', 3, 12], ['0586', 3, 12], ['0605', 4, 15]]]
|
||||
]
|
||||
|
||||
// Fresh routine objects (new ids) — [push, pull, legs].
|
||||
export const starterRoutines = () =>
|
||||
SPEC.map(([name, emoji, list]) => ({ id: uid(), name, emoji, ex: list.map(([id, sets, reps]) => ({ id, sets, reps, weight: 0 })) }))
|
||||
@@ -365,5 +365,38 @@ export default {
|
||||
'Invite code': 'Einladungscode',
|
||||
'This app is invite-only — enter the code you were given.': 'Diese App ist nur mit Einladung — gib den Code ein, den du erhalten hast.',
|
||||
'An invite code is required': 'Ein Einladungscode ist erforderlich',
|
||||
'Admin dashboard': 'Admin-Dashboard'
|
||||
'Admin dashboard': 'Admin-Dashboard',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Muskelbalance',
|
||||
'by sets worked': 'nach Sätzen',
|
||||
'Week': 'Woche',
|
||||
'not trained': 'nicht trainiert',
|
||||
'Not trained in this period': 'In diesem Zeitraum nicht trainiert',
|
||||
'Every muscle group got some work in this period.': 'Jede Muskelgruppe hat in diesem Zeitraum etwas abbekommen.',
|
||||
'No workouts in this period yet.': 'Noch keine Trainings in diesem Zeitraum.',
|
||||
'What this session hits': 'Was dieses Training trifft',
|
||||
'What you just trained': 'Was du gerade trainiert hast',
|
||||
'Body diagram': 'Körperdiagramm',
|
||||
'Male': 'Männlich',
|
||||
'Female': 'Weiblich',
|
||||
'Less': 'Weniger',
|
||||
'More': 'Mehr',
|
||||
'Traps': 'Trapez',
|
||||
'Shoulders': 'Schultern',
|
||||
'Chest': 'Brust',
|
||||
'Upper back': 'Oberer Rücken',
|
||||
'Serratus': 'Sägemuskel',
|
||||
'Biceps': 'Bizeps',
|
||||
'Triceps': 'Trizeps',
|
||||
'Forearms': 'Unterarme',
|
||||
'Abs': 'Bauch',
|
||||
'Obliques': 'Schräge Bauchmuskeln',
|
||||
'Lower back': 'Unterer Rücken',
|
||||
'Glutes': 'Gesäß',
|
||||
'Quads': 'Quadrizeps',
|
||||
'Hamstrings': 'Beinbeuger',
|
||||
'Adductors': 'Adduktoren',
|
||||
'Hip flexors': 'Hüftbeuger',
|
||||
'Calves': 'Waden',
|
||||
'Shins': 'Schienbein'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Código de invitación',
|
||||
'This app is invite-only — enter the code you were given.': 'Esta app es solo por invitación: introduce el código que te dieron.',
|
||||
'An invite code is required': 'Se requiere un código de invitación',
|
||||
'Admin dashboard': 'Panel de administración'
|
||||
'Admin dashboard': 'Panel de administración',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Equilibrio muscular',
|
||||
'by sets worked': 'por series trabajadas',
|
||||
'Week': 'Semana',
|
||||
'not trained': 'sin entrenar',
|
||||
'Not trained in this period': 'Sin entrenar en este periodo',
|
||||
'Every muscle group got some work in this period.': 'Todos los grupos musculares recibieron algo de trabajo en este periodo.',
|
||||
'No workouts in this period yet.': 'Aún no hay entrenamientos en este periodo.',
|
||||
'What this session hits': 'Qué trabaja esta sesión',
|
||||
'What you just trained': 'Lo que acabas de entrenar',
|
||||
'Body diagram': 'Diagrama corporal',
|
||||
'Male': 'Masculino',
|
||||
'Female': 'Femenino',
|
||||
'Less': 'Menos',
|
||||
'More': 'Más',
|
||||
'Traps': 'Trapecio',
|
||||
'Shoulders': 'Hombros',
|
||||
'Chest': 'Pecho',
|
||||
'Upper back': 'Espalda alta',
|
||||
'Serratus': 'Serrato',
|
||||
'Biceps': 'Bíceps',
|
||||
'Triceps': 'Tríceps',
|
||||
'Forearms': 'Antebrazos',
|
||||
'Abs': 'Abdominales',
|
||||
'Obliques': 'Oblicuos',
|
||||
'Lower back': 'Espalda baja',
|
||||
'Glutes': 'Glúteos',
|
||||
'Quads': 'Cuádriceps',
|
||||
'Hamstrings': 'Isquiotibiales',
|
||||
'Adductors': 'Aductores',
|
||||
'Hip flexors': 'Flexores de cadera',
|
||||
'Calves': 'Gemelos',
|
||||
'Shins': 'Tibiales'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Code d’invitation',
|
||||
'This app is invite-only — enter the code you were given.': 'Cette appli est sur invitation — saisissez le code qu’on vous a donné.',
|
||||
'An invite code is required': 'Un code d’invitation est requis',
|
||||
'Admin dashboard': 'Tableau d’administration'
|
||||
'Admin dashboard': 'Tableau d’administration',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Équilibre musculaire',
|
||||
'by sets worked': 'par séries effectuées',
|
||||
'Week': 'Semaine',
|
||||
'not trained': 'non travaillé',
|
||||
'Not trained in this period': 'Non travaillé sur cette période',
|
||||
'Every muscle group got some work in this period.': 'Chaque groupe musculaire a été sollicité sur cette période.',
|
||||
'No workouts in this period yet.': 'Pas encore d\'entraînement sur cette période.',
|
||||
'What this session hits': 'Ce que cette séance sollicite',
|
||||
'What you just trained': 'Ce que tu viens de travailler',
|
||||
'Body diagram': 'Schéma du corps',
|
||||
'Male': 'Homme',
|
||||
'Female': 'Femme',
|
||||
'Less': 'Moins',
|
||||
'More': 'Plus',
|
||||
'Traps': 'Trapèzes',
|
||||
'Shoulders': 'Épaules',
|
||||
'Chest': 'Pectoraux',
|
||||
'Upper back': 'Haut du dos',
|
||||
'Serratus': 'Dentelé',
|
||||
'Biceps': 'Biceps',
|
||||
'Triceps': 'Triceps',
|
||||
'Forearms': 'Avant-bras',
|
||||
'Abs': 'Abdominaux',
|
||||
'Obliques': 'Obliques',
|
||||
'Lower back': 'Bas du dos',
|
||||
'Glutes': 'Fessiers',
|
||||
'Quads': 'Quadriceps',
|
||||
'Hamstrings': 'Ischio-jambiers',
|
||||
'Adductors': 'Adducteurs',
|
||||
'Hip flexors': 'Fléchisseurs de hanche',
|
||||
'Calves': 'Mollets',
|
||||
'Shins': 'Tibiaux'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'इनवाइट कोड',
|
||||
'This app is invite-only — enter the code you were given.': 'यह ऐप केवल इनवाइट से है — आपको दिया गया कोड डालें।',
|
||||
'An invite code is required': 'एक इनवाइट कोड आवश्यक है',
|
||||
'Admin dashboard': 'एडमिन डैशबोर्ड'
|
||||
'Admin dashboard': 'एडमिन डैशबोर्ड',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'मांसपेशी संतुलन',
|
||||
'by sets worked': 'सेट के अनुसार',
|
||||
'Week': 'सप्ताह',
|
||||
'not trained': 'प्रशिक्षित नहीं',
|
||||
'Not trained in this period': 'इस अवधि में प्रशिक्षित नहीं',
|
||||
'Every muscle group got some work in this period.': 'इस अवधि में हर मांसपेशी समूह पर काम हुआ।',
|
||||
'No workouts in this period yet.': 'इस अवधि में अभी कोई वर्कआउट नहीं।',
|
||||
'What this session hits': 'यह सत्र क्या ट्रेन करता है',
|
||||
'What you just trained': 'आपने अभी क्या ट्रेन किया',
|
||||
'Body diagram': 'शरीर आरेख',
|
||||
'Male': 'पुरुष',
|
||||
'Female': 'महिला',
|
||||
'Less': 'कम',
|
||||
'More': 'अधिक',
|
||||
'Traps': 'ट्रैपेज़ियस',
|
||||
'Shoulders': 'कंधे',
|
||||
'Chest': 'छाती',
|
||||
'Upper back': 'ऊपरी पीठ',
|
||||
'Serratus': 'सेरेटस',
|
||||
'Biceps': 'बाइसेप्स',
|
||||
'Triceps': 'ट्राइसेप्स',
|
||||
'Forearms': 'अग्रभुजा',
|
||||
'Abs': 'एब्स',
|
||||
'Obliques': 'तिरछी मांसपेशियाँ',
|
||||
'Lower back': 'निचली पीठ',
|
||||
'Glutes': 'ग्लूट्स',
|
||||
'Quads': 'क्वाड्स',
|
||||
'Hamstrings': 'हैमस्ट्रिंग',
|
||||
'Adductors': 'एडक्टर',
|
||||
'Hip flexors': 'हिप फ्लेक्सर',
|
||||
'Calves': 'पिंडली',
|
||||
'Shins': 'पिंडली की हड्डी'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Codice di invito',
|
||||
'This app is invite-only — enter the code you were given.': 'Questa app è solo su invito: inserisci il codice che hai ricevuto.',
|
||||
'An invite code is required': 'È richiesto un codice di invito',
|
||||
'Admin dashboard': 'Pannello di amministrazione'
|
||||
'Admin dashboard': 'Pannello di amministrazione',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Equilibrio muscolare',
|
||||
'by sets worked': 'per serie svolte',
|
||||
'Week': 'Settimana',
|
||||
'not trained': 'non allenato',
|
||||
'Not trained in this period': 'Non allenati in questo periodo',
|
||||
'Every muscle group got some work in this period.': 'Ogni gruppo muscolare ha lavorato in questo periodo.',
|
||||
'No workouts in this period yet.': 'Ancora nessun allenamento in questo periodo.',
|
||||
'What this session hits': 'Cosa allena questa sessione',
|
||||
'What you just trained': 'Cosa hai appena allenato',
|
||||
'Body diagram': 'Diagramma del corpo',
|
||||
'Male': 'Uomo',
|
||||
'Female': 'Donna',
|
||||
'Less': 'Meno',
|
||||
'More': 'Più',
|
||||
'Traps': 'Trapezio',
|
||||
'Shoulders': 'Spalle',
|
||||
'Chest': 'Petto',
|
||||
'Upper back': 'Dorsali',
|
||||
'Serratus': 'Dentato',
|
||||
'Biceps': 'Bicipiti',
|
||||
'Triceps': 'Tricipiti',
|
||||
'Forearms': 'Avambracci',
|
||||
'Abs': 'Addominali',
|
||||
'Obliques': 'Obliqui',
|
||||
'Lower back': 'Lombari',
|
||||
'Glutes': 'Glutei',
|
||||
'Quads': 'Quadricipiti',
|
||||
'Hamstrings': 'Femorali',
|
||||
'Adductors': 'Adduttori',
|
||||
'Hip flexors': 'Flessori dell\'anca',
|
||||
'Calves': 'Polpacci',
|
||||
'Shins': 'Tibiali'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': '초대 코드',
|
||||
'This app is invite-only — enter the code you were given.': '이 앱은 초대 전용입니다 — 받은 코드를 입력하세요.',
|
||||
'An invite code is required': '초대 코드가 필요합니다',
|
||||
'Admin dashboard': '관리자 대시보드'
|
||||
'Admin dashboard': '관리자 대시보드',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': '근육 균형',
|
||||
'by sets worked': '세트 수 기준',
|
||||
'Week': '이번 주',
|
||||
'not trained': '훈련 안 함',
|
||||
'Not trained in this period': '이 기간에 훈련하지 않음',
|
||||
'Every muscle group got some work in this period.': '이 기간에 모든 근육군을 훈련했습니다.',
|
||||
'No workouts in this period yet.': '이 기간에 아직 운동이 없습니다.',
|
||||
'What this session hits': '이 세션이 자극하는 부위',
|
||||
'What you just trained': '방금 훈련한 부위',
|
||||
'Body diagram': '신체 도해',
|
||||
'Male': '남성',
|
||||
'Female': '여성',
|
||||
'Less': '적음',
|
||||
'More': '많음',
|
||||
'Traps': '승모근',
|
||||
'Shoulders': '어깨',
|
||||
'Chest': '가슴',
|
||||
'Upper back': '등 상부',
|
||||
'Serratus': '전거근',
|
||||
'Biceps': '이두근',
|
||||
'Triceps': '삼두근',
|
||||
'Forearms': '전완근',
|
||||
'Abs': '복근',
|
||||
'Obliques': '복사근',
|
||||
'Lower back': '허리',
|
||||
'Glutes': '둔근',
|
||||
'Quads': '대퇴사두근',
|
||||
'Hamstrings': '햄스트링',
|
||||
'Adductors': '내전근',
|
||||
'Hip flexors': '고관절 굴곡근',
|
||||
'Calves': '종아리',
|
||||
'Shins': '정강이'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Kod zaproszenia',
|
||||
'This app is invite-only — enter the code you were given.': 'Ta aplikacja jest tylko na zaproszenie — wpisz otrzymany kod.',
|
||||
'An invite code is required': 'Wymagany jest kod zaproszenia',
|
||||
'Admin dashboard': 'Panel administratora'
|
||||
'Admin dashboard': 'Panel administratora',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Równowaga mięśniowa',
|
||||
'by sets worked': 'wg serii',
|
||||
'Week': 'Tydzień',
|
||||
'not trained': 'nietrenowane',
|
||||
'Not trained in this period': 'Nietrenowane w tym okresie',
|
||||
'Every muscle group got some work in this period.': 'Każda grupa mięśniowa dostała pracę w tym okresie.',
|
||||
'No workouts in this period yet.': 'Brak treningów w tym okresie.',
|
||||
'What this session hits': 'Co trenuje ta sesja',
|
||||
'What you just trained': 'Co właśnie wytrenowałeś',
|
||||
'Body diagram': 'Diagram ciała',
|
||||
'Male': 'Mężczyzna',
|
||||
'Female': 'Kobieta',
|
||||
'Less': 'Mniej',
|
||||
'More': 'Więcej',
|
||||
'Traps': 'Czworoboczne',
|
||||
'Shoulders': 'Barki',
|
||||
'Chest': 'Klatka piersiowa',
|
||||
'Upper back': 'Górne plecy',
|
||||
'Serratus': 'Zębaty',
|
||||
'Biceps': 'Biceps',
|
||||
'Triceps': 'Triceps',
|
||||
'Forearms': 'Przedramiona',
|
||||
'Abs': 'Brzuch',
|
||||
'Obliques': 'Skośne',
|
||||
'Lower back': 'Dolne plecy',
|
||||
'Glutes': 'Pośladki',
|
||||
'Quads': 'Czworogłowe',
|
||||
'Hamstrings': 'Dwugłowe uda',
|
||||
'Adductors': 'Przywodziciele',
|
||||
'Hip flexors': 'Zginacze bioder',
|
||||
'Calves': 'Łydki',
|
||||
'Shins': 'Piszczele'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Código de convite',
|
||||
'This app is invite-only — enter the code you were given.': 'Esta app é só por convite — introduz o código que recebeste.',
|
||||
'An invite code is required': 'É necessário um código de convite',
|
||||
'Admin dashboard': 'Painel de administração'
|
||||
'Admin dashboard': 'Painel de administração',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Equilíbrio muscular',
|
||||
'by sets worked': 'por séries trabalhadas',
|
||||
'Week': 'Semana',
|
||||
'not trained': 'sem treino',
|
||||
'Not trained in this period': 'Sem treino neste período',
|
||||
'Every muscle group got some work in this period.': 'Todos os grupos musculares foram trabalhados neste período.',
|
||||
'No workouts in this period yet.': 'Ainda sem treinos neste período.',
|
||||
'What this session hits': 'O que esta sessão trabalha',
|
||||
'What you just trained': 'O que acabaste de treinar',
|
||||
'Body diagram': 'Diagrama do corpo',
|
||||
'Male': 'Masculino',
|
||||
'Female': 'Feminino',
|
||||
'Less': 'Menos',
|
||||
'More': 'Mais',
|
||||
'Traps': 'Trapézio',
|
||||
'Shoulders': 'Ombros',
|
||||
'Chest': 'Peito',
|
||||
'Upper back': 'Costas superiores',
|
||||
'Serratus': 'Serrátil',
|
||||
'Biceps': 'Bíceps',
|
||||
'Triceps': 'Tríceps',
|
||||
'Forearms': 'Antebraços',
|
||||
'Abs': 'Abdominais',
|
||||
'Obliques': 'Oblíquos',
|
||||
'Lower back': 'Lombar',
|
||||
'Glutes': 'Glúteos',
|
||||
'Quads': 'Quadríceps',
|
||||
'Hamstrings': 'Isquiotibiais',
|
||||
'Adductors': 'Adutores',
|
||||
'Hip flexors': 'Flexores do quadril',
|
||||
'Calves': 'Panturrilhas',
|
||||
'Shins': 'Tibiais'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Код приглашения',
|
||||
'This app is invite-only — enter the code you were given.': 'Приложение только по приглашению — введите выданный вам код.',
|
||||
'An invite code is required': 'Требуется код приглашения',
|
||||
'Admin dashboard': 'Панель администратора'
|
||||
'Admin dashboard': 'Панель администратора',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Баланс мышц',
|
||||
'by sets worked': 'по подходам',
|
||||
'Week': 'Неделя',
|
||||
'not trained': 'не тренировалась',
|
||||
'Not trained in this period': 'Не тренировались за этот период',
|
||||
'Every muscle group got some work in this period.': 'За этот период поработали все группы мышц.',
|
||||
'No workouts in this period yet.': 'В этом периоде ещё нет тренировок.',
|
||||
'What this session hits': 'Что задействует эта тренировка',
|
||||
'What you just trained': 'Что вы только что тренировали',
|
||||
'Body diagram': 'Схема тела',
|
||||
'Male': 'Мужской',
|
||||
'Female': 'Женский',
|
||||
'Less': 'Меньше',
|
||||
'More': 'Больше',
|
||||
'Traps': 'Трапеции',
|
||||
'Shoulders': 'Плечи',
|
||||
'Chest': 'Грудь',
|
||||
'Upper back': 'Верх спины',
|
||||
'Serratus': 'Зубчатая мышца',
|
||||
'Biceps': 'Бицепс',
|
||||
'Triceps': 'Трицепс',
|
||||
'Forearms': 'Предплечья',
|
||||
'Abs': 'Пресс',
|
||||
'Obliques': 'Косые мышцы',
|
||||
'Lower back': 'Поясница',
|
||||
'Glutes': 'Ягодицы',
|
||||
'Quads': 'Квадрицепс',
|
||||
'Hamstrings': 'Бицепс бедра',
|
||||
'Adductors': 'Приводящие',
|
||||
'Hip flexors': 'Сгибатели бедра',
|
||||
'Calves': 'Икры',
|
||||
'Shins': 'Голени'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': 'Davet kodu',
|
||||
'This app is invite-only — enter the code you were given.': 'Bu uygulama yalnızca davetle — sana verilen kodu gir.',
|
||||
'An invite code is required': 'Bir davet kodu gerekli',
|
||||
'Admin dashboard': 'Yönetici paneli'
|
||||
'Admin dashboard': 'Yönetici paneli',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': 'Kas dengesi',
|
||||
'by sets worked': 'çalışılan sete göre',
|
||||
'Week': 'Hafta',
|
||||
'not trained': 'çalışılmadı',
|
||||
'Not trained in this period': 'Bu dönemde çalışılmadı',
|
||||
'Every muscle group got some work in this period.': 'Bu dönemde her kas grubu çalıştı.',
|
||||
'No workouts in this period yet.': 'Bu dönemde henüz antrenman yok.',
|
||||
'What this session hits': 'Bu antrenman neyi çalıştırıyor',
|
||||
'What you just trained': 'Az önce ne çalıştın',
|
||||
'Body diagram': 'Vücut diyagramı',
|
||||
'Male': 'Erkek',
|
||||
'Female': 'Kadın',
|
||||
'Less': 'Az',
|
||||
'More': 'Çok',
|
||||
'Traps': 'Trapez',
|
||||
'Shoulders': 'Omuzlar',
|
||||
'Chest': 'Göğüs',
|
||||
'Upper back': 'Üst sırt',
|
||||
'Serratus': 'Serratus',
|
||||
'Biceps': 'Biseps',
|
||||
'Triceps': 'Triseps',
|
||||
'Forearms': 'Ön kollar',
|
||||
'Abs': 'Karın',
|
||||
'Obliques': 'Yan karın',
|
||||
'Lower back': 'Alt sırt',
|
||||
'Glutes': 'Kalça',
|
||||
'Quads': 'Ön bacak',
|
||||
'Hamstrings': 'Arka bacak',
|
||||
'Adductors': 'Adduktörler',
|
||||
'Hip flexors': 'Kalça fleksörleri',
|
||||
'Calves': 'Baldırlar',
|
||||
'Shins': 'İncik'
|
||||
}
|
||||
@@ -347,5 +347,38 @@ export default {
|
||||
'Invite code': '邀请码',
|
||||
'This app is invite-only — enter the code you were given.': '此应用仅限邀请——请输入你收到的邀请码。',
|
||||
'An invite code is required': '需要邀请码',
|
||||
'Admin dashboard': '管理后台'
|
||||
'Admin dashboard': '管理后台',
|
||||
// --- muscle map ---
|
||||
'Muscle balance': '肌肉平衡',
|
||||
'by sets worked': '按训练组数',
|
||||
'Week': '本周',
|
||||
'not trained': '未训练',
|
||||
'Not trained in this period': '此期间未训练',
|
||||
'Every muscle group got some work in this period.': '此期间每个肌群都得到了训练。',
|
||||
'No workouts in this period yet.': '此期间还没有训练。',
|
||||
'What this session hits': '这次训练练到哪里',
|
||||
'What you just trained': '你刚刚练了什么',
|
||||
'Body diagram': '身体图示',
|
||||
'Male': '男性',
|
||||
'Female': '女性',
|
||||
'Less': '更少',
|
||||
'More': '更多',
|
||||
'Traps': '斜方肌',
|
||||
'Shoulders': '肩部',
|
||||
'Chest': '胸部',
|
||||
'Upper back': '上背部',
|
||||
'Serratus': '前锯肌',
|
||||
'Biceps': '肱二头肌',
|
||||
'Triceps': '肱三头肌',
|
||||
'Forearms': '前臂',
|
||||
'Abs': '腹肌',
|
||||
'Obliques': '腹斜肌',
|
||||
'Lower back': '下背部',
|
||||
'Glutes': '臀部',
|
||||
'Quads': '股四头肌',
|
||||
'Hamstrings': '腘绳肌',
|
||||
'Adductors': '内收肌',
|
||||
'Hip flexors': '髋屈肌',
|
||||
'Calves': '小腿',
|
||||
'Shins': '胫前肌'
|
||||
}
|
||||
+22
-12
@@ -7,11 +7,14 @@ import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolu
|
||||
import { beep, vibrate } from './lib/sound.js'
|
||||
import { t, instrFor, getLang, INSTR_LANGS } from './lib/i18n.js'
|
||||
import { nav } from './lib/nav.js'
|
||||
import { starterRoutines } from './lib/starter.js'
|
||||
import Media, { Thumb } from './components/Media.jsx'
|
||||
import Stepper from './components/Stepper.jsx'
|
||||
import Icon from './components/Icon.jsx'
|
||||
import { Button, Slider } from './components/ui.jsx'
|
||||
import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js'
|
||||
import BodyMap from './components/BodyMap.jsx'
|
||||
import { loadOfWorkouts } from './lib/muscles.js'
|
||||
|
||||
const S = () => useStore.getState().S
|
||||
const update = (...a) => useStore.getState().update(...a)
|
||||
@@ -36,11 +39,8 @@ export function confirmSheet(opts) {
|
||||
|
||||
/* ============================ starter plan ============================ */
|
||||
export function loadStarterPlan() {
|
||||
const mk = (name, emoji, list) => ({ id: uid(), name, emoji, ex: list.map(([id, sets, reps]) => ({ id, sets, reps, weight: 0 })) })
|
||||
const [push, pull, legs] = starterRoutines()
|
||||
update(st => {
|
||||
const push = mk('Push Day', 'barbell', [['0025', 4, 8], ['0047', 3, 10], ['0426', 3, 10], ['0334', 3, 12], ['0241', 3, 12], ['0251', 3, 10]])
|
||||
const pull = mk('Pull Day', 'pullup', [['2330', 4, 10], ['0027', 4, 8], ['1323', 3, 10], ['0031', 3, 10], ['0313', 3, 12]])
|
||||
const legs = mk('Leg Day', 'legs', [['0043', 4, 8], ['0085', 3, 10], ['0739', 3, 12], ['0585', 3, 12], ['0586', 3, 12], ['0605', 4, 15]])
|
||||
st.routines.push(push, pull, legs)
|
||||
st.week[1] = push.id; st.week[3] = pull.id; st.week[5] = legs.id
|
||||
})
|
||||
@@ -516,17 +516,24 @@ export function beginWorkout(routineId, bw) {
|
||||
function TopWeight({ entryIdx, close }) {
|
||||
const st = useStore(s => s.S)
|
||||
const A = st.active
|
||||
const entry = A.entries[entryIdx]
|
||||
const ex = EXIDX[entry.id]
|
||||
const maxSet = Math.max(0, ...entry.sets.filter(s => s.done).map(s => s.w || 0))
|
||||
const prevBest = Math.max((st.exWeights[entry.id] || {}).w || 0, bestWeightFor(st, entry.id))
|
||||
const [v, setV] = useState(Math.max(maxSet, prevBest) || entry.target.weight || 0)
|
||||
// The workout can end underneath this sheet: finishing from the last exercise clears
|
||||
// `active`, and this re-renders before the sheet is torn down. Everything below is
|
||||
// read defensively and the sheet dismisses itself — reading A.entries straight took
|
||||
// the whole app down with it. Hooks still run unconditionally, so the bail-out has
|
||||
// to sit after every one of them.
|
||||
const entry = A ? A.entries[entryIdx] : null
|
||||
const ex = entry && EXIDX[entry.id]
|
||||
const maxSet = entry ? Math.max(0, ...entry.sets.filter(s => s.done).map(s => s.w || 0)) : 0
|
||||
const prevBest = entry ? Math.max((st.exWeights[entry.id] || {}).w || 0, bestWeightFor(st, entry.id)) : 0
|
||||
const [v, setV] = useState(entry ? (Math.max(maxSet, prevBest) || entry.target.weight || 0) : 0)
|
||||
useEffect(() => { if (!entry) close() }, [!entry])
|
||||
|
||||
const units = supersetUnits(A.entries)
|
||||
const unit = unitOf(units, entryIdx)
|
||||
const unitDone = unit.every(i => A.entries[i].sets.every(s => s.done))
|
||||
const units = supersetUnits(A ? A.entries : [])
|
||||
const unit = entry ? unitOf(units, entryIdx) : []
|
||||
const unitDone = !!entry && unit.every(i => A.entries[i].sets.every(s => s.done))
|
||||
const unitIdx = units.findIndex(u => u === unit)
|
||||
const isLastUnit = unitIdx === units.length - 1
|
||||
if (!entry || !ex) return null
|
||||
|
||||
const commit = advance => {
|
||||
const n = Math.round((v || 0) * 10) / 10
|
||||
@@ -581,6 +588,9 @@ function FinishSummary({ w, prs, close }) {
|
||||
<div className="tile"><div className="l">{t('PRs')}</div><div className="v" style={{ fontSize: 20 }}>{prs.length || '—'}</div></div>
|
||||
</div>
|
||||
{prs.length > 0 && <div style={{ textAlign: 'left', marginBottom: 12 }}>{prs.map(id => <div key={id} className="small accent capitalize row" style={{ gap: 5 }}><Icon name="trophy" style={{ fontSize: 13 }} />{t('New PR:')} {(EXIDX[id] || {}).n || id}</div>)}</div>}
|
||||
<h4 className="sec" style={{ textAlign: 'left' }}>{t('What you just trained')}</h4>
|
||||
<BodyMap load={loadOfWorkouts([w])} body={st.body} />
|
||||
<div style={{ height: 14 }} />
|
||||
<Button variant="primary" onClick={() => { close(); nav('/home') }}>{t('Nice!')}</Button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@ import { create } from 'zustand'
|
||||
import { api } from '../lib/api.js'
|
||||
import { localTZ } from '../lib/format.js'
|
||||
import { registerCustom } from '../lib/exercises.js'
|
||||
import { DEMO, DEMO_SEEDED } from '../lib/demo.js'
|
||||
|
||||
const KEY = 'gym_state_v1'
|
||||
export const DEF = {
|
||||
unit: 'kg', restSec: 90, sound: true, lang: 'en',
|
||||
theme: 'dark', accent: 'lime', targetW: null,
|
||||
theme: 'dark', accent: 'lime', body: 'male', targetW: null,
|
||||
bodyweight: [], routines: [], week: {}, dayPlan: {},
|
||||
exWeights: {}, workouts: [], active: null, customEx: [], gifSize: 'full',
|
||||
reminder: { on: false, time: '08:00', tz: null }
|
||||
@@ -98,8 +99,26 @@ export const useStore = create((set, get) => {
|
||||
persist(clone(DEF), false)
|
||||
},
|
||||
|
||||
// Demo build only: drop the seeded example profile back in (Settings → "Reset demo data").
|
||||
// Dynamic import so the generator never ships in a self-hosted bundle.
|
||||
async resetDemo() {
|
||||
const { buildDemoState } = await import('../lib/demoSeed.js')
|
||||
localStorage.removeItem('gym_dirty')
|
||||
persist(Object.assign(clone(DEF), buildDemoState()), false)
|
||||
},
|
||||
|
||||
// Boot: ask the server who we are, then pull.
|
||||
async boot() {
|
||||
// Demo build (GitHub Pages): no backend at all — seed once, stay in guest mode.
|
||||
if (DEMO) {
|
||||
if (!localStorage.getItem(DEMO_SEEDED)) {
|
||||
localStorage.setItem(DEMO_SEEDED, '1')
|
||||
await get().resetDemo()
|
||||
}
|
||||
get().setGuest(true)
|
||||
set({ ready: true })
|
||||
return
|
||||
}
|
||||
try {
|
||||
const me = await api('/api/me')
|
||||
get().setUser(me.user)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useUI } from '../store/useUI.js'
|
||||
import { webauthnOK, passkeyLogin, passkeyRegister, api, BIO } from '../lib/api.js'
|
||||
import { hasData } from '../store/useStore.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { DEMO, REPO } from '../lib/demo.js'
|
||||
import { useState, useRef, useEffect } from 'react'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button } from '../components/ui.jsx'
|
||||
@@ -47,10 +48,30 @@ export default function Login() {
|
||||
try { const u = await passkeyLogin(); setUser(u); await pullState(); useUI.getState().toast(t('Welcome back, {0}', u.name)) }
|
||||
catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') useUI.getState().toast(e.message || t('Sign-in failed')) }
|
||||
}
|
||||
const head = <>
|
||||
<div style={{ fontSize: 54, display: 'flex', justifyContent: 'center', color: 'var(--acc)' }}><Icon name="dumbbell" /></div>
|
||||
<h1 style={{ fontSize: 34, fontWeight: 700, letterSpacing: '-.028em', margin: '10px 0 4px' }}>openGym</h1>
|
||||
</>
|
||||
const wrap = { display: 'flex', flexDirection: 'column', justifyContent: 'center', minHeight: '78vh', textAlign: 'center' }
|
||||
|
||||
// Demo build: no backend to sign in against — the only way in is the local guest profile.
|
||||
if (DEMO) return (
|
||||
<div className="narrow" style={wrap}>
|
||||
{head}
|
||||
<div className="muted" style={{ marginBottom: 30 }}>{t('Live demo — everything stays in this browser.')}</div>
|
||||
<Button variant="primary" icon="sparkles" onClick={() => setGuest(true)}>{t('Start the demo')}</Button>
|
||||
<div className="card small muted" style={{ textAlign: 'left', marginTop: 16 }}>
|
||||
{t('This demo runs entirely in your browser on example data — nothing is sent anywhere. Passkey sign-in and sync across your devices come with the openGym server, which you get by self-hosting it.')}
|
||||
</div>
|
||||
<div className="dim small" style={{ marginTop: 22, lineHeight: 1.6 }}>
|
||||
<a href={REPO} target="_blank" rel="noopener">{t('Self-host it in a minute →')}</a>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="narrow" style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', minHeight: '78vh', textAlign: 'center' }}>
|
||||
<div style={{ fontSize: 54, display: 'flex', justifyContent: 'center', color: 'var(--acc)' }}><Icon name="dumbbell" /></div>
|
||||
<h1 style={{ fontSize: 34, fontWeight: 700, letterSpacing: '-.028em', margin: '10px 0 4px' }}>openGym</h1>
|
||||
<div className="narrow" style={wrap}>
|
||||
{head}
|
||||
<div className="muted" style={{ marginBottom: 34 }}>{t('Your workouts. Your weights. Your profile.')}</div>
|
||||
{webauthnOK() ? <>
|
||||
<Button variant="primary" icon="person" onClick={signIn}>{t('Sign in with passkey')}</Button>
|
||||
|
||||
@@ -10,6 +10,8 @@ import { glyphPicker, exercisePicker, exConfigSheet, confirmSheet } from '../she
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { glyphOf } from '../lib/glyphs.js'
|
||||
import { Button } from '../components/ui.jsx'
|
||||
import BodyMap from '../components/BodyMap.jsx'
|
||||
import { loadOfRoutine, rankOf, MUSCLE_NAME } from '../lib/muscles.js'
|
||||
|
||||
export default function RoutineEdit() {
|
||||
const nav = useNavigate()
|
||||
@@ -65,6 +67,20 @@ export default function RoutineEdit() {
|
||||
</div>
|
||||
})}</div> : <div className="empty"><div className="ico"><Icon name="dumbbell" /></div>{t('No exercises yet — add your first one.')}</div>}
|
||||
|
||||
{/* Coverage of the routine as planned, so a gap shows up while you're building it
|
||||
rather than after a month of training around it. */}
|
||||
{r.ex.length > 0 && (() => {
|
||||
const load = loadOfRoutine(r)
|
||||
const { worked } = rankOf(load)
|
||||
return <div className="card" style={{ marginTop: 12 }}>
|
||||
<h2>{t('What this session hits')}</h2>
|
||||
<BodyMap load={load} body={S.body} />
|
||||
<div className="mchips">
|
||||
{worked.slice(0, 6).map(m => <span key={m} className="mchip">{t(MUSCLE_NAME[m])}</span>)}
|
||||
</div>
|
||||
</div>
|
||||
})()}
|
||||
|
||||
<div className="small dim row" style={{ margin: '10px 2px', gap: 5 }}><Icon name="link" style={{ fontSize: 13 }} />{t('Tap the link button on an exercise to superset it with the one above — you’ll do them back-to-back.')}</div>
|
||||
<Button variant="primary" onClick={() => exercisePicker(ex => exConfigSheet(ex, null, cfg => edit(x => { x.push({ id: ex.id, ...cfg }) })))} icon="plus">{t('Add exercise')}</Button>
|
||||
<div style={{ height: 10 }} />
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ACCENTS, todayISO, localTZ } from '../lib/format.js'
|
||||
import { webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
|
||||
import { pushSupported, enablePush, disablePush, sendTestPush } from '../lib/push.js'
|
||||
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
|
||||
import { DEMO, REPO } from '../lib/demo.js'
|
||||
import { loadStarterPlan, confirmSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Section, Row, SelectRow, Switch, Segmented, Button, TextField } from '../components/ui.jsx'
|
||||
@@ -14,7 +15,7 @@ export default function Settings() {
|
||||
const nav = useNavigate()
|
||||
const S = useStore(s => s.S)
|
||||
const user = useStore(s => s.user)
|
||||
const { update, replaceState, setUser, pullState, pushState, signOut } = useStore()
|
||||
const { update, replaceState, setUser, pullState, pushState, signOut, resetDemo } = useStore()
|
||||
const toast = useUI(s => s.toast)
|
||||
const fileRef = useRef(null)
|
||||
|
||||
@@ -47,9 +48,15 @@ export default function Settings() {
|
||||
<div style={{ flex: 1, marginLeft: 10 }}><h1>{t('Settings')}</h1></div>
|
||||
</div>
|
||||
|
||||
{/* ---------- account ---------- */}
|
||||
<Section title={t('Account')}>
|
||||
{user ? <>
|
||||
{/* ---------- account (demo builds have nothing to sign in to) ---------- */}
|
||||
<Section title={DEMO ? t('Demo') : t('Account')}>
|
||||
{DEMO ? <>
|
||||
<Row icon="sparkles" iconTint="var(--acc)" title={t('You’re in the demo')} subtitle={t('Example data, stored only in this browser — change anything you like.')} />
|
||||
<Row icon="reset" iconTint="var(--blue)" title={t('Reset demo data')} accessory="chevron"
|
||||
onClick={() => confirmSheet({ title: t('Reset demo data?'), message: t('Puts the example plan, workouts and weigh-ins back the way they started.'), confirmText: t('Reset'), onConfirm: () => { resetDemo(); nav('/home'); toast(t('Demo data reset')) } })} />
|
||||
<Row icon="rocket" iconTint="var(--indigo)" title={t('Self-host openGym')} subtitle={t('Passkey sign-in, sync across your devices, your own data.')} accessory="chevron"
|
||||
onClick={() => window.open(REPO, '_blank', 'noopener')} />
|
||||
</> : user ? <>
|
||||
<Row icon="personCircle" iconTint="var(--grey)" title={user.name} subtitle={t('Signed in with passkey — data syncs to this profile.')} />
|
||||
{user.admin && <Row icon="wrench" iconTint="var(--indigo)" title={t('Admin dashboard')} accessory="chevron" onClick={() => nav('/admin')} />}
|
||||
<Row icon="signOut" iconTint="var(--red)" title={t('Sign out')} danger onClick={() => confirmSheet({ title: t('Sign out?'), message: t('Your data is synced to your profile first, then cleared from this device.'), confirmText: t('Sign out'), danger: true, onConfirm: () => { signOut(); nav('/home') } })} />
|
||||
@@ -60,10 +67,10 @@ export default function Settings() {
|
||||
<Row icon="lock" iconTint="var(--grey)" title={t('Passkeys not supported in this browser.')} />
|
||||
)}
|
||||
</Section>
|
||||
{!user && <p className="sect-f" style={{ marginTop: -18, marginBottom: 22 }}>{t('Guest mode — data lives only in this browser.')}</p>}
|
||||
{!user && !DEMO && <p className="sect-f" style={{ marginTop: -18, marginBottom: 22 }}>{t('Guest mode — data lives only in this browser.')}</p>}
|
||||
|
||||
{/* ---------- appearance ---------- */}
|
||||
<Section title={t('Appearance')} footer={t('synced with your profile')}>
|
||||
<Section title={t('Appearance')} footer={DEMO ? undefined : t('synced with your profile')}>
|
||||
<SelectRow
|
||||
icon="globe" iconTint="var(--blue)" title={t('Language')}
|
||||
value={S.lang || 'en'} onChange={v => update(s => { s.lang = v })}
|
||||
@@ -80,6 +87,15 @@ export default function Settings() {
|
||||
onChange={v => update(s => { s.theme = v })}
|
||||
/>
|
||||
</Row>
|
||||
{/* Purely how the muscle map is drawn — nothing else in the app reads this. */}
|
||||
<Row icon="figureStrength" iconTint="var(--teal)" title={t('Body diagram')}>
|
||||
<Segmented
|
||||
className="seg-inline"
|
||||
options={[{ value: 'male', label: t('Male') }, { value: 'female', label: t('Female') }]}
|
||||
value={S.body === 'female' ? 'female' : 'male'}
|
||||
onChange={v => update(s => { s.body = v })}
|
||||
/>
|
||||
</Row>
|
||||
<div className="lrow" style={{ flexDirection: 'column', alignItems: 'stretch', gap: 12, paddingTop: 13, paddingBottom: 14 }}>
|
||||
<span className="lrow-t">{t('Accent color')}</span>
|
||||
<div className="swatches">
|
||||
|
||||
@@ -3,14 +3,59 @@ import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { EXIDX, isCardio } from '../lib/exercises.js'
|
||||
import { bestWeightFor, lastBW, streakWeeks, setLabel } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, fmtVol, todayISO } from '../lib/format.js'
|
||||
import { fmtNum, fmtDate, fmtVol, todayISO, weekKey } from '../lib/format.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { bwSheet, goalSheet, calendarSheet, workoutDetailSheet, WorkoutRow, bwDeltaColor } from '../sheets.jsx'
|
||||
import LineChart from '../components/LineChart.jsx'
|
||||
import Heatmap from '../components/Heatmap.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import BodyMap, { BodyMapLegend } from '../components/BodyMap.jsx'
|
||||
import { loadOfWorkouts, rankOf, MUSCLE_NAME } from '../lib/muscles.js'
|
||||
import { Button, Segmented, SelectRow } from '../components/ui.jsx'
|
||||
|
||||
// Which muscles the training in a window actually hit — and, the point of the card,
|
||||
// which ones it keeps missing. Shading is relative within the window (lib/muscles.js).
|
||||
function MuscleBalance({ S }) {
|
||||
const [win, setWin] = useState(7)
|
||||
const [sel, setSel] = useState(null)
|
||||
const now = Date.now()
|
||||
const inWin = S.workouts.filter(w =>
|
||||
win === 0 ? true
|
||||
: win === 7 ? weekKey(w.d) === weekKey(todayISO())
|
||||
: (w.start || new Date(w.d).getTime()) > now - win * 86400000)
|
||||
const load = loadOfWorkouts(inWin)
|
||||
const { worked, missed } = rankOf(load)
|
||||
const top = worked.slice(0, 4)
|
||||
const max = worked.length ? load[worked[0]] : 0
|
||||
const sets = m => Math.round((load[m] || 0) * 10) / 10
|
||||
|
||||
return <div className="card">
|
||||
<h2>{t('Muscle balance')} <span className="dim" style={{ textTransform: 'none', letterSpacing: 0 }}>· {t('by sets worked')}</span></h2>
|
||||
<Segmented className="seg-range" value={win} onChange={v => { setWin(v); setSel(null) }}
|
||||
options={[{ value: 7, label: t('Week') }, { value: 30, label: '30d' }, { value: 90, label: '90d' }, { value: 0, label: t('All') }]} />
|
||||
{inWin.length ? <>
|
||||
<BodyMap className="tappable" load={load} body={S.body} selected={sel}
|
||||
onMuscle={m => setSel(s => (s === m ? null : m))} />
|
||||
<BodyMapLegend />
|
||||
{sel && <div className="mrow" style={{ borderTop: 'var(--hair) solid var(--sep)', marginTop: 4, paddingTop: 10 }}>
|
||||
<span className="nm"><b>{t(MUSCLE_NAME[sel])}</b></span>
|
||||
<span className="v">{sets(sel) ? t('{0} sets', sets(sel)) : t('not trained')}</span>
|
||||
</div>}
|
||||
{!sel && top.map(m => <div key={m} className="mrow">
|
||||
<span className="nm">{t(MUSCLE_NAME[m])}</span>
|
||||
<span className="bar"><i style={{ width: Math.round(load[m] / max * 100) + '%' }} /></span>
|
||||
<span className="v">{t('{0} sets', sets(m))}</span>
|
||||
</div>)}
|
||||
{missed.length > 0 && <>
|
||||
<h4 className="sec" style={{ marginTop: 12 }}>{t('Not trained in this period')}</h4>
|
||||
<div className="mchips">{missed.map(m => <span key={m} className="mchip miss">{t(MUSCLE_NAME[m])}</span>)}</div>
|
||||
</>}
|
||||
{!missed.length && worked.length > 0 &&
|
||||
<div className="muted small" style={{ marginTop: 10 }}>{t('Every muscle group got some work in this period.')}</div>}
|
||||
</> : <div className="muted small">{t('No workouts in this period yet.')}</div>}
|
||||
</div>
|
||||
}
|
||||
|
||||
// Stats = the analytics hub: all charts, progress and history live here.
|
||||
export default function Stats() {
|
||||
const nav = useNavigate()
|
||||
@@ -55,6 +100,8 @@ export default function Stats() {
|
||||
<Heatmap S={S} onDay={iso => { const ws = S.workouts.filter(w => w.d === iso); if (ws.length === 1) workoutDetailSheet(ws[0]); else if (ws.length) calendarSheet(iso) }} />
|
||||
</div>
|
||||
|
||||
{S.workouts.length > 0 && <MuscleBalance S={S} />}
|
||||
|
||||
<div className="cols">
|
||||
<div className="card">
|
||||
<div className="row between" style={{ marginBottom: 8 }}>
|
||||
|
||||
Reference in new issue
Block a user