Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1c4c66729 | ||
|
|
0e74ad303c | ||
|
|
0c9e473b68 | ||
|
|
358d39590a | ||
|
|
ce4a30002a | ||
|
|
3026d92cc4 | ||
|
|
ec258e1367 | ||
|
|
9006cccb50 | ||
|
|
3d04dbb1e7 | ||
|
|
cb24bf12d7 | ||
|
|
3a79a8dd5a | ||
|
|
491132a2b7 | ||
|
|
d0361b3fe0 | ||
|
|
9add360452 | ||
|
|
19899d0fbd | ||
|
|
5edfc1e78c | ||
|
|
9216aa2f02 | ||
|
|
dcfc7f15a7 | ||
|
|
e47a5418dc | ||
|
|
a97ae06c68 | ||
|
|
03a5bd22ff | ||
|
|
0eb36abfdb | ||
|
|
b7631dc9a0 | ||
|
|
82f0b84766 | ||
|
|
8165e41d8d | ||
|
|
5314b342ff | ||
|
|
1290db11b5 | ||
|
|
57ab683bf6 | ||
|
|
3c985babea | ||
|
|
bc3ac09c77 | ||
|
|
af4de8b8ff | ||
|
|
9bec4bb785 | ||
|
|
fa879a8b40 | ||
|
|
651b03cbd1 | ||
|
|
b0b9e9350f | ||
|
|
ac66d90a3e | ||
|
|
3d30edddad | ||
|
|
287550df6c | ||
|
|
0a69ee8450 | ||
|
|
95474f955b | ||
|
|
bcbde6245c |
No files matched your search
@@ -1,5 +1,95 @@
|
||||
# Changelog
|
||||
|
||||
## v1.2.12 — 2026-08-30
|
||||
|
||||
Six small fixes from the community, each read and tried on staging before it went in. All of
|
||||
them are in the active workout or the exercise settings; nothing changes on the server, so a
|
||||
self-hosted instance only needs the new web bundle.
|
||||
|
||||
### Active workout
|
||||
|
||||
- ➕ **Adding an exercise mid-session puts it right after the one you are on**, not at the end
|
||||
of the list, and the flow carries on from there: "next" takes you to the next *unfinished*
|
||||
exercise and the finish prompt only appears once nothing is left open. Before, a set added
|
||||
late could leave you looking at a completion prompt with work still pending.
|
||||
(Space-Hermes, !42)
|
||||
- ⏱️ **Removing an exercise no longer leaves a timer behind.** A rest countdown that belonged to
|
||||
the removed exercise stops with it — but a rest you are in the middle of for a *different*
|
||||
exercise keeps running and simply follows that exercise. (Space-Hermes, !51, narrowed here)
|
||||
- ⏹️ **Discarding a workout stops a running timed set.** The countdown used to keep going, and
|
||||
beep, on a session that no longer existed. Cancelling the confirmation leaves it running.
|
||||
(Space-Hermes, !59)
|
||||
- 🗺️ **A custom exercise you delete still counts in recovery.** The muscle map and the recovery
|
||||
view read the snapshot saved with each finished workout, so deleting the exercise afterwards
|
||||
no longer blanks the muscles it trained. (Space-Hermes, !58)
|
||||
|
||||
### Exercise settings
|
||||
|
||||
- 🔢 **Progression steps below one can be typed.** Entering `0.5` used to snap back to the
|
||||
default halfway through, because the field rejected the intermediate `0`. A cleared field
|
||||
still means "use the default". (mflova, !60)
|
||||
- 📐 **Long values in routine rows no longer squash the title.** The value column is capped
|
||||
instead of reserving space, so a "3 × 12 @ 102.5 kg" row keeps its exercise name readable on a
|
||||
narrow phone. (MokshManral, !37)
|
||||
|
||||
With thanks to Space-Hermes, mflova and MokshManral.
|
||||
|
||||
## v1.2.11 — 2026-08-25
|
||||
|
||||
A correction release. v1.2.10 landed planned warm-ups and notes, and reviewing that release
|
||||
afterwards turned up six defects it had either introduced or made matter — three of them in the
|
||||
warm-up work itself. None of them broke a test, which is the point: they were gaps beside the
|
||||
tests rather than failures in them.
|
||||
|
||||
### Warm-ups
|
||||
|
||||
- ⚖️ **Warm-ups were counted in your session volume.** Every other part of the app leaves them
|
||||
out — records, progression, the muscle map — and the routine screen says so in as many words
|
||||
("left out of volume, records and progression"). Volume was the one place it was not true.
|
||||
Three planned warm-ups on a 3×5 at 100 kg reported 2562.5 instead of 1500, and that number is
|
||||
written into the finished workout, so it would have stayed wrong for good.
|
||||
- 📉 **On a deload, the last warm-up came out heavier than the work sets.** The ramp was built
|
||||
before progression had its say and nothing recalculated it, so a plan dropping from 100 kg to
|
||||
50 kg gave you warm-ups of 50 and 75 under work sets of 50. The ramp is now derived after the
|
||||
prescription, so it always aims at the weight you are actually about to lift. A warm-up you
|
||||
have already logged keeps its weight — it happened.
|
||||
- 🧱 **One too-heavy warm-up spread to the rest.** Editing a warm-up above the working weight
|
||||
made every warm-up added after it inherit that number. Your own edit stays as you typed it;
|
||||
what stops is the inheritance.
|
||||
|
||||
### Notes
|
||||
|
||||
- 📝 **The session note now exists.** v1.2.10 described three kinds of note and shipped two: the
|
||||
code that saves a whole-session note was there, and tested, but nothing in the app ever wrote
|
||||
one. There is a note field next to the finish button now — wrapping up is when you know how
|
||||
the session went.
|
||||
- 💾 **The session note stopped being thrown away.** In a past workout it only saved when the
|
||||
field lost focus, and Escape, the Android back gesture and swipe-to-dismiss all close a sheet
|
||||
without that ever happening. Type a note, press Escape, gone. It now saves on the way out too.
|
||||
|
||||
### Sharing, stats and settings
|
||||
|
||||
- 🔗 **Shared plans carry drop-sets and rest-pause.** A routine built as "3×5 with a double
|
||||
drop" arrived at the other end as a plain 3×5, silently. Both the intensifier and the planned
|
||||
warm-up count are now clamped in both directions, so a hand-edited plan file cannot put a
|
||||
nonsense number in front of you either.
|
||||
- 🔢 **The version is visible again**, at the bottom of Settings — which is where the support
|
||||
template has been telling people to look for it. On the phone there is no address bar, so
|
||||
there was no way to tell which build you had or whether an update installed. (issue #7)
|
||||
- ⏹️ **The rest timer can be turned off.** v1.2.10 made this worse before it made it better: it
|
||||
started resting after every set instead of finishing an exercise quietly, and there was still
|
||||
no way out. "Off" now sits with the other durations.
|
||||
- 📊 **The exercise picker in Stats no longer runs long names into the label** (mflova, !24), and
|
||||
**a chart tooltip no longer lingers from the previous exercise** (mflova, !25). The estimated-1RM
|
||||
series is memoised as well, so the tooltip stops vanishing under your finger while you read it.
|
||||
|
||||
### Website
|
||||
|
||||
- 🌐 **opengym.duarte-santos.ch has been rebuilt** — a bento layout with real device frames, a
|
||||
mobile menu that opens instead of hiding, scroll reveals that respect `prefers-reduced-motion`,
|
||||
and a section collecting where the project actually lives. It had been live for a while without
|
||||
ever being committed, so the repository and the site had drifted apart.
|
||||
|
||||
## v1.2.10 — 2026-08-25
|
||||
|
||||
The first release since the move to GitLab that is mostly **other people's work**. Nine
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gym-api",
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.12",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "server.js",
|
||||
|
||||
@@ -24,15 +24,18 @@ To import your history from other applications, you'll need an export that is in
|
||||
The app tries to match the exercise names to link them to the exercises in the database.
|
||||
|
||||
> Note: The history is a log of past exercises.
|
||||
> Because plans change and history does not, it is completely disconnected from routines.
|
||||
> Because plans change and history does not, it is completely disconnected from routines.
|
||||
>
|
||||
> Exercises depend on name matching, so custom exercises might be named differently, as they might be in other apps.
|
||||
|
||||
These apps have been tested to work without adjustments:
|
||||
These apps have been tested to work without adjustments to the column names:
|
||||
|
||||
| App | How to export |
|
||||
|---|---|
|
||||
| **FitNotes (Android)** | Settings → Backup/Export → **Spreadsheet Export** |
|
||||
| **FitNotes 2 (iOS)** | Export workouts as CSV; also manual/auto iCloud backups |
|
||||
| **Strong** | Settings → Export Data |
|
||||
| **Gravl** | Profile → Export Data |
|
||||
| **Hevy** | Profile → Settings → Export & Import Data (Workouts or Measurements) |
|
||||
|
||||
You can also create your own `CSV` file:
|
||||
@@ -51,9 +54,9 @@ These field names are supported:
|
||||
|---|---|
|
||||
| `exercise` | `exercise`, `exercise name`, `exercise title` |
|
||||
| `date` | `date`, `workout date` |
|
||||
| `startTime` | `start time` |
|
||||
| `startTime` | `start time`, `start date` |
|
||||
| `endTime` | `end time` |
|
||||
| `workoutName` | `workout name`, `title` |
|
||||
| `workoutName` | `workout name`, `title`, `workout` |
|
||||
| `category` | `category`, `body part`, `muscle group` |
|
||||
| `weightKg` | `weight kg` |
|
||||
| `weightLb` | `weight lbs`, `weight lb` |
|
||||
@@ -65,9 +68,9 @@ These field names are supported:
|
||||
| `distanceKm` | `distance km` |
|
||||
| `distance` | `distance` |
|
||||
| `distanceUnit` | `distance unit` |
|
||||
| `seconds` | `seconds`, `duration seconds` |
|
||||
| `seconds` | `seconds`, `duration seconds`, `set duration sec` |
|
||||
| `time` | `time`, `duration` |
|
||||
| `setType` | `set type` |
|
||||
| `note` | `comment`, `comments`, `notes`, `note` |
|
||||
| `note` | `comment`, `comments`, `notes`, `note`, `workout notes` |
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ android {
|
||||
applicationId "ch.duartesantos.opengym"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 11
|
||||
versionName "1.2.10"
|
||||
versionCode 13
|
||||
versionName "1.2.12"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "opengym-frontend",
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.12",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "opengym-frontend",
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.12",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@capacitor/app": "^7.1.2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "opengym-frontend",
|
||||
"private": true,
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.12",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -18,6 +18,12 @@ export default function LineChart({ points, h = 150, unit = '', color = 'var(--a
|
||||
const tipRef = useRef(null)
|
||||
const [hover, setHover] = useState(null) // { x, y, iso, v }
|
||||
|
||||
// A new dataset has different coordinates and meaning, so never carry the previous
|
||||
// point selection into it. Layout timing removes the marker before the new chart paints.
|
||||
useLayoutEffect(() => {
|
||||
setHover(null)
|
||||
}, [points])
|
||||
|
||||
// The tooltip is placed after layout, from its measured size, because the chart
|
||||
// lives in an overflow-clipped box: a fixed half-width offset (what this used to
|
||||
// do) hangs the label off the edge on the first and last point, and the clip then
|
||||
|
||||
@@ -27,6 +27,15 @@ const point = (year, month, day, y) => ({
|
||||
y
|
||||
})
|
||||
|
||||
const firstPoints = [
|
||||
{ t: Date.UTC(2026, 0, 1), y: 80, d: '2026-01-01' },
|
||||
{ t: Date.UTC(2026, 0, 15), y: 82, d: '2026-01-15' },
|
||||
]
|
||||
const nextPoints = [
|
||||
{ t: Date.UTC(2026, 1, 1), y: 78, d: '2026-02-01' },
|
||||
{ t: Date.UTC(2026, 1, 15), y: 79, d: '2026-02-15' },
|
||||
]
|
||||
|
||||
function renderChart(points) {
|
||||
act(() => root.render(<LineChart points={points} axes={false} unit="kg" />))
|
||||
}
|
||||
@@ -71,4 +80,25 @@ describe('LineChart hover date', () => {
|
||||
const lastIso = isoOf(new Date(last.t))
|
||||
expect(hoverAt(340)).toBe(`${fmtDate(lastIso, true, true)} · 71 kg`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('LineChart hover state', () => {
|
||||
it('clears the tooltip and hover markers when points are replaced, then allows hovering again', () => {
|
||||
renderChart(firstPoints)
|
||||
hoverAt(170)
|
||||
|
||||
expect(container.querySelector('.ctip')).toBeTruthy()
|
||||
expect(container.querySelector('.cvl')).toBeTruthy()
|
||||
expect(container.querySelector('.chl')).toBeTruthy()
|
||||
|
||||
renderChart(nextPoints)
|
||||
|
||||
expect(container.querySelector('.ctip')).toBeNull()
|
||||
expect(container.querySelector('.cvl')).toBeNull()
|
||||
expect(container.querySelector('.chl')).toBeNull()
|
||||
|
||||
hoverAt(170)
|
||||
expect(container.querySelector('.ctip')).toBeTruthy()
|
||||
expect(container.querySelector('.cvl')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
@@ -248,7 +248,7 @@ export function Row({ icon, iconTint, title, subtitle, value, accessory = 'none'
|
||||
// theme entirely — on dark mode it flashes a white sheet — and can't show more
|
||||
// than a bare label per option. This opens our own sheet with a checkmark on the
|
||||
// current value, which is also how iOS itself handles a long option list.
|
||||
export function SelectRow({ icon, iconTint, title, value, options, onChange, sheetTitle }) {
|
||||
export function SelectRow({ icon, iconTint, title, value, options, onChange, sheetTitle, stackedValue = false }) {
|
||||
const cur = options.find(o => o.value === value)
|
||||
const open = () => {
|
||||
const { openSheet } = require_ui()
|
||||
@@ -270,7 +270,8 @@ export function SelectRow({ icon, iconTint, title, value, options, onChange, she
|
||||
return h
|
||||
}
|
||||
return (
|
||||
<Row icon={icon} iconTint={iconTint} title={title} value={cur ? cur.label : value} accessory="chevron" onClick={open} />
|
||||
<Row icon={icon} iconTint={iconTint} title={title} value={cur ? cur.label : value} accessory="chevron" onClick={open}
|
||||
className={stackedValue ? 'lrow-stack-value' : ''} />
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+25
-3
@@ -235,12 +235,27 @@ h4.sec{
|
||||
.lrow-s{font-size:13px;color:var(--label-2);line-height:1.3}
|
||||
/* flex:none would let a long value ("Follow the routine (Linear progression)") run straight
|
||||
through the title next to it, since the title's column is already free to shrink to nothing.
|
||||
Letting the value shrink and ellipsise instead keeps the two out of each other's way. */
|
||||
.lrow-v{color:var(--label-2);font-size:17px;letter-spacing:-.012em;flex:0 1 auto;min-width:0;
|
||||
Letting the value shrink and ellipsise instead keeps the two out of each other's way.
|
||||
The cap is max-width, not flex-basis: .lrow-m is flex:1, so its basis is 0 and it absorbs
|
||||
none of the shrink — a long value would otherwise take the whole row and squeeze the title
|
||||
to 21px. A basis of 45% fixes that but reserves the space even for "3", costing the title
|
||||
141px on the rows that need it most. A cap does neither. */
|
||||
.lrow-v{color:var(--label-2);font-size:17px;letter-spacing:-.012em;flex:0 1 auto;max-width:45%;min-width:0;
|
||||
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right}
|
||||
.lrow-c{color:var(--label);font-size:15px;flex:none;--icon-stroke:2.4}
|
||||
.lrow-k{color:var(--acc);font-size:17px;flex:none;--icon-stroke:2.4}
|
||||
.lrow.danger,.lrow.danger .lrow-t{color:var(--red)}
|
||||
/* The Stats exercise name gets its own line so long names cannot run into the title.
|
||||
Two columns only — label/value on the left, chevron on the right — so this is for rows
|
||||
WITHOUT an icon. `.lrow-i` is not placed here; on a row that has one it would auto-place
|
||||
into the grid and push the layout around. Give it a leading column before using this
|
||||
anywhere else. */
|
||||
.lrow.lrow-stack-value{
|
||||
display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;
|
||||
}
|
||||
.lrow.lrow-stack-value .lrow-m{grid-column:1;grid-row:1}
|
||||
.lrow.lrow-stack-value .lrow-v{grid-column:1;grid-row:2;text-align:left}
|
||||
.lrow.lrow-stack-value .lrow-c{grid-column:2;grid-row:1 / span 2;align-self:center}
|
||||
/* an (i) before a row's control: painted small and dim so the control stays the loud thing,
|
||||
but with a finger-sized target like everything else — the padding is the hit area and the
|
||||
vertical negative margin keeps it from making the row taller. The horizontal ones pull the
|
||||
@@ -937,7 +952,7 @@ h4.sec{
|
||||
.today-row{
|
||||
display:flex;align-items:center;justify-content:space-between;gap:10px;
|
||||
margin-top:12px;padding:12px 14px;border-radius:var(--r);background:var(--surface-2);
|
||||
transition:background var(--fast);width:100%;text-align:left;
|
||||
transition:background var(--fast);width:100%;text-align:left;cursor:pointer;
|
||||
}
|
||||
.today-row:active{background:var(--surface-3)}
|
||||
.today-row .lbl2{font-size:11px;font-weight:500;letter-spacing:.03em;text-transform:uppercase;color:var(--label-3)}
|
||||
@@ -946,6 +961,13 @@ h4.sec{
|
||||
letter-spacing:-.012em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;
|
||||
}
|
||||
|
||||
/* Only where a pointer really hovers — on a phone :hover sticks to the row after the tap.
|
||||
Lighter than :active, which goes all the way to --surface-3, so the two stay distinct. */
|
||||
@media (hover:hover){
|
||||
.today-row:hover{background:color-mix(in srgb,var(--surface-2),var(--surface-3) 60%)}
|
||||
:root[data-theme="light"] .today-row:hover{background:color-mix(in srgb,var(--surface-2),var(--surface-3) 85%)}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------- desktop (≥1000px) --- */
|
||||
.cols{display:block}
|
||||
@media (min-width:1000px){
|
||||
|
||||
@@ -388,7 +388,14 @@ export function workoutVolume(w) {
|
||||
// No special case for unilateral work: a per-side set logs its total, so both sides are
|
||||
// already in the rep count that arrives here. Drop-set drops and rest-pause bursts add their
|
||||
// own weight x reps on top of the row's main/activation set (see extraVolumeOf).
|
||||
w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * (s.r || 0) + extraVolumeOf(s) }))
|
||||
// Warm-ups are excluded here as everywhere else. The config sheet promises it in so many
|
||||
// words ("left out of volume, records and progression") and every other consumer already
|
||||
// does it; this line was the one that did not, which only stopped being harmless when a
|
||||
// routine started planning warm-ups by default. The number is written into the saved
|
||||
// workout, so an inflated one would stay wrong forever.
|
||||
w.entries.forEach(e => e.sets.forEach(s => {
|
||||
if (s.done && !isWarmupRow(s)) v += (s.w || 0) * (s.r || 0) + extraVolumeOf(s)
|
||||
}))
|
||||
return v
|
||||
}
|
||||
export function setsDone(w) {
|
||||
@@ -460,6 +467,36 @@ export function cascadeWeight(rows, from, value) {
|
||||
* `at` is 0, and reading `rows[-1]` used to fall through to the *last* row — the heaviest
|
||||
* work set — so "add warm-up set" handed you a full-weight set to correct by hand.
|
||||
*/
|
||||
/**
|
||||
* Recompute the warm-up block so it ramps toward the weight the work rows ACTUALLY carry.
|
||||
*
|
||||
* buildSets prepends the warm-ups before a prescription is applied, and applyPrescription
|
||||
* deliberately rewrites work rows only — so without this the ramp still aims at last
|
||||
* session's weight. On a deload that put the last warm-up above every work set, which is
|
||||
* the exact opposite of what a warm-up is for.
|
||||
*
|
||||
* A warm-up already logged keeps its weight and becomes what the next one ramps from: it
|
||||
* happened, and rewriting performed work is data loss. Entries with nothing to ramp toward
|
||||
* — cardio, bodyweight, an unloaded hold — are returned untouched.
|
||||
*/
|
||||
export function rerampWarmups(rows, step = 2.5) {
|
||||
const firstWork = rows.findIndex(x => !isWarmupRow(x))
|
||||
if (firstWork <= 0) return rows
|
||||
const target = rows[firstWork].w || 0
|
||||
if (!(target > 0)) return rows
|
||||
const out = rows.slice()
|
||||
let from = 0
|
||||
for (let i = 0; i < firstWork; i++) {
|
||||
if (out[i].done) { from = out[i].w || 0; continue }
|
||||
const w = target > from
|
||||
? Math.max(0, Math.min(target, Math.floor((from + (target - from) / 2) / step) * step))
|
||||
: target
|
||||
out[i] = { ...out[i], w }
|
||||
from = w
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
export function insertWarmupRow(rows, mode, target, step = 2.5) {
|
||||
const firstWork = rows.findIndex(x => !isWarmupRow(x))
|
||||
const at = firstWork === -1 ? rows.length : firstWork
|
||||
@@ -467,7 +504,12 @@ export function insertWarmupRow(rows, mode, target, step = 2.5) {
|
||||
const work = firstWork === -1 ? null : rows[firstWork]
|
||||
const rampTo = to => {
|
||||
const from = prev ? (prev.w || 0) : 0
|
||||
if (!(to > 0) || to <= from) return from
|
||||
// Nothing to ramp toward: bodyweight, cardio, a timed hold with no load.
|
||||
if (!(to > 0)) return 0
|
||||
// Already at or past the work weight — which happens when a warm-up was edited by hand
|
||||
// above it. Returning `from` here handed the next warm-up that same too-heavy number and
|
||||
// let it propagate down the block. A warm-up is never heavier than the set it warms up for.
|
||||
if (to <= from) return to
|
||||
// Rounded DOWN to the step: a warm-up that lands a notch light costs nothing, one that
|
||||
// lands a notch heavy is a set you have to strip plates off before you can use it.
|
||||
return Math.max(0, Math.min(to, Math.floor((from + (to - from) / 2) / step) * step))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// a page break — each exercise, and each routine that fits, stays in one place.
|
||||
|
||||
import { EXIDX, isBodyweightEq } from './exercises.js'
|
||||
import { modeOf, fmtSec, isBw, isPerSide, sideReps } from './history.js'
|
||||
import { modeOf, fmtSec, isBw, isPerSide, sideReps, MAX_PLANNED_WARMUPS } from './history.js'
|
||||
import { uid, todayISO, DAYN, fmtNum, exCount } from './format.js'
|
||||
import { t, exerciseNameFor } from './i18n-core.js'
|
||||
|
||||
@@ -46,10 +46,36 @@ function cleanEx(e) {
|
||||
if (e.repsMax != null) o.repsMax = e.repsMax
|
||||
if (e.sg) o.sg = e.sg
|
||||
if (e.note) o.note = e.note
|
||||
if (e.warmupSets) o.warmupSets = e.warmupSets
|
||||
const warm = cleanWarmupSets(e.warmupSets)
|
||||
if (warm) o.warmupSets = warm
|
||||
// Drop-sets and rest-pause are part of how the exercise is prescribed, not a logging detail.
|
||||
// Without this a shared "3x5 with a double drop" arrived at the other end as a plain 3x5,
|
||||
// silently — parsePlan's `dropped` counter only tracks exercises it cannot resolve at all.
|
||||
const intens = cleanIntensifier(e.intensifier)
|
||||
if (intens) o.intensifier = intens
|
||||
return o
|
||||
}
|
||||
|
||||
/** Clamped the same way buildSets clamps it on the way out — the stepper showed a hand-edited
|
||||
* plan file's "999" verbatim, because the clamp only happened when the rows were built. */
|
||||
function cleanWarmupSets(v) {
|
||||
const n = Math.round(Number(v)) || 0
|
||||
return n > 0 ? Math.min(MAX_PLANNED_WARMUPS, n) : 0
|
||||
}
|
||||
|
||||
/** Keep the floors the config sheet and applyIntensifierPlan already enforce, and nothing else:
|
||||
* a plan file is someone else's data, so anything unrecognised is dropped rather than trusted. */
|
||||
function cleanIntensifier(x) {
|
||||
const type = x && x.type
|
||||
if (type === 'dropset') {
|
||||
return { type, count: Math.max(1, Math.round(Number(x.count)) || 1), pct: Math.max(5, Math.round(Number(x.pct)) || 20) }
|
||||
}
|
||||
if (type === 'restpause') {
|
||||
return { type, totalReps: Math.max(1, Math.round(Number(x.totalReps)) || 1), restSec: Math.max(5, Math.round(Number(x.restSec)) || 15) }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** Build the shareable bundle: every routine, the week schedule, referenced customs. */
|
||||
export function buildPlanBundle(S, name) {
|
||||
const routines = (S.routines || []).map(r => ({
|
||||
@@ -87,6 +113,13 @@ export function parsePlan(raw) {
|
||||
const ok = !!e && (known.has(e.id) || !!EXIDX[e.id])
|
||||
if (!ok) dropped++
|
||||
return ok
|
||||
}).map(e => {
|
||||
// The exercises pass through as written, so the two fields that carry numbers into the
|
||||
// planner get the same clamps on the way in that they get on the way out.
|
||||
const warm = cleanWarmupSets(e.warmupSets)
|
||||
const intens = cleanIntensifier(e.intensifier)
|
||||
const { warmupSets, intensifier, ...rest } = e
|
||||
return { ...rest, ...(warm ? { warmupSets: warm } : {}), ...(intens ? { intensifier: intens } : {}) }
|
||||
})
|
||||
}))
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildPlanBundle, parsePlan } from './plan-share.js'
|
||||
|
||||
// There was no test file for plan sharing at all, which is how a whole prescription field
|
||||
// went missing without anyone noticing.
|
||||
const stateWith = ex => ({
|
||||
routines: [{ id: 'r1', name: 'Push', ex: [{ id: '0025', sets: 3, reps: 5, weight: 100, ...ex }] }],
|
||||
week: {}, customEx: [],
|
||||
})
|
||||
const roundTrip = ex => parsePlan(JSON.stringify(buildPlanBundle(stateWith(ex), 'Plan'))).routines[0].ex[0]
|
||||
|
||||
describe('what survives a shared plan', () => {
|
||||
it('carries a drop-set prescription', () => {
|
||||
expect(roundTrip({ intensifier: { type: 'dropset', count: 2, pct: 20 } }).intensifier)
|
||||
.toEqual({ type: 'dropset', count: 2, pct: 20 })
|
||||
})
|
||||
|
||||
it('carries a rest-pause prescription', () => {
|
||||
expect(roundTrip({ intensifier: { type: 'restpause', totalReps: 12, restSec: 15 } }).intensifier)
|
||||
.toEqual({ type: 'restpause', totalReps: 12, restSec: 15 })
|
||||
})
|
||||
|
||||
it('carries planned warm-ups', () => {
|
||||
expect(roundTrip({ warmupSets: 3 }).warmupSets).toBe(3)
|
||||
})
|
||||
|
||||
it('drops an intensifier it does not recognise rather than passing it on', () => {
|
||||
expect(roundTrip({ intensifier: { type: 'nonsense', count: 3 } }).intensifier).toBeUndefined()
|
||||
})
|
||||
|
||||
it('clamps a hand-edited warm-up count instead of showing it verbatim', () => {
|
||||
const bundle = { opengym_plan: 1, name: 'x', routines: [{ id: 'r', name: 'R', ex: [{ id: '0025', sets: 3, reps: 5, warmupSets: 999 }] }], week: {}, customEx: [] }
|
||||
expect(parsePlan(bundle).routines[0].ex[0].warmupSets).toBe(5)
|
||||
})
|
||||
|
||||
// The floors are the config sheet's own (count >= 1, pct >= 5); a value that is present but
|
||||
// out of range is pulled up to the floor, while a missing one falls back to the default.
|
||||
it('clamps out-of-range intensifier numbers to the floors the app enforces', () => {
|
||||
const bundle = { opengym_plan: 1, name: 'x', routines: [{ id: 'r', name: 'R', ex: [{ id: '0025', sets: 3, reps: 5, intensifier: { type: 'dropset', count: 0, pct: -5 } }] }], week: {}, customEx: [] }
|
||||
expect(parsePlan(bundle).routines[0].ex[0].intensifier).toEqual({ type: 'dropset', count: 1, pct: 5 })
|
||||
})
|
||||
|
||||
it('falls back to the default drop percentage when the file omits it', () => {
|
||||
const bundle = { opengym_plan: 1, name: 'x', routines: [{ id: 'r', name: 'R', ex: [{ id: '0025', sets: 3, reps: 5, intensifier: { type: 'dropset' } }] }], week: {}, customEx: [] }
|
||||
expect(parsePlan(bundle).routines[0].ex[0].intensifier).toEqual({ type: 'dropset', count: 1, pct: 20 })
|
||||
})
|
||||
})
|
||||
@@ -16,7 +16,7 @@
|
||||
// · fewer sets than prescribed → miss
|
||||
// So a session that fell apart can never advance the load as though it had succeeded.
|
||||
|
||||
import { modeOf, repStep } from './history.js'
|
||||
import { modeOf, repStep, rerampWarmups } from './history.js'
|
||||
import { EXIDX } from './exercises.js'
|
||||
import { isWarmupRow } from './workout-model.js'
|
||||
|
||||
@@ -250,7 +250,7 @@ export function nextPrescription(S, cfg, routine) {
|
||||
* Apply a prescription to freshly built sets. Only the fields the policy actually decided
|
||||
* are touched, and only on sets that have not been logged yet.
|
||||
*/
|
||||
export function applyPrescription(sets, p) {
|
||||
export function applyPrescription(sets, p, step = 2.5) {
|
||||
if (!p || p.kind === 'off' || p.kind === 'first') return sets
|
||||
const out = sets.map(s => {
|
||||
// Never rewrite a logged set, and never rewrite a warm-up: the prescription speaks to
|
||||
@@ -270,7 +270,7 @@ export function applyPrescription(sets, p) {
|
||||
if (p.sets > workRows.length) {
|
||||
// An all-warm-up entry has no work row to seed growth from - growing warm-up copies
|
||||
// would both invent work and never terminate the loop. Leave the entry untouched.
|
||||
if (!workRows.length) return out
|
||||
if (!workRows.length) return rerampWarmups(out, step)
|
||||
const seed = workRows[workRows.length - 1]
|
||||
// A freshly appended row hasn't been performed, so it never inherits a seed's already-
|
||||
// logged drops/clusters — that would invent extra work the row never actually did. Its
|
||||
@@ -279,5 +279,7 @@ export function applyPrescription(sets, p) {
|
||||
const { drops, clusters, ...plainSeed } = seed
|
||||
while (out.filter(s => !isWarmupRow(s)).length < p.sets) out.push({ ...plainSeed, done: false })
|
||||
}
|
||||
return out
|
||||
// Last, because the work rows now carry their final weight: the warm-up block ramps toward
|
||||
// what you are actually about to lift, not toward what you lifted last time.
|
||||
return rerampWarmups(out, step)
|
||||
}
|
||||
@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
|
||||
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(291)
|
||||
expect(inherited).toHaveLength(447)
|
||||
expect(inherited).toHaveLength(449)
|
||||
// If this fails, review the changed keys and wording before accepting a new hash. From
|
||||
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('5eca6d8b564c208b41f1be1890e3eaa0313e0ab901ed40a03b5d3071a65bd9f1')
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('09c4fa5e04c8d3ea21916a6c07f074a35013b33d5d945ecfc13cd54cc8b7d41d')
|
||||
})
|
||||
|
||||
test('does not leak European Portuguese UI terms', () => {
|
||||
|
||||
@@ -61,6 +61,12 @@ function emptyMuscleMap(value) {
|
||||
return Object.fromEntries(MUSCLES.map(slug => [slug, value]))
|
||||
}
|
||||
|
||||
// Current catalogue metadata stays authoritative. Finished entries retain a nested muscle
|
||||
// snapshot specifically so deleted custom exercises can still contribute to recovery maps.
|
||||
function exerciseFor(entry) {
|
||||
return EXIDX[entry?.id] || entry
|
||||
}
|
||||
|
||||
// Epley one-rep-max estimate, matching onerm.js (REP_CAP included so high-rep sets do not
|
||||
// inflate the estimate). Used only to express a set's intensity relative to the lifter's own
|
||||
// capacity - the same formula the app already shows for estimated 1RM.
|
||||
@@ -161,7 +167,7 @@ function loadKgFor(ex, entry, set, workout, opts = {}) {
|
||||
function session1RMs(workout, opts = {}) {
|
||||
const best = new Map()
|
||||
for (const entry of workout?.entries || []) {
|
||||
const ex = EXIDX[entry.id]
|
||||
const ex = exerciseFor(entry)
|
||||
for (const set of entry.sets || []) {
|
||||
const load = loadKgFor(ex, entry, set, workout, opts)
|
||||
if (set?.done !== true || !(load > 0) || !(set.r > 0)) continue
|
||||
@@ -221,10 +227,11 @@ function sessionTonnages(workout, opts = {}) {
|
||||
const sums = emptyMuscleMap(0)
|
||||
const oneRms = session1RMs(workout, opts)
|
||||
for (const entry of workout?.entries || []) {
|
||||
const weights = musclesOf(EXIDX[entry.id])
|
||||
const ex = exerciseFor(entry)
|
||||
const weights = musclesOf(ex)
|
||||
for (const set of entry.sets || []) {
|
||||
if (set?.done !== true) continue
|
||||
const measured = setTonnage(EXIDX[entry.id], entry, set, workout, oneRms.get(entry.id), opts)
|
||||
const measured = setTonnage(ex, entry, set, workout, oneRms.get(entry.id), opts)
|
||||
const tonnage = Number.isFinite(measured) && measured > 0 ? measured : ZERO_LOAD_SET_STIMULUS
|
||||
for (const [slug, weight] of Object.entries(weights)) {
|
||||
if (Object.prototype.hasOwnProperty.call(MUSCLES_BY_SLUG, slug)) sums[slug] += tonnage * weight
|
||||
@@ -326,7 +333,7 @@ export function strengthOf(workouts, now, opts = {}) {
|
||||
if (!Number.isFinite(timestamp)) continue
|
||||
for (const entry of workout.entries || []) {
|
||||
if (!(entry.sets || []).some(set => set?.done === true && !isWarmupRow(set))) continue
|
||||
for (const slug of Object.keys(musclesOf(EXIDX[entry.id]))) {
|
||||
for (const slug of Object.keys(musclesOf(exerciseFor(entry)))) {
|
||||
if (Object.prototype.hasOwnProperty.call(MUSCLES_BY_SLUG, slug) && timestamp > latest[slug]) {
|
||||
latest[slug] = timestamp
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
strengthOf,
|
||||
} from './recovery.js'
|
||||
import { EXDB, registerCustom } from './exercises.js'
|
||||
import { MUSCLES, musclesOf } from './muscles.js'
|
||||
import { MUSCLES, exerciseMuscleSnapshot, musclesOf } from './muscles.js'
|
||||
import { fatigueStateOf } from './recovery-view.js'
|
||||
|
||||
const HOUR = 60 * 60 * 1000
|
||||
@@ -128,6 +128,42 @@ describe('fatigueOf and strengthOf', () => {
|
||||
expect(fatigueOf(highRep, NOW)[SINGLE_SLUG]).toBeGreaterThan(0.5)
|
||||
})
|
||||
|
||||
it('uses a deleted exercise snapshot for the same bounded primary and secondary fatigue', () => {
|
||||
const resolved = doneWorkoutAt(WEIGHTED.id, NOW)
|
||||
const deleted = {
|
||||
...resolved,
|
||||
entries: [{
|
||||
...resolved.entries[0],
|
||||
id: 'deleted-weighted-exercise',
|
||||
muscleSnapshot: exerciseMuscleSnapshot(WEIGHTED),
|
||||
}],
|
||||
}
|
||||
|
||||
expect(fatigueOf([deleted], NOW)).toEqual(fatigueOf([resolved], NOW))
|
||||
expect(fatigueOf([deleted], NOW)[WEIGHTED_PRIMARY_SLUG]).toBeGreaterThan(0)
|
||||
expect(fatigueOf([deleted], NOW)[SECONDARY_SLUG]).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('uses a deleted exercise snapshot for strength without changing decay or floor semantics', () => {
|
||||
const start = NOW - 15 * DAY
|
||||
const resolved = doneWorkoutAt(WEIGHTED.id, start)
|
||||
const deleted = {
|
||||
...resolved,
|
||||
entries: [{
|
||||
...resolved.entries[0],
|
||||
id: 'deleted-weighted-exercise',
|
||||
muscleSnapshot: exerciseMuscleSnapshot(WEIGHTED),
|
||||
}],
|
||||
}
|
||||
const untouchedSlug = MUSCLES.find(slug => !WEIGHTED_WEIGHTS[slug])
|
||||
const strength = strengthOf([deleted], NOW)
|
||||
|
||||
expect(strength).toEqual(strengthOf([resolved], NOW))
|
||||
expect(strength[WEIGHTED_PRIMARY_SLUG]).toBeCloseTo(0.5 ** (1 / 28), 10)
|
||||
expect(strength[SECONDARY_SLUG]).toBeCloseTo(0.5 ** (1 / 28), 10)
|
||||
expect(strength[untouchedSlug]).toBe(STRENGTH_FLOOR)
|
||||
})
|
||||
|
||||
it('raises starting fatigue with volume, never pins, and fades without a cliff', () => {
|
||||
const at0 = count => fatigueOf([doneWorkoutAt(SINGLE.id, NOW, count)], NOW)[SINGLE_SLUG]
|
||||
expect(at0(1)).toBeCloseTo(1 - Math.exp(-V / FATIGUE_REF_VOLUME), 10)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// @vitest-environment happy-dom
|
||||
// The session note shipped with a hole in it: buildCompletedWorkout read `active.note` and
|
||||
// nothing in the app ever wrote it, so the only way to get one was after the fact — and that
|
||||
// path threw the text away unless you happened to tab out of the field first.
|
||||
import { describe, expect, it, beforeEach, afterEach } from 'vitest'
|
||||
import React, { act } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { sessionNoteSheet, workoutDetailSheet } from '../sheets.jsx'
|
||||
import { buildCompletedWorkout } from './finish-workout.js'
|
||||
|
||||
const mounted = []
|
||||
function render(open) {
|
||||
open()
|
||||
const sheet = useUI.getState().sheets.at(-1)
|
||||
const host = document.createElement('div')
|
||||
document.body.appendChild(host)
|
||||
const root = createRoot(host)
|
||||
mounted.push(root)
|
||||
act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
|
||||
return host
|
||||
}
|
||||
const type = (el, value) => {
|
||||
Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value)
|
||||
el.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
}
|
||||
const unmountAll = () => act(() => { mounted.splice(0).forEach(r => r.unmount()) })
|
||||
|
||||
const workout = () => ({
|
||||
id: 'w1', d: '2026-08-25', start: 1, end: 2, name: 'Push', vol: 100,
|
||||
entries: [{ id: 'bench', sets: [{ w: 100, r: 5, done: true }] }], prs: [],
|
||||
})
|
||||
|
||||
describe('session note', () => {
|
||||
beforeEach(() => {
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = true
|
||||
useUI.setState({ sheets: [] })
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
afterEach(unmountAll)
|
||||
|
||||
it('can be written during the workout and survives finishing', () => {
|
||||
useStore.setState(s => ({
|
||||
S: { ...s.S, active: { id: 'w1', d: '2026-08-25', start: 1, name: 'Push', entries: [{ id: 'bench', sets: [] }] } },
|
||||
}))
|
||||
const host = render(() => sessionNoteSheet())
|
||||
act(() => { type(host.querySelector('textarea'), 'slept badly, still hit it') })
|
||||
act(() => { [...host.querySelectorAll('button')].find(b => /save/i.test(b.textContent)).click() })
|
||||
|
||||
const A = useStore.getState().S.active
|
||||
expect(A.note).toBe('slept badly, still hit it')
|
||||
// The path buildCompletedWorkout already had a test for is now actually reachable.
|
||||
expect(buildCompletedWorkout(A, { end: 2 }).note).toBe('slept badly, still hit it')
|
||||
})
|
||||
|
||||
it('is kept when the history sheet is dismissed without blurring the field', () => {
|
||||
useStore.setState(s => ({ S: { ...s.S, workouts: [workout()] } }))
|
||||
const host = render(() => workoutDetailSheet(useStore.getState().S.workouts[0]))
|
||||
act(() => { type(host.querySelector('textarea'), 'good session') })
|
||||
// Escape / Android back / swipe all unmount without a blur.
|
||||
unmountAll()
|
||||
expect(useStore.getState().S.workouts[0].note).toBe('good session')
|
||||
})
|
||||
|
||||
it('clearing it removes the note rather than storing an empty string', () => {
|
||||
useStore.setState(s => ({ S: { ...s.S, workouts: [{ ...workout(), note: 'old' }] } }))
|
||||
const host = render(() => workoutDetailSheet(useStore.getState().S.workouts[0]))
|
||||
act(() => { type(host.querySelector('textarea'), ' ') })
|
||||
unmountAll()
|
||||
expect(useStore.getState().S.workouts[0].note).toBeUndefined()
|
||||
})
|
||||
})
|
||||
@@ -2,6 +2,27 @@
|
||||
// the stores makes the uneven-round and re-check rules explicit and directly testable.
|
||||
const hasWork = (entries, idx) => !!entries[idx]?.sets?.some(set => !set.done)
|
||||
|
||||
// Return the first unfinished navigation unit after the current one, wrapping once so a user
|
||||
// who completed units out of order is never offered workout completion while earlier work remains.
|
||||
export function nextUnfinishedUnit(entries, units, fromIdx) {
|
||||
if (!Array.isArray(entries) || !Array.isArray(units) || units.length === 0) return null
|
||||
const current = units.findIndex(unit => unit.includes(fromIdx))
|
||||
const ordered = current < 0
|
||||
? units
|
||||
: [...units.slice(current + 1), ...units.slice(0, current)]
|
||||
return ordered.find(unit => unit.some(idx => hasWork(entries, idx))) || null
|
||||
}
|
||||
|
||||
// The current exercise may be one member of a contiguous superset. Insert after that complete
|
||||
// navigation unit; invalid/empty state safely falls back to the end of the entry list.
|
||||
export function insertionIndexAfterCurrentUnit(units, currentIndex, entryCount) {
|
||||
const length = Math.max(0, Number(entryCount) || 0)
|
||||
if (!Array.isArray(units) || units.length === 0) return length
|
||||
const unit = units.find(candidate => candidate.includes(currentIndex))
|
||||
if (!unit?.length) return length
|
||||
return Math.min(length, Math.max(...unit) + 1)
|
||||
}
|
||||
|
||||
// A completion is new progress only when it takes this exercise beyond the largest number of
|
||||
// simultaneously completed sets seen in this mounted session. Uncheck/re-check therefore does
|
||||
// not repeat navigation or rest side effects, while completing an added set still can.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from './supersetFlow.js'
|
||||
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from './supersetFlow.js'
|
||||
|
||||
const entry = done => ({ sets: done.map(value => ({ done: value })) })
|
||||
|
||||
@@ -52,6 +52,26 @@ describe('supersetFlowStep', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('active workout unit ordering', () => {
|
||||
it('inserts after the whole current unit', () => {
|
||||
expect(insertionIndexAfterCurrentUnit([[0, 1], [2]], 0, 3)).toBe(2)
|
||||
expect(insertionIndexAfterCurrentUnit([[0], [1]], 1, 2)).toBe(2)
|
||||
expect(insertionIndexAfterCurrentUnit([], 0, 0)).toBe(0)
|
||||
})
|
||||
|
||||
it('finds the next unfinished unit, skips completed units, and wraps once', () => {
|
||||
const entries = [entry([false]), entry([true]), entry([false]), entry([true])]
|
||||
const units = [[0], [1], [2, 3]]
|
||||
expect(nextUnfinishedUnit(entries, units, 0)).toEqual([2, 3])
|
||||
expect(nextUnfinishedUnit(entries, units, 2)).toEqual([0])
|
||||
})
|
||||
|
||||
it('returns null only when every unit is complete', () => {
|
||||
const entries = [entry([true]), entry([true])]
|
||||
expect(nextUnfinishedUnit(entries, [[0], [1]], 1)).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
// Issue #3 has two halves. restAfterSet covers "no break after the LAST set of an exercise";
|
||||
// this covers "after the first set, sometimes a break doesn't appear" — the uncheck/re-check
|
||||
// that the high-water rule swallows.
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { workoutVolume, insertWarmupRow, buildSets } from './history.js'
|
||||
import { applyPrescription } from './progression.js'
|
||||
|
||||
// The config sheet tells users warm-ups are "left out of volume, records and progression",
|
||||
// and history.js repeats that as an invariant in a comment. Volume was the one place it
|
||||
// was false — harmless while warm-ups were hand-added and rare, wrong now that a routine
|
||||
// plans them by default and the number is written into the saved workout for good.
|
||||
describe('warm-ups and volume', () => {
|
||||
const w = {
|
||||
entries: [{
|
||||
id: 'bench',
|
||||
sets: [
|
||||
{ w: 50, r: 5, done: true, phase: 'warmup', warmup: true },
|
||||
{ w: 75, r: 5, done: true, phase: 'warmup', warmup: true },
|
||||
{ w: 87.5, r: 5, done: true, phase: 'warmup', warmup: true },
|
||||
{ w: 100, r: 5, done: true },
|
||||
{ w: 100, r: 5, done: true },
|
||||
{ w: 100, r: 5, done: true },
|
||||
],
|
||||
}],
|
||||
}
|
||||
|
||||
it('counts only the work sets', () => {
|
||||
expect(workoutVolume(w)).toBe(1500)
|
||||
})
|
||||
|
||||
it('a warm-up adds nothing, whatever it weighs', () => {
|
||||
const heavy = { entries: [{ id: 'b', sets: [{ w: 200, r: 10, done: true, phase: 'warmup', warmup: true }] }] }
|
||||
expect(workoutVolume(heavy)).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
// A warm-up must never be heavier than the set it warms you up for. The ramp branch clamps
|
||||
// to the work weight; the early-return branch did not, so a hand-edited warm-up above the
|
||||
// work weight propagated into every warm-up added after it.
|
||||
describe('a warm-up never outweighs the work set', () => {
|
||||
// The 120 is something the user typed, and it stays: silently rewriting their own edit
|
||||
// would be worse than leaving it. What must not happen is the NEW row inheriting it, which
|
||||
// is how one bad number used to spread through the whole warm-up block.
|
||||
it('does not copy a hand-edited warm-up that sits above the work weight', () => {
|
||||
const rows = [{ warmup: true, phase: 'warmup', w: 120, r: 5 }, { w: 100, r: 5 }]
|
||||
const out = insertWarmupRow(rows, 'reps', { reps: 5 }, 2.5)
|
||||
expect(out.map(r => r.w)).toEqual([120, 100, 100])
|
||||
expect(out[1].phase).toBe('warmup')
|
||||
})
|
||||
|
||||
it('still ramps normally when the previous warm-up is below the work weight', () => {
|
||||
const rows = [{ warmup: true, phase: 'warmup', w: 50, r: 5 }, { w: 100, r: 5 }]
|
||||
const out = insertWarmupRow(rows, 'reps', { reps: 5 }, 2.5)
|
||||
expect(out.filter(r => r.phase === 'warmup').map(r => r.w)).toEqual([50, 75])
|
||||
})
|
||||
})
|
||||
|
||||
// buildSets prepends the warm-ups, then applyPrescription rewrites the WORK rows only — so a
|
||||
// ramp built against last session's weight is stale the moment progression moves. On a deload
|
||||
// that put the last warm-up above every work set.
|
||||
describe('the ramp follows the prescribed weight', () => {
|
||||
const S = { workouts: [], exWeights: {}, routines: [] }
|
||||
const cfg = { id: 'bench', sets: 3, reps: 5, weight: 100, warmupSets: 2 }
|
||||
|
||||
it('re-ramps after a deload instead of aiming at the old weight', () => {
|
||||
const rows = applyPrescription(buildSets(S, cfg, { step: 2.5 }), { kind: 'deload', weight: 50 })
|
||||
const warm = rows.filter(r => r.phase === 'warmup').map(r => r.w)
|
||||
const work = rows.filter(r => r.phase !== 'warmup').map(r => r.w)
|
||||
expect(work).toEqual([50, 50, 50])
|
||||
for (const x of warm) expect(x).toBeLessThanOrEqual(50)
|
||||
expect(warm).toEqual([25, 37.5])
|
||||
})
|
||||
|
||||
it('re-ramps after a bump', () => {
|
||||
const rows = applyPrescription(buildSets(S, cfg, { step: 2.5 }), { kind: 'up', weight: 150 })
|
||||
expect(rows.filter(r => r.phase !== 'warmup').map(r => r.w)).toEqual([150, 150, 150])
|
||||
expect(rows.filter(r => r.phase === 'warmup').map(r => r.w)).toEqual([75, 112.5])
|
||||
})
|
||||
})
|
||||
@@ -687,6 +687,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Sitzhöhe, Pin-Position, ein Hinweis zur Ausführung — bei jedem Training sichtbar.',
|
||||
'From {0}:': 'Vom {0}:',
|
||||
'Session note': 'Notiz zum Training',
|
||||
'Add session note': 'Notiz zum Training',
|
||||
'Edit session note': 'Notiz bearbeiten',
|
||||
'How the session went as a whole.': 'Wie das Training insgesamt lief.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-Pause trainiert immer als ein Aufwärmsatz mit dieser Wiederholungszahl und ein Rest-Pause-Arbeitssatz — „Sätze“ wird nicht verwendet.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Altura del asiento, posición del pin, una indicación técnica — visible en cada sesión.',
|
||||
'From {0}:': 'Del {0}:',
|
||||
'Session note': 'Nota de la sesión',
|
||||
'Add session note': 'Añadir nota de la sesión',
|
||||
'Edit session note': 'Editar nota de la sesión',
|
||||
'How the session went as a whole.': 'Cómo fue la sesión en conjunto.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause siempre entrena como una serie de calentamiento con estas reps y una serie de trabajo rest-pause — «Series» no se usa.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Hauteur du siège, position de la goupille, un rappel technique — visible à chaque séance.',
|
||||
'From {0}:': 'Du {0} :',
|
||||
'Session note': 'Note de séance',
|
||||
'Add session note': 'Ajouter une note de séance',
|
||||
'Edit session note': 'Modifier la note de séance',
|
||||
'How the session went as a whole.': 'Comment la séance s’est passée dans l’ensemble.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Le rest-pause s’entraîne toujours comme une série d’échauffement à ce nombre de reps, puis une série de travail rest-pause — « Séries » n’est pas utilisé.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'सीट की ऊँचाई, पिन की जगह, तकनीक का सुझाव — हर कसरत में दिखता है।',
|
||||
'From {0}:': '{0} से:',
|
||||
'Session note': 'सत्र का नोट',
|
||||
'Add session note': 'सत्र का नोट जोड़ें',
|
||||
'Edit session note': 'सत्र का नोट बदलें',
|
||||
'How the session went as a whole.': 'पूरा सत्र कैसा रहा।',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'रेस्ट-पॉज़ हमेशा इसी रेप्स संख्या के एक वार्म-अप सेट और एक रेस्ट-पॉज़ वर्क सेट के रूप में किया जाता है — “सेट” का उपयोग नहीं होता।'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Altezza del sedile, posizione del pin, un promemoria tecnico — visibile a ogni sessione.',
|
||||
'From {0}:': 'Del {0}:',
|
||||
'Session note': 'Nota della sessione',
|
||||
'Add session note': 'Aggiungi nota della sessione',
|
||||
'Edit session note': 'Modifica nota della sessione',
|
||||
'How the session went as a whole.': 'Com’è andata la sessione nel complesso.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Il rest-pause si allena sempre come una serie di riscaldamento a queste ripetizioni e una serie di lavoro rest-pause — “Serie” non viene usato.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': '시트 높이, 핀 위치, 자세 팁 — 매 운동마다 표시됩니다.',
|
||||
'From {0}:': '{0}에서:',
|
||||
'Session note': '운동 메모',
|
||||
'Add session note': '운동 메모 추가',
|
||||
'Edit session note': '운동 메모 편집',
|
||||
'How the session went as a whole.': '이번 운동이 전체적으로 어땠는지.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': '레스트포즈는 항상 이 횟수의 워밍업 세트 하나와 레스트포즈 작업 세트 하나로 진행됩니다 — ‘세트’는 사용하지 않습니다.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Wysokość siedziska, pozycja bolca, wskazówka techniczna — widoczne w każdej sesji.',
|
||||
'From {0}:': 'Z {0}:',
|
||||
'Session note': 'Notatka do sesji',
|
||||
'Add session note': 'Dodaj notatkę do sesji',
|
||||
'Edit session note': 'Edytuj notatkę do sesji',
|
||||
'How the session went as a whole.': 'Jak przebiegła cała sesja.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause zawsze trenuje się jako jedna seria rozgrzewkowa o tej liczbie powtórzeń i jedna seria robocza rest-pause — „Serie” nie są używane.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Altura do banco, posição do pino, uma indicação técnica — visível em todas as sessões.',
|
||||
'From {0}:': 'De {0}:',
|
||||
'Session note': 'Nota da sessão',
|
||||
'Add session note': 'Adicionar nota da sessão',
|
||||
'Edit session note': 'Editar nota da sessão',
|
||||
'How the session went as a whole.': 'Como correu a sessão no seu todo.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'O rest-pause treina sempre como uma série de aquecimento com estas repetições e uma série de trabalho rest-pause — «Séries» não é usado.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Высота сиденья, положение фиксатора, подсказка по технике — видно на каждой тренировке.',
|
||||
'From {0}:': 'От {0}:',
|
||||
'Session note': 'Заметка о тренировке',
|
||||
'Add session note': 'Добавить заметку',
|
||||
'Edit session note': 'Изменить заметку',
|
||||
'How the session went as a whole.': 'Как прошла тренировка в целом.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause всегда выполняется как один разминочный подход с этим числом повторений и один рабочий подход rest-pause — «Подходы» не используются.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': 'Sehpa yüksekliği, pim konumu, bir teknik ipucu — her antrenmanda görünür.',
|
||||
'From {0}:': '{0} tarihinden:',
|
||||
'Session note': 'Antrenman notu',
|
||||
'Add session note': 'Antrenman notu ekle',
|
||||
'Edit session note': 'Antrenman notunu düzenle',
|
||||
'How the session went as a whole.': 'Antrenmanın genel olarak nasıl geçtiği.',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause her zaman bu tekrar sayısında bir ısınma seti ve bir rest-pause çalışma seti olarak çalışılır — “Setler” kullanılmaz.'
|
||||
}
|
||||
@@ -670,6 +670,8 @@ export default {
|
||||
'Seat height, pin position, a form cue — shown every session.': '座椅高度、插销位置、动作要点 —— 每次训练都会显示。',
|
||||
'From {0}:': '来自 {0}:',
|
||||
'Session note': '训练备注',
|
||||
'Add session note': '添加训练备注',
|
||||
'Edit session note': '编辑训练备注',
|
||||
'How the session went as a whole.': '这次训练整体感觉如何。',
|
||||
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause 始终按这个次数练一个热身组,再加一个 rest-pause 正式组 —— 不使用“组数”。'
|
||||
}
|
||||
+67
-8
@@ -23,6 +23,7 @@ import { nextPrescription, applyPrescription, policyFor, defaultIncrement, POLIC
|
||||
import { MOBILE, shareExport } from './lib/mobile.js'
|
||||
import { buildCompletedWorkout } from './lib/finish-workout.js'
|
||||
import { isWarmupRow } from './lib/workout-model.js'
|
||||
import { nextUnfinishedUnit } from './lib/supersetFlow.js'
|
||||
|
||||
const S = () => useStore.getState().S
|
||||
const update = (...a) => useStore.getState().update(...a)
|
||||
@@ -107,7 +108,18 @@ function BwSheet({ required, onDone, close }) {
|
||||
const recent = [...st.bodyweight].reverse().slice(0, 3)
|
||||
const delEntry = d => update(s => { s.bodyweight = s.bodyweight.filter(b => b.d !== d) })
|
||||
return <>
|
||||
<h3>{required ? t('Quick check-in') : t('Log body weight')}</h3>
|
||||
{/* This sheet opens `locked` — swipe/backdrop/Escape/Android-back all no-op on it (see
|
||||
Modals.jsx) so an accidental tap on "Start" can't be walked back by reflex the way
|
||||
every other sheet in the app can. The two buttons below already cover leaving it
|
||||
deliberately; this is the same close a normal sheet gets everywhere else, just
|
||||
opted back in explicitly instead of by omission. Plain close() — no onDone, no
|
||||
nav — so it's a true no-op: the screen underneath is exactly where you left it. */}
|
||||
{required
|
||||
? <div className="row between" style={{ marginBottom: 14 }}>
|
||||
<h3 style={{ marginBottom: 0 }}>{t('Quick check-in')}</h3>
|
||||
<button className="iconbtn" aria-label={t('Cancel')} onClick={() => close()}><Icon name="xmark" /></button>
|
||||
</div>
|
||||
: <h3>{t('Log body weight')}</h3>}
|
||||
<div className="muted small">{required ? t('Slide or tap to set your weight — tracked before every workout so your curve stays honest.') : t('Today') + ', ' + fmtDate(todayISO(), true)}</div>
|
||||
<WeightInput value={v} setValue={setV} unit={unit} />
|
||||
<div style={{ height: 14 }} />
|
||||
@@ -552,7 +564,7 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit }) {
|
||||
if (options.length < 2) return null
|
||||
const inherited = policyFor({ id: ex.id }, routine, mode)
|
||||
const active = policyFor({ ...c, id: ex.id }, routine, mode)
|
||||
const inc = c.inc > 0 ? c.inc : (mode === 'time' ? 5 : defaultIncrement(ex.id, unit))
|
||||
const inc = c.inc >= 0 ? c.inc : (mode === 'time' ? 5 : defaultIncrement(ex.id, unit))
|
||||
return <>
|
||||
<h4 className="sec">{t('Progression')}</h4>
|
||||
<div className="sect-b" style={{ marginBottom: 8 }}>
|
||||
@@ -923,6 +935,22 @@ function WorkoutDetail({ w, close }) {
|
||||
const text = note.trim().slice(0, NOTE_MAX)
|
||||
if (text) rec.note = text; else delete rec.note
|
||||
})
|
||||
// onBlur alone loses the note: Escape, the Android back gesture and swipe-to-dismiss all
|
||||
// close the sheet without ever moving focus out of the textarea. Flush on unmount too. The
|
||||
// ref is what makes that work — a cleanup closes over the note from its own render, which
|
||||
// is the empty string this started with.
|
||||
const latest = useRef(note)
|
||||
latest.current = note
|
||||
const initial = useRef(w.note || '')
|
||||
useEffect(() => () => {
|
||||
const text = latest.current.trim().slice(0, NOTE_MAX)
|
||||
if (text === initial.current) return
|
||||
update(s => {
|
||||
const rec = s.workouts.find(x => x.id === w.id)
|
||||
if (!rec) return // deleted from this very sheet
|
||||
if (text) rec.note = text; else delete rec.note
|
||||
})
|
||||
}, [])
|
||||
return <>
|
||||
<h3>{w.name}</h3>
|
||||
<div className="muted small" style={{ marginBottom: 12 }}>{[fmtDate(w.d, true), ...durPart(w.end - w.start), fmtVol(w.vol, st.unit), ...(w.bw ? [fmtNum(w.bw) + ' ' + st.unit] : [])].join(' · ')}</div>
|
||||
@@ -1014,7 +1042,8 @@ export function beginWorkout(routineId, bw) {
|
||||
// kept on the entry purely so the workout can explain the number it chose.
|
||||
const entries = (r ? r.ex : []).map(cfg => {
|
||||
const plan = nextPrescription(st, cfg, r)
|
||||
const sets = applyIntensifierPlan(applyPrescription(buildSets(st, cfg, { step: defaultIncrement(cfg.id, st.unit) }), plan), cfg)
|
||||
const step = defaultIncrement(cfg.id, st.unit)
|
||||
const sets = applyIntensifierPlan(applyPrescription(buildSets(st, cfg, { step }), plan, step), cfg)
|
||||
return { id: cfg.id, sg: cfg.sg, target: { ...cfg }, plan, sets }
|
||||
})
|
||||
update(s => {
|
||||
@@ -1041,8 +1070,8 @@ function TopWeight({ entryIdx, close }) {
|
||||
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
|
||||
const nextUnit = unitDone ? nextUnfinishedUnit(A.entries, units, entryIdx) : null
|
||||
const workoutDone = unitDone && !nextUnit
|
||||
if (!entry || !ex) return null
|
||||
|
||||
const commit = advance => {
|
||||
@@ -1055,8 +1084,8 @@ function TopWeight({ entryIdx, close }) {
|
||||
})
|
||||
close()
|
||||
if (advance && unitDone) {
|
||||
if (isLastUnit) workoutCompleteSheet() // whole workout done → finish/continue prompt
|
||||
else update(s => { s.active.cur = units[unitIdx + 1][0] })
|
||||
if (workoutDone) workoutCompleteSheet() // no unfinished unit → finish/continue prompt
|
||||
else update(s => { s.active.cur = nextUnit[0] })
|
||||
} else toast(t('Tracked — next time starts at {0}', fmtNum(S().exWeights[entry.id].w) + ' ' + st.unit))
|
||||
}
|
||||
return <>
|
||||
@@ -1066,7 +1095,7 @@ function TopWeight({ entryIdx, close }) {
|
||||
<div style={{ height: 10 }} />
|
||||
{prevBest > 0 ? <div className="small dim" style={{ textAlign: 'center', marginBottom: 12 }}>{t('Previous best:')} {fmtNum(prevBest)} {st.unit}{maxSet > prevBest && <span style={{ color: 'var(--yellow)' }}> — {t('new record!')}</span>}</div> : <div style={{ height: 4 }} />}
|
||||
{unitDone ? <>
|
||||
<Button variant="primary" trailingIcon={isLastUnit ? null : 'chevronRight'} onClick={() => commit(true)}>{isLastUnit ? t('Save') : t('Save & next exercise')}</Button>
|
||||
<Button variant="primary" trailingIcon={workoutDone ? null : 'chevronRight'} onClick={() => commit(true)}>{workoutDone ? t('Save') : t('Save & next exercise')}</Button>
|
||||
<div style={{ height: 8 }} /><Button variant="ghost" className="dim" onClick={() => commit(false)}>{t('Just close')}</Button>
|
||||
</> : <Button variant="primary" onClick={() => commit(false)}>{t('Save weight')}</Button>}
|
||||
</>
|
||||
@@ -1137,6 +1166,36 @@ function ExerciseNote({ entryIdx, close }) {
|
||||
}
|
||||
export const exerciseNoteSheet = entryIdx => ui().openSheet(close => <ExerciseNote entryIdx={entryIdx} close={close} />)
|
||||
|
||||
/* The session note: how the whole workout went, as opposed to how one exercise went. It lives
|
||||
on the active session, so buildCompletedWorkout carries it onto the finished workout and it
|
||||
shows up again in history — where it stays editable. Written here rather than only after the
|
||||
fact because "notes you can write during a workout" is the point; a note you can only add
|
||||
once the session is filed is a different, smaller feature. */
|
||||
function SessionNote({ close }) {
|
||||
const st = useStore(s => s.S)
|
||||
const update = useStore(s => s.update)
|
||||
const A = st.active
|
||||
const [note, setNote] = useState(A?.note || '')
|
||||
useEffect(() => { if (!A) close() }, [!A])
|
||||
if (!A) return null
|
||||
|
||||
const save = () => {
|
||||
const text = note.trim().slice(0, NOTE_MAX)
|
||||
update(s => { if (!s.active) return; if (text) s.active.note = text; else delete s.active.note })
|
||||
close()
|
||||
}
|
||||
|
||||
return <>
|
||||
<h3>{t('Session note')}</h3>
|
||||
<textarea className="input" rows={4} maxLength={NOTE_MAX} value={note}
|
||||
placeholder={t('How the session went as a whole.')}
|
||||
onChange={e => setNote(e.target.value)} />
|
||||
<div style={{ height: 18 }} />
|
||||
<Button variant="primary" onClick={save}>{t('Save')}</Button>
|
||||
</>
|
||||
}
|
||||
export const sessionNoteSheet = () => ui().openSheet(close => <SessionNote close={close} />)
|
||||
|
||||
/* Drop-set drops and rest-pause bursts are edited inline on the set row itself (Workout.jsx) —
|
||||
no sheet, no timer. A planned exercise (see the "Intensifier" config below) arrives with them
|
||||
already computed via applyIntensifierPlan; an unplanned straight set can still grow one live
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// @vitest-environment happy-dom
|
||||
import React, { act } from 'react'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { EXDB } from './lib/exercises.js'
|
||||
import { useStore } from './store/useStore.js'
|
||||
import { useUI } from './store/useUI.js'
|
||||
import { exConfigSheet } from './sheets.jsx'
|
||||
|
||||
const ex = EXDB.find(e => e.id === '0009')
|
||||
const mounted = []
|
||||
|
||||
function type(el, value) {
|
||||
Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value)
|
||||
el.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
}
|
||||
|
||||
function renderConfig(onSave = vi.fn()) {
|
||||
exConfigSheet(ex, { sets: 3, reps: 10, weight: 0, mode: 'reps', prog: 'double' }, onSave)
|
||||
const sheet = useUI.getState().sheets.at(-1)
|
||||
const host = document.createElement('div')
|
||||
document.body.appendChild(host)
|
||||
const root = createRoot(host)
|
||||
mounted.push(root)
|
||||
act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
|
||||
const stepper = [...host.querySelectorAll('.stp-w')]
|
||||
.find(el => el.querySelector('.stp-l')?.textContent.startsWith('Step'))
|
||||
return { host, step: stepper.querySelector('input'), onSave }
|
||||
}
|
||||
|
||||
describe('exercise configuration progression step', () => {
|
||||
beforeEach(() => {
|
||||
globalThis.IS_REACT_ACT_ENVIRONMENT = true
|
||||
useUI.setState({ sheets: [] })
|
||||
useStore.setState(s => ({ S: { ...s.S, unit: 'kg' } }))
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
act(() => { mounted.splice(0).forEach(root => root.unmount()) })
|
||||
})
|
||||
|
||||
it('keeps the draft empty while clearing the default so a sub-one comma decimal can be entered', () => {
|
||||
const { step } = renderConfig()
|
||||
expect(step.value).toBe('2.5')
|
||||
|
||||
act(() => { type(step, '') })
|
||||
expect(step.value).toBe('')
|
||||
|
||||
act(() => { type(step, '0,5') })
|
||||
expect(step.value).toBe('0.5')
|
||||
})
|
||||
|
||||
it('persists a positive decimal but omits a cleared progression increment', () => {
|
||||
const positive = renderConfig()
|
||||
act(() => { type(positive.step, '0,5') })
|
||||
const positiveSave = [...positive.host.querySelectorAll('button')]
|
||||
.find(b => /^(save|add to routine)$/i.test(b.textContent.trim()))
|
||||
act(() => { positiveSave.click() })
|
||||
expect(positive.onSave).toHaveBeenCalledWith(expect.objectContaining({ inc: 0.5 }))
|
||||
|
||||
const empty = renderConfig()
|
||||
act(() => { type(empty.step, '') })
|
||||
const emptySave = [...empty.host.querySelectorAll('button')]
|
||||
.find(b => /^(save|add to routine)$/i.test(b.textContent.trim()))
|
||||
act(() => { emptySave.click() })
|
||||
expect(empty.onSave.mock.calls[0][0]).not.toHaveProperty('inc')
|
||||
})
|
||||
})
|
||||
@@ -56,7 +56,8 @@ let workDone = null
|
||||
export const useUI = create((set, get) => ({
|
||||
sheets: [], // { id, render:(close)=>JSX, kind:'sheet'|'center', locked }
|
||||
toastMsg: '',
|
||||
timer: null, // rest countdown between sets — { left, total, endsAt }
|
||||
timer: null, // rest countdown between sets — { left, total, endsAt, forIdx }
|
||||
// forIdx: index of the active entry whose set started the rest (undefined when unknown)
|
||||
work: null, // work countdown DURING a timed set (issue #16) — { left, total, endsAt, label }
|
||||
|
||||
openSheet(render, { kind = 'sheet', locked = false } = {}) {
|
||||
@@ -74,10 +75,13 @@ export const useUI = create((set, get) => ({
|
||||
toastTm = setTimeout(() => set({ toastMsg: '' }), 2200)
|
||||
},
|
||||
|
||||
startRest(sec) {
|
||||
startRest(sec, forIdx) {
|
||||
get().stopRest()
|
||||
// Rest timer set to Off. Stopping and returning rather than starting a zero-length timer
|
||||
// keeps every caller honest: the four places that start a rest do not each need to know.
|
||||
if (!(sec > 0)) return
|
||||
const endsAt = Date.now() + sec * 1000
|
||||
set({ timer: { left: sec, total: sec, endsAt } })
|
||||
set({ timer: { left: sec, total: sec, endsAt, forIdx } })
|
||||
requestRestNotificationPermission()
|
||||
pushRestTimer(sec)
|
||||
timerTick = () => {
|
||||
@@ -106,6 +110,13 @@ export const useUI = create((set, get) => ({
|
||||
set({ timer: { ...tm, left, total: tm.total + sec, endsAt: tm.endsAt + sec * 1000 } })
|
||||
pushRestTimer(left)
|
||||
},
|
||||
// The active list changed shape (an exercise removed or inserted at `at`): keep the rest
|
||||
// pointing at the same exercise. Returns nothing; the caller decides whether to stop instead.
|
||||
shiftRestOwner(at, delta) {
|
||||
const tm = get().timer
|
||||
if (!tm || !(tm.forIdx >= at)) return
|
||||
set({ timer: { ...tm, forIdx: tm.forIdx + delta } })
|
||||
},
|
||||
stopRest() {
|
||||
if (timerInt) clearInterval(timerInt); timerInt = null
|
||||
if (timerTick) document.removeEventListener('visibilitychange', timerTick); timerTick = null
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// @vitest-environment happy-dom
|
||||
// useUI pulls in api.js, which reads navigator.userAgent at module scope.
|
||||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest'
|
||||
import { useUI } from './useUI.js'
|
||||
|
||||
// "Off" has to hold at the timer itself, not at the four places that start one — the same
|
||||
// reason the rest-after-a-set rule is a shared condition rather than four copies.
|
||||
describe('rest timer set to Off', () => {
|
||||
beforeEach(() => { vi.useFakeTimers(); useUI.setState({ timer: null }) })
|
||||
afterEach(() => { useUI.getState().stopRest(); vi.useRealTimers() })
|
||||
|
||||
it('starts nothing', () => {
|
||||
useUI.getState().startRest(0)
|
||||
expect(useUI.getState().timer).toBe(null)
|
||||
})
|
||||
|
||||
it('stops a rest that is already running', () => {
|
||||
useUI.getState().startRest(90)
|
||||
expect(useUI.getState().timer).not.toBe(null)
|
||||
useUI.getState().startRest(0)
|
||||
expect(useUI.getState().timer).toBe(null)
|
||||
})
|
||||
|
||||
it('still runs for a real duration', () => {
|
||||
useUI.getState().startRest(90)
|
||||
expect(useUI.getState().timer.total).toBe(90)
|
||||
})
|
||||
})
|
||||
@@ -131,7 +131,7 @@ export default function Settings() {
|
||||
<Section title={t('During a workout')} footer={wakeOK ? t('The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.') : null}>
|
||||
<SelectRow icon="timer" iconTint="var(--orange)" title={t('Rest timer')}
|
||||
value={S.restSec} onChange={v => update(s => { s.restSec = v })}
|
||||
options={[60, 90, 120, 150, 180].map(v => ({ value: v, label: v + 's' }))} />
|
||||
options={[{ value: 0, label: t('Off') }, ...[60, 90, 120, 150, 180].map(v => ({ value: v, label: v + 's' }))]} />
|
||||
{/* Default for a rest-pause burst added live on a plain set — a planned exercise's own
|
||||
"Rest (s)" (in its Intensifier config) overrides this, same as the main rest timer
|
||||
is the fallback whenever an exercise has no progression rule of its own. */}
|
||||
@@ -223,8 +223,12 @@ export default function Settings() {
|
||||
subtitle={t('to install openGym as a full-screen app.') + ' ' + (user ? t('Your data syncs with your profile — sign in anywhere to see it.') : t('Guest data stays on this device — export a backup now and then!'))} />
|
||||
</Section>}
|
||||
|
||||
{/* The version, at the bottom of Settings — which is where the support template has been
|
||||
telling people to look for it, and where it was not. On the phone build there is no
|
||||
address bar and no about box, so without this there is no way to tell which build you
|
||||
are running, or whether an update actually installed. */}
|
||||
<div className="dim small" style={{ textAlign: 'center', marginTop: 4, lineHeight: 1.6 }}>
|
||||
openGym · {t('free & open source (AGPL v3)')}<br />
|
||||
openGym v{__APP_VERSION__} · {t('free & open source (AGPL v3)')}<br />
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" target="_blank" rel="noopener">source code</a> · exercise data: hasaneyldrm/exercises-dataset (MIT)<br />
|
||||
exercise images and animations © <a href="https://gymvisual.com/" target="_blank" rel="noopener">Gym visual</a>
|
||||
</div>
|
||||
|
||||
@@ -360,7 +360,15 @@ export default function Stats() {
|
||||
}
|
||||
// Estimated 1RM (issue #18) — only reps-mode training produces one, so cardio and timed
|
||||
// work simply have no points and the toggle stays hidden.
|
||||
const e1Pts = curEx && curMode === 'reps' ? e1rmSeries(S, curEx) : []
|
||||
// Both memoised on the same inputs, and it has to start at e1rmSeries: LineChart clears its
|
||||
// hover whenever `points` changes identity, so a chart array rebuilt on every render made the
|
||||
// tooltip vanish under your finger the moment anything else on this screen re-rendered.
|
||||
// Memoising only the .map() would not have helped — its dependency was itself rebuilt each time.
|
||||
const e1Pts = useMemo(
|
||||
() => (curEx && curMode === 'reps' ? e1rmSeries(S, curEx) : []),
|
||||
[S, curEx, curMode],
|
||||
)
|
||||
const e1ChartPts = useMemo(() => e1Pts.map(p => ({ t: p.t, y: p.y, d: p.d })), [e1Pts])
|
||||
const e1Best = curEx && curMode === 'reps' ? best1RM(S, curEx) : null
|
||||
const showE1 = e1Pts.length > 0
|
||||
// Effort on this exercise, per session. It rides on the top-set curve as well as having a
|
||||
@@ -419,14 +427,14 @@ export default function Stats() {
|
||||
<h2>{t('Exercise progress')}</h2>
|
||||
{exHist.length ? <>
|
||||
<div className="sect-b" style={{ marginBottom: 10 }}>
|
||||
<SelectRow title={t('Exercise')} sheetTitle={t('Exercise progress')} value={curEx} onChange={setExId}
|
||||
<SelectRow title={t('Exercise')} sheetTitle={t('Exercise progress')} value={curEx} onChange={setExId} stackedValue
|
||||
options={exHist.map(id => ({ value: id, label: nameOf(id) + (exCurrent[id].mx ? ' ' + '—' + ' ' + fmtNum(exCurrent[id].mx) + ' ' + exCurrent[id].unit : '') }))} />
|
||||
</div>
|
||||
{exOpts.length > 1 && <Segmented className="seg-range" value={onEff ? 'effort' : onE1 ? 'e1rm' : 'top'} onChange={setExMetric} options={exOpts} />}
|
||||
<div className="chart">
|
||||
{onEff
|
||||
? <LineChart points={effPts} h={150} unit={hd} color="var(--yellow)" invert={kind === 'rir'} />
|
||||
: <LineChart points={onE1 ? e1Pts.map(p => ({ t: p.t, y: p.y, d: p.d })) : topPts} h={150} unit={exUnit} color="var(--blue)" />}
|
||||
: <LineChart points={onE1 ? e1ChartPts : topPts} h={150} unit={exUnit} color="var(--blue)" />}
|
||||
</div>
|
||||
<div style={{ marginTop: 8 }}>{exList.map((p, i) => <div key={i} className="row between small" style={{ padding: '6px 0', borderBottom: 'var(--hair) solid var(--sep)' }}>
|
||||
<span className="muted">{fmtDate(p.d, true)}</span><span>{p.sets.map(s => setLabel(curEx, s, p.target)).join(' ')}</span></div>)}</div>
|
||||
|
||||
@@ -3,6 +3,8 @@ import { readFileSync } from 'node:fs'
|
||||
import { bestWeightForEntry, metricModeForEntry, metricRowsForEntry } from '../lib/history.js'
|
||||
|
||||
const source = readFileSync(new URL('./Stats.jsx', import.meta.url), 'utf8')
|
||||
const uiSource = readFileSync(new URL('../components/ui.jsx', import.meta.url), 'utf8')
|
||||
const cssSource = readFileSync(new URL('../index.css', import.meta.url), 'utf8')
|
||||
|
||||
describe('Stats mixed-entry metric contract', () => {
|
||||
it('selects authoritative reps rows before timed rows without stale topW', () => {
|
||||
@@ -27,4 +29,13 @@ describe('Stats mixed-entry metric contract', () => {
|
||||
expect(source).not.toContain('const loggedMode = entryMode(en)')
|
||||
expect(source).not.toContain('(en.topW || 0)')
|
||||
})
|
||||
|
||||
it('stacks the Stats exercise selector value without changing shared SelectRow defaults', () => {
|
||||
expect(source).toContain("onChange={setExId} stackedValue")
|
||||
expect(uiSource).toContain('sheetTitle, stackedValue = false')
|
||||
expect(uiSource).toContain("className={stackedValue ? 'lrow-stack-value' : ''}")
|
||||
expect(cssSource).toContain('.lrow.lrow-stack-value .lrow-m{grid-column:1;grid-row:1}')
|
||||
expect(cssSource).toContain('.lrow.lrow-stack-value .lrow-v{grid-column:1;grid-row:2;text-align:left}')
|
||||
expect(cssSource).toContain('overflow:hidden;text-overflow:ellipsis;white-space:nowrap')
|
||||
})
|
||||
})
|
||||
@@ -8,9 +8,9 @@ import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
|
||||
import { beep, vibrate } from '../lib/sound.js'
|
||||
import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { api } from '../lib/api.js'
|
||||
import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from '../lib/supersetFlow.js'
|
||||
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from '../lib/supersetFlow.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet } from '../sheets.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button, Check, NumberField } from '../components/ui.jsx'
|
||||
import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'
|
||||
@@ -261,6 +261,13 @@ export function removeActiveExercise(idx) {
|
||||
// Clear the work callback before indexes can shift. This also protects a confirmation sheet
|
||||
// that was opened first and confirmed after a timed hold started.
|
||||
useUI.getState().stopWork()
|
||||
// A rest countdown belongs to the exercise whose set started it (timer.forIdx). Removing that
|
||||
// exercise ends the rest — there is nothing left to rest for. Removing any other exercise
|
||||
// keeps the countdown and only re-points it, so a pause you are in the middle of survives
|
||||
// tidying up the list.
|
||||
const rest = useUI.getState().timer
|
||||
if (rest && rest.forIdx === idx) useUI.getState().stopRest()
|
||||
else useUI.getState().shiftRestOwner(idx + 1, -1)
|
||||
useStore.getState().update(s => {
|
||||
if (!s.active || !Array.isArray(s.active.entries)) return
|
||||
if (idx < 0 || idx >= s.active.entries.length) return
|
||||
@@ -275,7 +282,7 @@ function ActiveWorkout() {
|
||||
const nav = useNavigate()
|
||||
const S = useStore(s => s.S)
|
||||
const update = useStore(s => s.update)
|
||||
const { startRest, stopRest, work } = useUI()
|
||||
const { startRest, stopRest, stopWork, work } = useUI()
|
||||
const A = S.active
|
||||
const units = supersetUnits(A.entries)
|
||||
const cur = Math.min(A.cur, Math.max(0, A.entries.length - 1))
|
||||
@@ -382,7 +389,6 @@ function ActiveWorkout() {
|
||||
const toggle = (idx, i) => {
|
||||
const m = modeAt(idx)
|
||||
const cardioEntry = m === 'cardio'
|
||||
const isLastUnit = unitIdx >= units.length - 1
|
||||
let askTop = false, exJustDone = false, workoutDone = false, checked = false
|
||||
mutEntry(idx, e => {
|
||||
e.sets[i].done = !e.sets[i].done
|
||||
@@ -390,7 +396,7 @@ function ActiveWorkout() {
|
||||
if (e.sets[i].done) {
|
||||
beep(S.sound, 1040, 0.12); vibrate(30)
|
||||
const unitDone = unit.every(ui => (ui === idx ? e : A.entries[ui]).sets.every(x => x.done))
|
||||
if (unitDone && isLastUnit) workoutDone = true // last exercise's last set → done
|
||||
if (unitDone) workoutDone = !nextUnfinishedUnit(A.entries, supersetUnits(A.entries), idx)
|
||||
// Only loaded reps training has a "working weight" worth confirming — a bodyweight
|
||||
// plank has nothing to put in that slider, and neither does a set of push-ups
|
||||
// (issue #32: the fewest taps that still record what happened).
|
||||
@@ -414,38 +420,41 @@ function ActiveWorkout() {
|
||||
|
||||
const freshUnits = supersetUnits(fresh.entries)
|
||||
const freshUnit = freshUnits.find(u => u.includes(idx))
|
||||
const freshUnitIdx = freshUnits.indexOf(freshUnit)
|
||||
const freshLastUnit = freshUnitIdx >= freshUnits.length - 1
|
||||
const freshUnitDone = freshUnit?.every(ui => fresh.entries[ui].sets.every(x => x.done))
|
||||
const nextUnit = freshUnitDone ? nextUnfinishedUnit(fresh.entries, freshUnits, idx) : null
|
||||
const freshWorkoutDone = freshUnitDone && !nextUnit
|
||||
const restBeforeWarmup = nextUnit?.some(ui =>
|
||||
fresh.entries[ui].sets.some(set => isWarmupRow(set) && !set.done),
|
||||
)
|
||||
|
||||
// A re-check of finished work must not navigate or reopen a sheet, but it may still owe
|
||||
// you a rest — see restOnRecheck, and the other half of issue #3.
|
||||
if (!progress.isNew) {
|
||||
if (restOnRecheck({ timerRunning: !!useUI.getState().timer, unitDone: freshUnitDone, lastUnit: freshLastUnit })) startRest(S.restSec)
|
||||
if (!restBeforeWarmup && restOnRecheck({ timerRunning: !!useUI.getState().timer, unitDone: freshUnitDone, lastUnit: freshWorkoutDone })) startRest(S.restSec, idx)
|
||||
return
|
||||
}
|
||||
|
||||
// Singleton units are ordinary exercises: they rest between sets and after the closing
|
||||
// one, and never enter superset navigation. stopRest() first so the rest that belongs
|
||||
// after this set replaces the one that was running, rather than stacking on it.
|
||||
// one unless the next unit has an unfinished warm-up, and never enter superset navigation.
|
||||
// stopRest() first so a rest that belongs after this set replaces the one that was running.
|
||||
if (freshUnitDone) stopRest()
|
||||
if (!freshUnit || freshUnit.length <= 1) {
|
||||
if (restAfterSet({ unitDone: freshUnitDone, lastUnit: freshLastUnit })) startRest(S.restSec)
|
||||
if (freshUnitDone && !askTop && nextUnit?.length) update(s => { if (s.active) s.active.cur = nextUnit[0] })
|
||||
if (!restBeforeWarmup && restAfterSet({ unitDone: freshUnitDone, lastUnit: freshWorkoutDone })) startRest(S.restSec, idx)
|
||||
return
|
||||
}
|
||||
|
||||
const step = supersetFlowStep(fresh.entries, freshUnit, idx)
|
||||
if (!step) return
|
||||
if (step.unitDone) {
|
||||
if (!freshLastUnit) {
|
||||
const nextUnit = freshUnits[freshUnitIdx + 1]
|
||||
if (nextUnit?.length) {
|
||||
// The top-weight sheet's explicit "Just close" path owns the choice not to advance.
|
||||
if (!askTop && nextUnit?.length) update(s => { if (s.active) s.active.cur = nextUnit[0] })
|
||||
startRest(S.restSec)
|
||||
if (!askTop) update(s => { if (s.active) s.active.cur = nextUnit[0] })
|
||||
if (!restBeforeWarmup) startRest(S.restSec, idx)
|
||||
}
|
||||
} else {
|
||||
if (step.nextIdx != null) update(s => { if (s.active) s.active.cur = step.nextIdx })
|
||||
if (step.roundDone) startRest(S.restSec)
|
||||
if (step.roundDone) startRest(S.restSec, idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,7 +488,7 @@ function ActiveWorkout() {
|
||||
|
||||
return <div className="narrow">
|
||||
<div className="hdr">
|
||||
<button className="iconbtn" aria-label={t('Discard')} onClick={() => confirmSheet({ title: t('Discard workout?'), message: t('The sets you logged in this session will be lost.'), confirmText: t('Discard'), danger: true, onConfirm: () => { update(s => { s.active = null }); stopRest(); nav('/home') } })}><Icon name="xmark" /></button>
|
||||
<button className="iconbtn" aria-label={t('Discard')} onClick={() => confirmSheet({ title: t('Discard workout?'), message: t('The sets you logged in this session will be lost.'), confirmText: t('Discard'), danger: true, onConfirm: () => { update(s => { s.active = null }); stopRest(); stopWork(); nav('/home') } })}><Icon name="xmark" /></button>
|
||||
<div style={{ textAlign: 'center' }}><div style={{ fontWeight: 600 }}>{A.name}</div><div className="sub"><Elapsed start={A.start} /> · {t('{0} sets', done + '/' + total)}</div></div>
|
||||
<button className="iconbtn" style={{ color: 'var(--acc)' }} aria-label={t('Finish')} onClick={finishWorkout}><Icon name="check" /></button>
|
||||
</div>
|
||||
@@ -520,9 +529,11 @@ function ActiveWorkout() {
|
||||
const full = { ...cfg, id: ex.id }
|
||||
const plan = freestyle ? null : nextPrescription(s, full, s.routines.find(r => r.id === s.active.routineId))
|
||||
const sets = buildSets(s, full, { step: defaultIncrement(ex.id, s.unit), ...(freestyle ? { preferLast: true } : {}) })
|
||||
const progressed = freestyle ? sets : applyPrescription(sets, plan)
|
||||
s.active.entries.push({ id: ex.id, target: { ...cfg }, plan, sets: applyIntensifierPlan(progressed, full) })
|
||||
s.active.cur = s.active.entries.length - 1
|
||||
const progressed = freestyle ? sets : applyPrescription(sets, plan, defaultIncrement(ex.id, s.unit))
|
||||
const insertAt = insertionIndexAfterCurrentUnit(supersetUnits(s.active.entries), s.active.cur, s.active.entries.length)
|
||||
s.active.entries.splice(insertAt, 0, { id: ex.id, target: { ...cfg }, plan, sets: applyIntensifierPlan(progressed, full) })
|
||||
s.active.cur = insertAt
|
||||
useUI.getState().shiftRestOwner(insertAt, 1)
|
||||
}), null, routine, seed)
|
||||
})} icon="plus">{t('Add exercise')}</Button>
|
||||
{A.entries.length > 0 && <>
|
||||
@@ -532,6 +543,13 @@ function ActiveWorkout() {
|
||||
</div>
|
||||
</>}
|
||||
<div style={{ height: 10 }} />
|
||||
{/* Wrapping up is when you know how the session went, so the note sits with the finish
|
||||
button rather than somewhere in the header. */}
|
||||
<div style={{ display: 'flex', justifyContent: 'center', marginBottom: 10 }}>
|
||||
<Button size="sm" icon="pencil" variant={A.note ? 'tinted' : undefined} onClick={sessionNoteSheet}>
|
||||
{A.note ? t('Edit session note') : t('Add session note')}
|
||||
</Button>
|
||||
</div>
|
||||
{(() => {
|
||||
const exDone = A.entries.filter(e => e.sets.length && e.sets.every(s => s.done)).length
|
||||
const allDone = A.entries.length > 0 && exDone === A.entries.length
|
||||
|
||||
@@ -21,6 +21,8 @@ const entry = (id, sg) => ({
|
||||
|
||||
let root
|
||||
let container
|
||||
let sheetRoot
|
||||
let sheetContainer
|
||||
|
||||
function setActive(entries, cur = 0) {
|
||||
const S = clone(DEF)
|
||||
@@ -43,6 +45,18 @@ function removeButton() {
|
||||
return [...container.querySelectorAll('button')].find(button => button.textContent.includes('Remove exercise'))
|
||||
}
|
||||
|
||||
function renderTopSheet() {
|
||||
if (sheetRoot) act(() => sheetRoot.unmount())
|
||||
if (sheetContainer) sheetContainer.remove()
|
||||
const sheet = useUI.getState().sheets.at(-1)
|
||||
expect(sheet).toBeTruthy()
|
||||
sheetContainer = document.createElement('div')
|
||||
document.body.appendChild(sheetContainer)
|
||||
sheetRoot = createRoot(sheetContainer)
|
||||
act(() => sheetRoot.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
|
||||
return sheetContainer
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers()
|
||||
localStorage.clear()
|
||||
@@ -52,9 +66,13 @@ beforeEach(() => {
|
||||
useStore.setState({ S: clone(DEF), user: null })
|
||||
root = null
|
||||
container = null
|
||||
sheetRoot = null
|
||||
sheetContainer = null
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
if (sheetRoot) act(() => sheetRoot.unmount())
|
||||
if (sheetContainer) sheetContainer.remove()
|
||||
if (root) act(() => root.unmount())
|
||||
if (container) container.remove()
|
||||
useUI.getState().stopRest()
|
||||
@@ -94,6 +112,82 @@ describe('active-session exercise removal', () => {
|
||||
expect(active.entries[0].sets[0].sec).toBeUndefined()
|
||||
})
|
||||
|
||||
it('cancels a running rest countdown when the exercise it belongs to is removed', () => {
|
||||
setActive([entry('1001'), entry('1002')], 0)
|
||||
useUI.getState().startRest(90, 0)
|
||||
expect(useUI.getState().timer).not.toBeNull()
|
||||
|
||||
act(() => { removeActiveExercise(0) })
|
||||
|
||||
expect(useUI.getState().timer).toBeNull()
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['1002'])
|
||||
})
|
||||
|
||||
it('keeps a rest countdown that belongs to another exercise, re-pointed at it', () => {
|
||||
setActive([entry('1001'), entry('1002'), entry('1003')], 1)
|
||||
useUI.getState().startRest(90, 1)
|
||||
|
||||
act(() => { removeActiveExercise(0) })
|
||||
expect(useUI.getState().timer?.forIdx).toBe(0)
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['1002', '1003'])
|
||||
|
||||
act(() => { removeActiveExercise(1) })
|
||||
expect(useUI.getState().timer?.forIdx).toBe(0)
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['1002'])
|
||||
|
||||
act(() => { removeActiveExercise(0) })
|
||||
expect(useUI.getState().timer).toBeNull()
|
||||
})
|
||||
|
||||
it('leaves a rest countdown without a known owner running', () => {
|
||||
setActive([entry('1001'), entry('1002')], 0)
|
||||
useUI.getState().startRest(90)
|
||||
|
||||
act(() => { removeActiveExercise(0) })
|
||||
expect(useUI.getState().timer).not.toBeNull()
|
||||
})
|
||||
|
||||
it('does not mutate before confirmation, leaves state unchanged on Cancel, and removes on Confirm', () => {
|
||||
renderWorkout([entry('1001'), entry('1002')])
|
||||
|
||||
act(() => removeButton().click())
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['1001', '1002'])
|
||||
|
||||
let dialog = renderTopSheet()
|
||||
const cancel = [...dialog.querySelectorAll('button')].find(button => button.textContent === 'Cancel')
|
||||
act(() => cancel.click())
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['1001', '1002'])
|
||||
|
||||
act(() => removeButton().click())
|
||||
dialog = renderTopSheet()
|
||||
const confirm = [...dialog.querySelectorAll('button')].find(button => button.textContent === 'Remove')
|
||||
act(() => confirm.click())
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['1002'])
|
||||
})
|
||||
|
||||
it('uses the selected superset member occurrence rather than its exercise id', () => {
|
||||
renderWorkout([entry('1001', 'pair'), entry('1001', 'pair'), entry('1002')])
|
||||
useStore.getState().update(s => {
|
||||
s.active.entries[0].target.marker = 'keep-first'
|
||||
s.active.entries[1].target.marker = 'remove-second'
|
||||
}, false)
|
||||
|
||||
act(() => removeButton().click())
|
||||
const chooser = renderTopSheet()
|
||||
const choices = [...chooser.querySelectorAll('.item')]
|
||||
expect(choices).toHaveLength(2)
|
||||
act(() => choices[1].click())
|
||||
|
||||
const dialog = renderTopSheet()
|
||||
const confirm = [...dialog.querySelectorAll('button')].find(button => button.textContent === 'Remove')
|
||||
act(() => confirm.click())
|
||||
|
||||
const active = useStore.getState().S.active
|
||||
expect(active.entries.map(e => e.id)).toEqual(['1001', '1002'])
|
||||
expect(active.entries[0].target.marker).toBe('keep-first')
|
||||
expect(active.entries[0].sg).toBeUndefined()
|
||||
})
|
||||
|
||||
it('hides the remove control for an empty freestyle session', () => {
|
||||
renderWorkout([])
|
||||
expect(removeButton()).toBeUndefined()
|
||||
@@ -143,4 +237,26 @@ describe('remove-exercise edge cases', () => {
|
||||
expect(A.entries.map(e => e.id)).toEqual(['b', 'c'])
|
||||
expect(A.entries[A.cur].id).toBe('c')
|
||||
})
|
||||
|
||||
it('persists the shortened active session for reload without changing completed history', () => {
|
||||
const first = entry('same')
|
||||
first.target.marker = 'keep-first'
|
||||
const second = entry('same')
|
||||
second.target.marker = 'remove-second'
|
||||
setActive([first, second, entry('other')], 1)
|
||||
const workouts = [{ id: 'completed', d: '2026-08-10', entries: [{ id: 'same', sets: [{ w: 42, r: 5, done: true }] }] }]
|
||||
useStore.setState(state => ({ S: { ...state.S, workouts: clone(workouts) } }))
|
||||
|
||||
act(() => { removeActiveExercise(1) })
|
||||
|
||||
const persisted = JSON.parse(localStorage.getItem('gym_state_v1'))
|
||||
expect(persisted.workouts).toEqual(workouts)
|
||||
expect(persisted.active.entries.map(e => e.id)).toEqual(['same', 'other'])
|
||||
expect(persisted.active.entries[0].target.marker).toBe('keep-first')
|
||||
expect(persisted.active.cur).toBe(1)
|
||||
|
||||
useStore.setState({ S: Object.assign(clone(DEF), persisted), user: null })
|
||||
expect(useStore.getState().S.active.entries.map(e => e.id)).toEqual(['same', 'other'])
|
||||
expect(useStore.getState().S.workouts).toEqual(workouts)
|
||||
})
|
||||
})
|
||||
@@ -7,21 +7,38 @@ import Workout from './Workout.jsx'
|
||||
const mocks = vi.hoisted(() => {
|
||||
const state = {
|
||||
S: null,
|
||||
timer: null,
|
||||
work: null,
|
||||
startRest: vi.fn(),
|
||||
stopRest: vi.fn(),
|
||||
stopRest: null,
|
||||
stopWork: null,
|
||||
confirmSheet: vi.fn(),
|
||||
topWeightSheet: vi.fn(),
|
||||
workoutCompleteSheet: vi.fn(),
|
||||
exercisePicker: vi.fn(),
|
||||
exConfigSheet: vi.fn(),
|
||||
toast: vi.fn(),
|
||||
}
|
||||
state.stopRest = vi.fn(() => { state.timer = null })
|
||||
state.stopWork = vi.fn(() => { state.work = null })
|
||||
state.storeSnapshot = () => ({
|
||||
S: state.S,
|
||||
user: null,
|
||||
update: mut => mut(state.S),
|
||||
update: mut => {
|
||||
const next = structuredClone(state.S)
|
||||
mut(next)
|
||||
state.S = next
|
||||
},
|
||||
})
|
||||
state.uiSnapshot = () => ({
|
||||
work: null,
|
||||
timer: state.timer,
|
||||
work: state.work,
|
||||
startRest: state.startRest,
|
||||
stopRest: state.stopRest,
|
||||
stopWork: state.stopWork,
|
||||
shiftRestOwner: vi.fn(),
|
||||
startWork: vi.fn(),
|
||||
toast: vi.fn(),
|
||||
toast: state.toast,
|
||||
})
|
||||
return state
|
||||
})
|
||||
@@ -39,13 +56,17 @@ vi.mock('../store/useUI.js', () => {
|
||||
vi.mock('react-router-dom', () => ({ useNavigate: () => () => {} }))
|
||||
vi.mock('../sheets.jsx', () => ({
|
||||
startFlow: vi.fn(),
|
||||
exercisePicker: vi.fn(),
|
||||
exConfigSheet: vi.fn(),
|
||||
exercisePicker: mocks.exercisePicker,
|
||||
exConfigSheet: mocks.exConfigSheet,
|
||||
exerciseDetailSheet: vi.fn(),
|
||||
topWeightSheet: mocks.topWeightSheet,
|
||||
finishWorkout: vi.fn(),
|
||||
workoutCompleteSheet: vi.fn(),
|
||||
confirmSheet: vi.fn(),
|
||||
workoutCompleteSheet: mocks.workoutCompleteSheet,
|
||||
confirmSheet: mocks.confirmSheet,
|
||||
// Both note sheets belong here even though the tests never open one: Workout.jsx reads
|
||||
// sessionNoteSheet during render, so a missing export is a render crash, not a no-op.
|
||||
exerciseNoteSheet: vi.fn(),
|
||||
sessionNoteSheet: vi.fn(),
|
||||
}))
|
||||
vi.mock('../components/Media.jsx', () => ({ default: () => null }))
|
||||
// api.js reads navigator.userAgent at module scope. This file installs its own DOM inside the
|
||||
@@ -68,11 +89,13 @@ function exercise(id, sets, extra = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
function workout(entries, cur = 0) {
|
||||
function workout(entries, cur = 0, overrides = {}) {
|
||||
const { active: activeOverrides = {}, ...stateOverrides } = overrides
|
||||
return {
|
||||
unit: 'kg', restSec: 90, sound: false, effort: 'none', gifSize: 'full',
|
||||
workouts: [], exWeights: {}, routines: [],
|
||||
active: { id: 'active', name: 'Test workout', start: Date.now(), cur, entries },
|
||||
active: { id: 'active', name: 'Test workout', start: Date.now(), cur, entries, ...activeOverrides },
|
||||
...stateOverrides,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +111,8 @@ function installDom() {
|
||||
root = createRoot(container)
|
||||
}
|
||||
|
||||
async function mount(entries, cur = 0) {
|
||||
mocks.S = workout(entries, cur)
|
||||
async function mount(entries, cur = 0, overrides = {}) {
|
||||
mocks.S = workout(entries, cur, overrides)
|
||||
installDom()
|
||||
await act(async () => { root.render(React.createElement(Workout)) })
|
||||
}
|
||||
@@ -108,8 +131,35 @@ async function toggleSet(index) {
|
||||
await act(async () => { checkbox.dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
}
|
||||
|
||||
async function requestDiscard() {
|
||||
const button = container.querySelector('button[aria-label="Discard"]')
|
||||
expect(button).toBeTruthy()
|
||||
await act(async () => { button.dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
}
|
||||
|
||||
async function rerender() {
|
||||
await act(async () => { root.render(React.createElement(Workout)) })
|
||||
}
|
||||
|
||||
async function addExerciseThroughSheets(ex = { id: 'added-exercise' }, cfg = { mode: 'reps', sets: 1, reps: 5, weight: 0 }) {
|
||||
const addButton = [...container.querySelectorAll('button')]
|
||||
.find(button => button.textContent.trim() === 'Add exercise')
|
||||
expect(addButton).toBeTruthy()
|
||||
await act(async () => { addButton.dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
|
||||
const pickerCall = mocks.exercisePicker.mock.calls.at(-1)
|
||||
expect(pickerCall?.[0]).toEqual(expect.any(Function))
|
||||
await act(async () => { pickerCall[0](ex) })
|
||||
|
||||
const configCall = mocks.exConfigSheet.mock.calls.at(-1)
|
||||
expect(configCall?.[2]).toEqual(expect.any(Function))
|
||||
await act(async () => { configCall[2](cfg) })
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mocks.timer = null
|
||||
mocks.work = null
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -122,7 +172,7 @@ describe('Workout set completion flow', () => {
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.startRest).toHaveBeenCalledOnce()
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90)
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90, expect.any(Number))
|
||||
expect(mocks.stopRest).not.toHaveBeenCalled()
|
||||
|
||||
await unmount()
|
||||
@@ -136,6 +186,85 @@ describe('Workout set completion flow', () => {
|
||||
expect(mocks.startRest).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it.each(['warmup', 'warm-up', 'warm_up'])(
|
||||
'does not start transition rest before an incomplete %s row in the next ordinary exercise',
|
||||
async phase => {
|
||||
await mount([
|
||||
exercise('current', [false], { asked: true }),
|
||||
exercise('next', [false, false], {
|
||||
asked: true,
|
||||
sets: [
|
||||
{ w: 30, r: 5, done: false, phase },
|
||||
{ w: 60, r: 5, done: false },
|
||||
],
|
||||
}),
|
||||
])
|
||||
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.S.active.cur).toBe(1)
|
||||
expect(mocks.startRest).not.toHaveBeenCalled()
|
||||
},
|
||||
)
|
||||
|
||||
it('does not start transition rest when a completed superset advances to an incomplete warm-up', async () => {
|
||||
await mount([
|
||||
exercise('superset-a', [true], { sg: 'group', asked: true }),
|
||||
exercise('superset-b', [false], { sg: 'group', asked: true }),
|
||||
exercise('next', [false, false], {
|
||||
asked: true,
|
||||
sets: [
|
||||
{ w: 30, r: 5, done: false, phase: 'warmup' },
|
||||
{ w: 60, r: 5, done: false },
|
||||
],
|
||||
}),
|
||||
], 1)
|
||||
|
||||
await toggleSet(1)
|
||||
|
||||
expect(mocks.S.active.cur).toBe(2)
|
||||
expect(mocks.startRest).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not start transition rest before a warm-up while top-weight confirmation owns navigation', async () => {
|
||||
await mount([
|
||||
exercise('current-loaded', [false]),
|
||||
exercise('next', [false, false], {
|
||||
asked: true,
|
||||
sets: [
|
||||
{ w: 30, r: 5, done: false, phase: 'warmup' },
|
||||
{ w: 60, r: 5, done: false },
|
||||
],
|
||||
}),
|
||||
])
|
||||
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.topWeightSheet).toHaveBeenCalledWith(0)
|
||||
expect(mocks.S.active.cur).toBe(0)
|
||||
expect(mocks.startRest).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not restart transition rest when re-checking a completed unit before an incomplete warm-up', async () => {
|
||||
await mount([
|
||||
exercise('current', [true], { asked: true }),
|
||||
exercise('next', [false, false], {
|
||||
asked: true,
|
||||
sets: [
|
||||
{ w: 30, r: 5, done: false, phase: 'warmup' },
|
||||
{ w: 60, r: 5, done: false },
|
||||
],
|
||||
}),
|
||||
])
|
||||
|
||||
await toggleSet(0)
|
||||
await rerender()
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.S.active.cur).toBe(0)
|
||||
expect(mocks.startRest).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('leaves a completed superset selected while its top-weight sheet owns the advance choice', async () => {
|
||||
const group = 'superset-1'
|
||||
await mount([
|
||||
@@ -147,7 +276,143 @@ describe('Workout set completion flow', () => {
|
||||
|
||||
expect(mocks.topWeightSheet).toHaveBeenCalledWith(1)
|
||||
expect(mocks.S.active.cur).toBe(1)
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90)
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90, expect.any(Number))
|
||||
})
|
||||
|
||||
it('skips completed intervening units and selects the next unfinished superset as one unit', async () => {
|
||||
await mount([
|
||||
exercise('current-hold', [false], { asked: true, target: { mode: 'time', sec: 30, weight: 0 } }),
|
||||
exercise('already-done', [true], { asked: true }),
|
||||
exercise('pending-a', [false], { sg: 'pending-group' }),
|
||||
exercise('pending-b', [false], { sg: 'pending-group' }),
|
||||
])
|
||||
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.S.active.cur).toBe(2)
|
||||
expect(mocks.workoutCompleteSheet).not.toHaveBeenCalled()
|
||||
expect(mocks.toast).toHaveBeenCalledWith('Hold logged')
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90, expect.any(Number))
|
||||
})
|
||||
|
||||
it('wraps to earlier unfinished work instead of showing a false completion prompt', async () => {
|
||||
await mount([
|
||||
exercise('pending-earlier', [false], { asked: true }),
|
||||
exercise('current-hold', [false], { asked: true, target: { mode: 'time', sec: 30, weight: 0 } }),
|
||||
], 1)
|
||||
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.S.active.cur).toBe(0)
|
||||
expect(mocks.workoutCompleteSheet).not.toHaveBeenCalled()
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90, expect.any(Number))
|
||||
})
|
||||
|
||||
it('keeps top-weight confirmation in control without declaring completion while work remains', async () => {
|
||||
await mount([
|
||||
exercise('current-loaded', [false]),
|
||||
exercise('pending', [false], { asked: true }),
|
||||
])
|
||||
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.topWeightSheet).toHaveBeenCalledWith(0)
|
||||
expect(mocks.workoutCompleteSheet).not.toHaveBeenCalled()
|
||||
expect(mocks.S.active.cur).toBe(0)
|
||||
})
|
||||
|
||||
it('shows workout completion only when no unfinished unit remains', async () => {
|
||||
await mount([
|
||||
exercise('already-done', [true], { asked: true }),
|
||||
exercise('final-hold', [false], { asked: true, target: { mode: 'time', sec: 30, weight: 0 } }),
|
||||
], 1)
|
||||
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.workoutCompleteSheet).toHaveBeenCalledOnce()
|
||||
expect(mocks.startRest).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Workout add exercise flow', () => {
|
||||
it.each([
|
||||
['freestyle', {}],
|
||||
['planned', {
|
||||
active: { routineId: 'routine-1' },
|
||||
routines: [{ id: 'routine-1', ex: [] }],
|
||||
}],
|
||||
])('inserts after the current unit and continues to pending work in a %s session', async (_label, overrides) => {
|
||||
await mount([
|
||||
exercise('current', [true], { asked: true }),
|
||||
exercise('pending', [false], { asked: true }),
|
||||
], 0, overrides)
|
||||
|
||||
await addExerciseThroughSheets(
|
||||
{ id: 'inserted' },
|
||||
{ mode: 'time', sets: 1, sec: 30, weight: 0 },
|
||||
)
|
||||
|
||||
expect(mocks.S.active.entries.map(entry => entry.id)).toEqual(['current', 'inserted', 'pending'])
|
||||
expect(mocks.S.active.cur).toBe(1)
|
||||
|
||||
await rerender()
|
||||
await toggleSet(0)
|
||||
|
||||
expect(mocks.S.active.entries[1].sets[0].done).toBe(true)
|
||||
expect(mocks.S.active.cur).toBe(2)
|
||||
expect(mocks.workoutCompleteSheet).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('inserts after the complete current superset without splitting the group', async () => {
|
||||
await mount([
|
||||
exercise('current-a', [true], { sg: 'current-group', asked: true }),
|
||||
exercise('current-b', [true], { sg: 'current-group', asked: true }),
|
||||
exercise('pending', [false], { asked: true }),
|
||||
])
|
||||
|
||||
await addExerciseThroughSheets({ id: 'inserted' })
|
||||
|
||||
expect(mocks.S.active.entries.map(entry => entry.id)).toEqual([
|
||||
'current-a', 'current-b', 'inserted', 'pending',
|
||||
])
|
||||
expect(mocks.S.active.entries.slice(0, 2).map(entry => entry.sg)).toEqual([
|
||||
'current-group', 'current-group',
|
||||
])
|
||||
expect(mocks.S.active.cur).toBe(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Workout discard timer lifecycle', () => {
|
||||
it('preserves active timers while discard is awaiting confirmation', async () => {
|
||||
const timer = { left: 30, total: 90, endsAt: Date.now() + 30_000 }
|
||||
const work = { left: 20, total: 45, endsAt: Date.now() + 20_000, label: 'Plank' }
|
||||
mocks.timer = timer
|
||||
mocks.work = work
|
||||
await mount([exercise('timed-plank', [false])])
|
||||
|
||||
await requestDiscard()
|
||||
|
||||
expect(mocks.confirmSheet).toHaveBeenCalledOnce()
|
||||
expect(mocks.timer).toBe(timer)
|
||||
expect(mocks.work).toBe(work)
|
||||
expect(mocks.stopRest).not.toHaveBeenCalled()
|
||||
expect(mocks.stopWork).not.toHaveBeenCalled()
|
||||
expect(mocks.S.active).not.toBeNull()
|
||||
})
|
||||
|
||||
it('clears rest and work timers only after discard is confirmed', async () => {
|
||||
mocks.timer = { left: 30, total: 90, endsAt: Date.now() + 30_000 }
|
||||
mocks.work = { left: 20, total: 45, endsAt: Date.now() + 20_000, label: 'Plank' }
|
||||
await mount([exercise('timed-plank', [false])])
|
||||
await requestDiscard()
|
||||
|
||||
await act(async () => { mocks.confirmSheet.mock.calls[0][0].onConfirm() })
|
||||
|
||||
expect(mocks.S.active).toBeNull()
|
||||
expect(mocks.timer).toBeNull()
|
||||
expect(mocks.work).toBeNull()
|
||||
expect(mocks.stopRest).toHaveBeenCalledOnce()
|
||||
expect(mocks.stopWork).toHaveBeenCalledOnce()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -180,6 +445,6 @@ describe('superset flow survives an exercise being removed mid-session', () => {
|
||||
|
||||
// Partner closes the round (each still has a second set), which is what starts the rest.
|
||||
await toggleSet(2)
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90)
|
||||
expect(mocks.startRest).toHaveBeenCalledWith(90, expect.any(Number))
|
||||
})
|
||||
})
|
||||
@@ -1,3 +1,4 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
@@ -28,7 +29,13 @@ const umami = {
|
||||
}
|
||||
}
|
||||
|
||||
// The version people are asked for in #install-help and on every bug report. Read from
|
||||
// package.json so it cannot drift from the release it was built in, and inlined at build
|
||||
// time so no runtime fetch is involved.
|
||||
const pkgVersion = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version
|
||||
|
||||
export default defineConfig({
|
||||
define: { __APP_VERSION__: JSON.stringify(pkgVersion) },
|
||||
plugins: [react(), umami],
|
||||
base: './',
|
||||
server: {
|
||||
|
||||
+12
-4
@@ -15,7 +15,15 @@ Not in this folder (added at deploy time):
|
||||
of exercise media stays out of it. It has to live on this host: the site frames it, and
|
||||
`X-Frame-Options: SAMEORIGIN` would block it from anywhere else.
|
||||
|
||||
`site.js` fetches the star/issue counts and the release timeline from the public
|
||||
gitlab.com API at view time. It pointed at api.github.com until that account was
|
||||
suspended; the two URLs go back once it is restored, together with the notice
|
||||
block at the top of `index.html` and the demo iframe.
|
||||
`site.js` carries four independent pieces, each one failing soft so the page is
|
||||
complete without any of them: the phone nav sheet, the scroll reveals, the demo
|
||||
iframe (injected only once the frame is on screen, and never below 700 px, where
|
||||
the CSS swaps it for an "open it full-screen" card), and the two things that come
|
||||
from the public gitlab.com API at view time — the star/issue counts and the About
|
||||
page's release timeline. Those two URLs pointed at api.github.com until that
|
||||
account was suspended; they go back once it is restored, together with the notice
|
||||
block at the top of all three pages.
|
||||
|
||||
`styles.css` and `site.js` are cache-busted with `?v=N` — nginx serves the site
|
||||
with `no-cache, must-revalidate`, but the query bump is what saves a Cloudflare
|
||||
edge from handing out an old stylesheet with new markup. Bump it on every change.
|
||||
+62
-60
@@ -2,14 +2,15 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<title>About — openGym</title>
|
||||
<meta name="description" content="The story behind openGym: a gym tracker that started as a tiny personal app on a homelab server and grew into an open-source project.">
|
||||
<meta name="theme-color" content="#0c0e12">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
|
||||
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
|
||||
<link rel="apple-touch-icon" href="icon-180.png">
|
||||
<link rel="stylesheet" href="styles.css?v=3">
|
||||
<link rel="stylesheet" href="styles.css?v=9">
|
||||
<script>document.documentElement.className += ' js'</script>
|
||||
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
|
||||
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
|
||||
</head>
|
||||
@@ -17,16 +18,19 @@
|
||||
|
||||
<nav><div class="wrap nav-in">
|
||||
<a class="brand" href="/">
|
||||
<img src="icon-180.png" alt="" width="26" height="26" style="border-radius:6px">
|
||||
<img src="icon-180.png" alt="" width="24" height="24">
|
||||
openGym
|
||||
</a>
|
||||
<div class="nav-links">
|
||||
<a href="/#features" class="hide-s">Features</a>
|
||||
<a href="/#screens" class="hide-s">Screenshots</a>
|
||||
<a href="/#demo" class="hide-s">Demo</a>
|
||||
<button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
|
||||
<span></span><span></span>
|
||||
</button>
|
||||
<div class="nav-links" id="menu">
|
||||
<a href="/#features">Features</a>
|
||||
<a href="/#screens">Screenshots</a>
|
||||
<a href="/#demo">Demo</a>
|
||||
<a href="docs.html">Docs</a>
|
||||
<a href="about.html" class="hide-s">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener"><span data-gh="stars">GitLab</span></a>
|
||||
<a href="about.html">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
|
||||
<a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
|
||||
<a class="cta" href="/#download">Download</a>
|
||||
</div>
|
||||
@@ -34,66 +38,64 @@
|
||||
|
||||
<!-- TEMPORARY: GitHub account suspended -> repo lives on gitlab.com. Remove this block and
|
||||
revert the links (+ site.js) to github.com once the account is restored. -->
|
||||
<div class="alert" role="alert"><div class="wrap">
|
||||
<div class="alert-tag">⚠️ Important notice</div>
|
||||
<h2>My GitHub account has been suspended — the openGym repo is gone with it</h2>
|
||||
<p><b>github.com/DuarteSantos8/openGym is offline.</b> The repository and the releases are
|
||||
unreachable — not by choice. openGym itself is unaffected: the app, the APK on this page,
|
||||
the demo (now hosted here) and every self-hosted install keep working exactly as before.</p>
|
||||
<p>Until I get the account back, the code lives on GitLab — and the Discord is where I will
|
||||
announce the moment it is resolved:</p>
|
||||
<div class="alert-actions">
|
||||
<a class="btn alert-btn" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">gitlab.com/DuarteSantos8/opengym</a>
|
||||
<a class="btn dc-btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
<p class="alert-note">Every repository link on this site now points at GitLab — same code, same
|
||||
AGPL-3.0 license, same history, and the releases, container images and APK builds are back.</p>
|
||||
<div class="notice-wrap"><div class="wrap">
|
||||
<aside class="notice" role="note">
|
||||
<div class="notice-tag">Repository moved</div>
|
||||
<h2>My GitHub account was suspended, and the openGym repo went with it.</h2>
|
||||
<p><b>github.com/DuarteSantos8/openGym is offline</b> — not by choice. The app is
|
||||
untouched: the APK, the demo and every self-hosted install work exactly as before. The
|
||||
code, the releases, the container images and the APK builds now live on GitLab under
|
||||
the same AGPL-3.0 license, and every repository link here points there.</p>
|
||||
<div class="actions">
|
||||
<a class="btn" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">Open on GitLab</a>
|
||||
<a class="btn dc-btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
</aside>
|
||||
</div></div>
|
||||
|
||||
|
||||
<main class="wrap prose">
|
||||
<h1>About openGym</h1>
|
||||
<p class="lead">openGym wasn't planned as a product. It started as a tiny app I built for
|
||||
one user: me.</p>
|
||||
<p class="lead">openGym was not planned as a product. It started as a tiny app built for
|
||||
exactly one user: me.</p>
|
||||
|
||||
<p>I wanted three things at the gym: log my workouts, track my body weight, and see whether
|
||||
any of it was going anywhere. Every app I tried wanted a subscription, an account, or my
|
||||
training data on someone else's servers — usually all three. So I did the homelab thing:
|
||||
built a small mobile web page, put it on my own server, and started logging.</p>
|
||||
training data on someone else's servers, and usually all three. So I did the homelab
|
||||
thing: built a small mobile web page, put it on my own server, and started logging.</p>
|
||||
|
||||
<p>It turns out a tracker you build for yourself gets sharpened in a way products don't.
|
||||
Every awkward tap at the squat rack became that evening's fix. The guided workout flow,
|
||||
the weight pre-fills, the rest timer, the "ask my body weight before the first set"
|
||||
ritual — none of that came from a feature list. It came from actually standing in the
|
||||
gym with the thing in my hand.</p>
|
||||
the weight pre-fills, the rest timer, the ritual of asking for body weight before the
|
||||
first set: none of that came off a feature list. It came from standing in the gym with
|
||||
the thing in my hand.</p>
|
||||
|
||||
<p>Then friends wanted in. That brought passkey profiles — sign in with your fingerprint,
|
||||
no passwords, everyone's data separate — and sync, so the log survives any phone.
|
||||
Somewhere along the way the little page got rewritten into a proper React app, learned
|
||||
13 languages, grew a muscle map that reads three ways — where the volume went, what is
|
||||
still recovering, and what each muscle is actually strong at — plus importers for
|
||||
FitNotes, Strong, Hevy and Apple Health, and finally became a native Android app you can
|
||||
install from this site.</p>
|
||||
<p>Then friends wanted in. That brought passkey profiles, so everyone signs in with a
|
||||
fingerprint and keeps their own data, and sync, so the log survives any phone. Somewhere
|
||||
along the way the little page was rewritten into a proper React app, learned 13 languages,
|
||||
grew a muscle map that reads three ways (where the volume went, what is still recovering,
|
||||
and what each muscle is actually strong at), picked up importers for FitNotes, Strong,
|
||||
Hevy and Apple Health, and finally became a native Android app you can install from
|
||||
this site.</p>
|
||||
|
||||
<p>In July 2026 I open-sourced the whole thing under the <b>AGPL</b>. The license is the
|
||||
point, not a footnote: your training data should be yours, the software that holds it
|
||||
should be inspectable, and nobody — including me — should be able to take a closed,
|
||||
paid version of it away from the community.</p>
|
||||
should be inspectable, and nobody, me included, should be able to take a closed, paid
|
||||
version of it away from the community.</p>
|
||||
|
||||
<p>openGym still runs on the same homelab server it started on, and I still log every
|
||||
session with it. That's the quality bar: I'm the first user of every release.</p>
|
||||
session with it. That is the quality bar: I am the first user of every release.</p>
|
||||
|
||||
<p class="who" style="color:var(--faint)">— <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></p>
|
||||
<p class="who">— <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></p>
|
||||
|
||||
<h2>Milestones</h2>
|
||||
<h2 id="milestones-h">Milestones</h2>
|
||||
<!-- The releases below are a static fallback: site.js replaces them with the live list
|
||||
of published GitHub releases, so this page never needs manual updating. Only the
|
||||
first entry (pre-GitHub) is permanent. -->
|
||||
of published GitLab releases, so this page never needs manual updating. Only the
|
||||
first entry (pre-open-source) is permanent. -->
|
||||
<ul class="tl" id="milestones">
|
||||
<li><b>The personal app</b><span class="when">early summer 2026</span>
|
||||
<p>A hand-written vanilla-JS page on my own server. One user, zero ambitions.</p></li>
|
||||
<li data-fallback><b>v1.0.0 — open-sourced</b><span class="when">July 20, 2026</span>
|
||||
<p>Docker-Compose self-hosting, passkey profiles, guided workouts, 1,324-exercise
|
||||
<p>Docker Compose self-hosting, passkey profiles, guided workouts, a 1,324-exercise
|
||||
library. AGPL from day one.</p></li>
|
||||
<li data-fallback><b>Every release since</b><span class="when">ongoing</span>
|
||||
<p>See the full list on <a href="https://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab → Releases</a>.</p></li>
|
||||
@@ -101,33 +103,33 @@
|
||||
|
||||
<h2>Principles</h2>
|
||||
<ul>
|
||||
<li><b>Your data is yours.</b> Local-first, one-file backups, no lock-in — leaving
|
||||
openGym must always be one export away.</li>
|
||||
<li><b>No telemetry, ever.</b> If a feature needs analytics to justify itself, it
|
||||
doesn't ship.</li>
|
||||
<li><b>Dependency-light.</b> The backend is one Node file with a single dependency;
|
||||
the frontend is React, a router and a store. Small enough to actually audit.</li>
|
||||
<li><b>Open source that stays open.</b> AGPL-3.0, so every fork and every hosted
|
||||
version owes its code back to everyone.</li>
|
||||
<li><b>Your data is yours.</b> Local-first, one-file backups, no lock-in. Leaving openGym
|
||||
must always be one export away.</li>
|
||||
<li><b>No telemetry, ever.</b> If a feature needs analytics to justify itself, it does
|
||||
not ship.</li>
|
||||
<li><b>Dependency-light.</b> The backend is one Node file with a single dependency; the
|
||||
frontend is React, a router and a store. Small enough to actually audit.</li>
|
||||
<li><b>Open source that stays open.</b> AGPL-3.0, so every fork and every hosted version
|
||||
owes its code back to everyone.</li>
|
||||
</ul>
|
||||
|
||||
<div class="hero-btns" style="justify-content:flex-start;margin:30px 0 10px">
|
||||
<div class="actions" style="margin:38px 0 0">
|
||||
<a class="btn" href="/#download">Get openGym</a>
|
||||
<a class="btn ghost" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">Star it on GitLab</a>
|
||||
<a class="link" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">Star it on GitLab</a>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer><div class="wrap foot">
|
||||
<span>openGym · AGPL-3.0 · © 2026 <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></span>
|
||||
<span class="c">openGym · AGPL-3.0 · © 2026 <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></span>
|
||||
<div class="links">
|
||||
<a href="docs.html">Docs</a>
|
||||
<a href="about.html" class="hide-s">About</a>
|
||||
<a href="about.html">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab</a>
|
||||
<a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
|
||||
<a href="/#download">Download</a>
|
||||
</div>
|
||||
</div></footer>
|
||||
|
||||
<script src="site.js" defer></script>
|
||||
<script src="site.js?v=9" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
+30
-28
@@ -2,14 +2,15 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<title>Docs — openGym</title>
|
||||
<meta name="description" content="How to install openGym on Android, use it on iPhone, self-host it with Docker, import your training history, and keep backups.">
|
||||
<meta name="theme-color" content="#0c0e12">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
|
||||
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
|
||||
<link rel="apple-touch-icon" href="icon-180.png">
|
||||
<link rel="stylesheet" href="styles.css?v=3">
|
||||
<link rel="stylesheet" href="styles.css?v=9">
|
||||
<script>document.documentElement.className += ' js'</script>
|
||||
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
|
||||
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
|
||||
</head>
|
||||
@@ -17,16 +18,19 @@
|
||||
|
||||
<nav><div class="wrap nav-in">
|
||||
<a class="brand" href="/">
|
||||
<img src="icon-180.png" alt="" width="26" height="26" style="border-radius:6px">
|
||||
<img src="icon-180.png" alt="" width="24" height="24">
|
||||
openGym
|
||||
</a>
|
||||
<div class="nav-links">
|
||||
<a href="/#features" class="hide-s">Features</a>
|
||||
<a href="/#screens" class="hide-s">Screenshots</a>
|
||||
<a href="/#demo" class="hide-s">Demo</a>
|
||||
<button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
|
||||
<span></span><span></span>
|
||||
</button>
|
||||
<div class="nav-links" id="menu">
|
||||
<a href="/#features">Features</a>
|
||||
<a href="/#screens">Screenshots</a>
|
||||
<a href="/#demo">Demo</a>
|
||||
<a href="docs.html">Docs</a>
|
||||
<a href="about.html" class="hide-s">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener"><span data-gh="stars">GitLab</span></a>
|
||||
<a href="about.html">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
|
||||
<a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
|
||||
<a class="cta" href="/#download">Download</a>
|
||||
</div>
|
||||
@@ -34,23 +38,21 @@
|
||||
|
||||
<!-- TEMPORARY: GitHub account suspended -> repo lives on gitlab.com. Remove this block and
|
||||
revert the links (+ site.js) to github.com once the account is restored. -->
|
||||
<div class="alert" role="alert"><div class="wrap">
|
||||
<div class="alert-tag">⚠️ Important notice</div>
|
||||
<h2>My GitHub account has been suspended — the openGym repo is gone with it</h2>
|
||||
<p><b>github.com/DuarteSantos8/openGym is offline.</b> The repository and the releases are
|
||||
unreachable — not by choice. openGym itself is unaffected: the app, the APK on this page,
|
||||
the demo (now hosted here) and every self-hosted install keep working exactly as before.</p>
|
||||
<p>Until I get the account back, the code lives on GitLab — and the Discord is where I will
|
||||
announce the moment it is resolved:</p>
|
||||
<div class="alert-actions">
|
||||
<a class="btn alert-btn" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">gitlab.com/DuarteSantos8/opengym</a>
|
||||
<a class="btn dc-btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
<p class="alert-note">Every repository link on this site now points at GitLab — same code, same
|
||||
AGPL-3.0 license, same history, and the releases, container images and APK builds are back.</p>
|
||||
<div class="notice-wrap"><div class="wrap">
|
||||
<aside class="notice" role="note">
|
||||
<div class="notice-tag">Repository moved</div>
|
||||
<h2>My GitHub account was suspended, and the openGym repo went with it.</h2>
|
||||
<p><b>github.com/DuarteSantos8/openGym is offline</b> — not by choice. The app is
|
||||
untouched: the APK, the demo and every self-hosted install work exactly as before. The
|
||||
code, the releases, the container images and the APK builds now live on GitLab under
|
||||
the same AGPL-3.0 license, and every repository link here points there.</p>
|
||||
<div class="actions">
|
||||
<a class="btn" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">Open on GitLab</a>
|
||||
<a class="btn dc-btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
</aside>
|
||||
</div></div>
|
||||
|
||||
|
||||
<main class="wrap prose">
|
||||
<h1>Docs</h1>
|
||||
<p class="lead">Everything you need to get openGym running — on a phone, or on your own
|
||||
@@ -197,16 +199,16 @@ docker compose up -d</code></pre>
|
||||
</main>
|
||||
|
||||
<footer><div class="wrap foot">
|
||||
<span>openGym · AGPL-3.0 · © 2026 <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></span>
|
||||
<span class="c">openGym · AGPL-3.0 · © 2026 <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></span>
|
||||
<div class="links">
|
||||
<a href="docs.html">Docs</a>
|
||||
<a href="about.html" class="hide-s">About</a>
|
||||
<a href="about.html">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab</a>
|
||||
<a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
|
||||
<a href="/#download">Download</a>
|
||||
</div>
|
||||
</div></footer>
|
||||
|
||||
<script src="site.js" defer></script>
|
||||
<script src="site.js?v=9" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
+425
-176
@@ -2,10 +2,10 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
||||
<title>openGym — free, open-source gym & body-weight tracker</title>
|
||||
<meta name="description" content="openGym is a free, open-source gym & body-weight tracker. Download the Android app or self-host it with Docker — no account, no cloud, no telemetry.">
|
||||
<meta name="theme-color" content="#0c0e12">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<meta property="og:title" content="openGym — your workouts, your weights, your data">
|
||||
<meta property="og:description" content="Free, open-source gym & body-weight tracker. Android APK or self-hosted with Docker. No account, no cloud, no telemetry.">
|
||||
<meta property="og:image" content="https://opengym.duarte-santos.ch/img/banner.png">
|
||||
@@ -14,7 +14,21 @@
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
|
||||
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
|
||||
<link rel="apple-touch-icon" href="icon-180.png">
|
||||
<link rel="stylesheet" href="styles.css?v=3">
|
||||
<link rel="stylesheet" href="styles.css?v=9">
|
||||
<!-- Marks that JS is alive before first paint, so the scroll-reveal styles never
|
||||
hide content from a browser that will not run them. -->
|
||||
<script>
|
||||
/* Before first paint: .js arms the scroll reveals, .intro plays the hero entrance once per
|
||||
tab. Deferred scripts run too late for this — the hero would paint, then vanish and
|
||||
animate back in. site.js takes .intro off again when the animation ends. */
|
||||
document.documentElement.className += ' js'
|
||||
try {
|
||||
if (!sessionStorage.getItem('og-intro')) {
|
||||
sessionStorage.setItem('og-intro', '1')
|
||||
document.documentElement.className += ' intro'
|
||||
}
|
||||
} catch (e) { document.documentElement.className += ' intro' }
|
||||
</script>
|
||||
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
|
||||
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
|
||||
<script type="application/ld+json">
|
||||
@@ -29,18 +43,49 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Icon set: one sprite, referenced with <use>. Line icons at 24×24, stroke 1.7. -->
|
||||
<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false"><defs>
|
||||
<symbol id="i-play" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M10.2 8.6l5 3.4-5 3.4z"/></symbol>
|
||||
<symbol id="i-body" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="4.3" r="2.3"/><path d="M12 6.6v7.2M12 8.4L7.5 11M12 8.4l4.5 2.6M12 13.8l-2.6 6.4M12 13.8l2.6 6.4"/></symbol>
|
||||
<symbol id="i-trend" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 16.5l5-5 3.5 3.5 6-6.5"/><path d="M15 8h3.5v3.5"/></symbol>
|
||||
<symbol id="i-library" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3.2" y="4.5" width="17.6" height="15" rx="2.4"/><path d="M3.2 9.2h17.6M8.6 9.2v10.3"/></symbol>
|
||||
<symbol id="i-grid" viewBox="0 0 24 24" fill="currentColor"><rect x="2.6" y="4.4" width="3.6" height="3.6" rx="1.1" opacity=".35"/><rect x="7.8" y="4.4" width="3.6" height="3.6" rx="1.1"/><rect x="13" y="4.4" width="3.6" height="3.6" rx="1.1" opacity=".35"/><rect x="18.2" y="4.4" width="3.6" height="3.6" rx="1.1" opacity=".7"/><rect x="2.6" y="10.2" width="3.6" height="3.6" rx="1.1"/><rect x="7.8" y="10.2" width="3.6" height="3.6" rx="1.1" opacity=".35"/><rect x="13" y="10.2" width="3.6" height="3.6" rx="1.1" opacity=".7"/><rect x="18.2" y="10.2" width="3.6" height="3.6" rx="1.1"/><rect x="2.6" y="16" width="3.6" height="3.6" rx="1.1" opacity=".7"/><rect x="7.8" y="16" width="3.6" height="3.6" rx="1.1"/><rect x="13" y="16" width="3.6" height="3.6" rx="1.1" opacity=".35"/><rect x="18.2" y="16" width="3.6" height="3.6" rx="1.1" opacity=".35"/></symbol>
|
||||
<symbol id="i-scale" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 8.2l4 3.4 3.6-2.6 3.7 3 5.9-5.4"/><path d="M3.4 16.4h17.2" stroke-dasharray="2.6 2.6"/></symbol>
|
||||
<symbol id="i-phone" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="6.2" y="2.4" width="11.6" height="19.2" rx="3"/><path d="M10.6 5.2h2.8M12 18.4h.01"/></symbol>
|
||||
<symbol id="i-server" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4.2" width="18" height="6.2" rx="2"/><rect x="3" y="13.6" width="18" height="6.2" rx="2"/><path d="M6.8 7.3h.01M6.8 16.7h.01"/></symbol>
|
||||
<symbol id="i-discord" viewBox="0 0 71 55"><path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.4711 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6217 41.8354 49.6217 53.3179 44.3151C53.3935 44.2785 53.483 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z"/></symbol>
|
||||
<symbol id="i-gitlab" viewBox="0 0 24 24"><path d="m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.8748.8748 0 0 0-.9997.0539.8748.8748 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.8573.8573 0 0 0-.29-.4412.8748.8748 0 0 0-.9997-.0537.8585.8585 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z"/></symbol>
|
||||
<symbol id="i-github" viewBox="0 0 24 24"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></symbol>
|
||||
<symbol id="i-bmc" viewBox="0 0 24 24"><path d="M20.216 6.415l-.132-.666c-.119-.598-.388-1.163-1.001-1.379-.197-.069-.42-.098-.57-.241-.152-.143-.196-.366-.231-.572-.065-.378-.125-.756-.192-1.133-.057-.325-.102-.69-.25-.987-.195-.4-.597-.634-.996-.788a5.723 5.723 0 00-.626-.194c-1-.263-2.05-.36-3.077-.416a25.834 25.834 0 00-3.7.062c-.915.083-1.88.184-2.75.5-.318.116-.646.256-.888.501-.297.302-.393.77-.177 1.146.154.267.415.456.692.58.36.162.737.284 1.123.366 1.075.238 2.189.331 3.287.37 1.218.05 2.437.01 3.65-.118.299-.033.598-.073.896-.119.352-.054.578-.513.474-.834-.124-.383-.457-.531-.834-.473-.466.074-.96.108-1.382.146-1.177.08-2.358.082-3.536.006a22.228 22.228 0 01-1.157-.107c-.086-.01-.18-.025-.258-.036-.243-.036-.484-.08-.724-.13-.111-.027-.111-.185 0-.212h.005c.277-.06.557-.108.838-.147h.002c.131-.009.263-.032.394-.048a25.076 25.076 0 013.426-.12c.674.019 1.347.067 2.017.144l.228.031c.267.04.533.088.798.145.392.085.895.113 1.07.542.055.137.08.288.111.431l.319 1.484a.237.237 0 01-.199.284h-.003c-.037.006-.075.01-.112.015a36.704 36.704 0 01-4.743.295 37.059 37.059 0 01-4.699-.304c-.14-.017-.293-.042-.417-.06-.326-.048-.649-.108-.973-.161-.393-.065-.768-.032-1.123.161-.29.16-.527.404-.675.701-.154.316-.199.66-.267 1-.069.34-.176.707-.135 1.056.087.753.613 1.365 1.37 1.502a39.69 39.69 0 0011.343.376.483.483 0 01.535.53l-.071.697-1.018 9.907c-.041.41-.047.832-.125 1.237-.122.637-.553 1.028-1.182 1.171-.577.131-1.165.2-1.756.205-.656.004-1.31-.025-1.966-.022-.699.004-1.556-.06-2.095-.58-.475-.458-.54-1.174-.605-1.793l-.731-7.013-.322-3.094c-.037-.351-.286-.695-.678-.678-.336.015-.718.3-.678.679l.228 2.185.949 9.112c.147 1.344 1.174 2.068 2.446 2.272.742.12 1.503.144 2.257.156.966.016 1.942.053 2.892-.122 1.408-.258 2.465-1.198 2.616-2.657.34-3.332.683-6.663 1.024-9.995l.215-2.087a.484.484 0 01.39-.426c.402-.078.787-.212 1.074-.518.455-.488.546-1.124.385-1.766zm-1.478.772c-.145.137-.363.201-.578.233-2.416.359-4.866.54-7.308.46-1.748-.06-3.477-.254-5.207-.498-.17-.024-.353-.055-.47-.18-.22-.236-.111-.71-.054-.995.052-.26.152-.609.463-.646.484-.057 1.046.148 1.526.22.577.088 1.156.159 1.737.212 2.48.226 5.002.19 7.472-.14.45-.06.899-.13 1.345-.21.399-.072.84-.206 1.08.206.166.281.188.657.162.974a.544.544 0 01-.169.364zm-6.159 3.9c-.862.37-1.84.788-3.109.788a5.884 5.884 0 01-1.569-.217l.877 9.004c.065.78.717 1.38 1.5 1.38 0 0 1.243.065 1.658.065.447 0 1.786-.065 1.786-.065.783 0 1.434-.6 1.499-1.38l.94-9.95a3.996 3.996 0 00-1.322-.238c-.826 0-1.491.284-2.26.613z"/></symbol>
|
||||
<symbol id="i-calendar" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3.2" y="4.8" width="17.6" height="16" rx="2.4"/><path d="M3.2 9.6h17.6M8.4 3.2v3.2M15.6 3.2v3.2"/></symbol>
|
||||
<symbol id="i-link" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10.2 13.8a3.6 3.6 0 0 0 5.4.4l2.6-2.6a3.6 3.6 0 0 0-5.1-5.1l-1.5 1.5"/><path d="M13.8 10.2a3.6 3.6 0 0 0-5.4-.4l-2.6 2.6a3.6 3.6 0 0 0 5.1 5.1l1.5-1.5"/></symbol>
|
||||
<symbol id="i-timer" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="13.4" r="7.6"/><path d="M12 9.4v4l2.6 1.6M9.4 2.6h5.2"/></symbol>
|
||||
<symbol id="i-flame" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 21.4c3.4 0 6-2.4 6-5.6 0-4-4.2-5.6-3.4-10.4-2 .6-3.6 2.6-3.6 4.8 0 1-.6 1.8-1.4 1.8-.9 0-1.4-.8-1.3-1.9C7 11.4 6 13.2 6 15.8c0 3.2 2.6 5.6 6 5.6z"/></symbol>
|
||||
<symbol id="i-gauge" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M4.2 17.4a8.6 8.6 0 1 1 15.6 0"/><path d="M12 14.6l3.8-3.8"/><circle cx="12" cy="16.2" r="1.4"/></symbol>
|
||||
<symbol id="i-share" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.6v11.2M8.4 7.2L12 3.6l3.6 3.6"/><path d="M5.4 13.2v5.4a1.8 1.8 0 0 0 1.8 1.8h9.6a1.8 1.8 0 0 0 1.8-1.8v-5.4"/></symbol>
|
||||
<symbol id="i-import" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.6v11.2M8.4 11.2l3.6 3.6 3.6-3.6"/><path d="M5.4 15.6v3a1.8 1.8 0 0 0 1.8 1.8h9.6a1.8 1.8 0 0 0 1.8-1.8v-3"/></symbol>
|
||||
<symbol id="i-globe" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="8.6"/><path d="M3.4 12h17.2"/><path d="M12 3.4c2.2 2.4 3.4 5.4 3.4 8.6s-1.2 6.2-3.4 8.6c-2.2-2.4-3.4-5.4-3.4-8.6S9.8 5.8 12 3.4z"/></symbol>
|
||||
<symbol id="i-key" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="7.6" cy="14.4" r="3.8"/><path d="M10.4 11.6l7.4-7.4M15.2 6.8l2.2 2.2M17.8 4.2l2.2 2.2"/></symbol>
|
||||
<symbol id="i-palette" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.4a8.6 8.6 0 0 0 0 17.2c1 0 1.8-.8 1.8-1.8 0-.5-.2-.9-.5-1.2-.3-.3-.5-.7-.5-1.2 0-1 .8-1.8 1.8-1.8h2.1a4 4 0 0 0 3.9-4c0-3.9-3.9-7.2-8.6-7.2z"/><circle cx="7.6" cy="11.6" r="1"/><circle cx="10.6" cy="7.4" r="1"/><circle cx="15.4" cy="8.4" r="1"/></symbol>
|
||||
<symbol id="i-sparkle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3.2l1.9 4.9 4.9 1.9-4.9 1.9L12 16.8l-1.9-4.9-4.9-1.9 4.9-1.9z"/><path d="M18.6 15.4l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z"/></symbol>
|
||||
<symbol id="i-archive" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3.2" y="4.4" width="17.6" height="4.4" rx="1.6"/><path d="M5 8.8v9.2a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8.8"/><path d="M9.8 12.6h4.4"/></symbol>
|
||||
</defs></svg>
|
||||
|
||||
<nav><div class="wrap nav-in">
|
||||
<a class="brand" href="/">
|
||||
<img src="icon-180.png" alt="" width="26" height="26" style="border-radius:6px">
|
||||
<img src="icon-180.png" alt="" width="24" height="24">
|
||||
openGym
|
||||
</a>
|
||||
<div class="nav-links">
|
||||
<a href="#features" class="hide-s">Features</a>
|
||||
<a href="#screens" class="hide-s">Screenshots</a>
|
||||
<a href="#demo" class="hide-s">Demo</a>
|
||||
<button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
|
||||
<span></span><span></span>
|
||||
</button>
|
||||
<div class="nav-links" id="menu">
|
||||
<a href="#features">Features</a>
|
||||
<a href="#screens">Screenshots</a>
|
||||
<a href="#demo">Demo</a>
|
||||
<a href="docs.html">Docs</a>
|
||||
<a href="about.html" class="hide-s">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener"><span data-gh="stars">GitLab</span></a>
|
||||
<a href="about.html">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
|
||||
<a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
|
||||
<a class="cta" href="#download">Download</a>
|
||||
</div>
|
||||
@@ -48,188 +93,392 @@
|
||||
|
||||
<!-- TEMPORARY: GitHub account suspended -> repo lives on gitlab.com. Remove this block and
|
||||
revert the links (+ site.js) to github.com once the account is restored. -->
|
||||
<div class="alert" role="alert"><div class="wrap">
|
||||
<div class="alert-tag">⚠️ Important notice</div>
|
||||
<h2>My GitHub account has been suspended — the openGym repo is gone with it</h2>
|
||||
<p><b>github.com/DuarteSantos8/openGym is offline.</b> The repository and the releases are
|
||||
unreachable — not by choice. openGym itself is unaffected: the app, the APK on this page,
|
||||
the demo (now hosted here) and every self-hosted install keep working exactly as before.</p>
|
||||
<p>Until I get the account back, the code lives on GitLab — and the Discord is where I will
|
||||
announce the moment it is resolved:</p>
|
||||
<div class="alert-actions">
|
||||
<a class="btn alert-btn" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">gitlab.com/DuarteSantos8/opengym</a>
|
||||
<a class="btn dc-btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
<p class="alert-note">Every repository link on this site now points at GitLab — same code, same
|
||||
AGPL-3.0 license, same history, and the releases, container images and APK builds are back.</p>
|
||||
<div class="notice-wrap"><div class="wrap">
|
||||
<aside class="notice" role="note">
|
||||
<div class="notice-tag">Repository moved</div>
|
||||
<h2>My GitHub account was suspended, and the openGym repo went with it.</h2>
|
||||
<p><b>github.com/DuarteSantos8/openGym is offline</b> — not by choice. The app is
|
||||
untouched: the APK, the demo and every self-hosted install work exactly as before. The
|
||||
code, the releases, the container images and the APK builds now live on GitLab under
|
||||
the same AGPL-3.0 license, and every repository link here points there.</p>
|
||||
<div class="actions">
|
||||
<a class="btn" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">Open on GitLab</a>
|
||||
<a class="btn dc-btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
</aside>
|
||||
</div></div>
|
||||
|
||||
|
||||
<header class="hero"><div class="wrap">
|
||||
<div class="logo">
|
||||
<img src="icon-512.png" alt="openGym icon" width="108" height="108" style="border-radius:26px">
|
||||
</div>
|
||||
<h1>openGym</h1>
|
||||
<p class="tag">Your workouts. Your weights. Your data.</p>
|
||||
<p class="sub">A free, open-source gym & body-weight tracker.
|
||||
No subscription, no account required, no telemetry — ever.</p>
|
||||
<div class="hero-btns">
|
||||
<a class="btn" href="#download">Get openGym</a>
|
||||
<a class="btn ghost" href="#demo">Try the live demo</a>
|
||||
<a class="btn ghost" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span class="ct" data-gh="stars">★</span></a>
|
||||
</div>
|
||||
</div></header>
|
||||
|
||||
<div class="dc-wrap"><div class="wrap">
|
||||
<div class="dc">
|
||||
<div class="dc-icon"><svg viewBox="0 0 71 55" width="44" height="34" aria-hidden="true"><path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.4711 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6217 41.8354 49.6217 53.3179 44.3151C53.3935 44.2785 53.483 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z"/></svg></div>
|
||||
<div class="dc-body">
|
||||
<h3>Join the openGym Discord</h3>
|
||||
<p>Release announcements, self-hosting help with Docker, reverse proxies and passkeys,
|
||||
and somewhere to report a bug. It is where you will hear about a new version first.</p>
|
||||
</div>
|
||||
<a class="btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<section id="features"><div class="wrap">
|
||||
<p class="kicker">Everything a training log needs</p>
|
||||
<h2>Built in the gym, not in a boardroom</h2>
|
||||
<p class="lead">Every feature exists because it was needed on the gym floor — nothing is
|
||||
there to sell you anything.</p>
|
||||
<div class="grid">
|
||||
<div class="feat"><div class="ic">▶️</div><h3>Guided workouts</h3><p>Knows what day it is, starts today's session, pre-fills your weights from last time, times your rest, spots PRs.</p></div>
|
||||
<div class="feat"><div class="ic">🏋️</div><h3>1,324 exercises</h3><p>Searchable library with animated demos, filterable by body part and the equipment you actually own — plus your own custom exercises.</p></div>
|
||||
<div class="feat"><div class="ic">🗓️</div><h3>Weekly plan</h3><p>A routine per weekday, and any day can be rescheduled when life happens — without touching the plan.</p></div>
|
||||
<div class="feat"><div class="ic">⚖️</div><h3>Body weight & goal</h3><p>Interactive chart with your goal line; every change is colored by whether it moves toward it.</p></div>
|
||||
<div class="feat"><div class="ic">💪</div><h3>Muscle map, three ways</h3><p>A body diagram read as <b>balance</b> (where the volume went, and which muscles got nothing), <b>fatigue</b> (what is still recovering, weighted by how hard each set was) or <b>strength</b> (how long since you trained it — and the exercises behind it, with their estimated 1RM).</p></div>
|
||||
<div class="feat"><div class="ic">🟩</div><h3>Activity heatmap</h3><p>A GitHub-style year view of your training time. Streaks included.</p></div>
|
||||
<div class="feat"><div class="ic">📈</div><h3>Progression that follows a rule</h3><p>Linear, Greyskull LP, double progression or added time — per routine, overridable per exercise. Your weights are already right when the session opens, and every target tells you why.</p></div>
|
||||
<div class="feat"><div class="ic">⏱️</div><h3>Timed sets</h3><p>Planks, hangs and carries are logged by time, with a timer for the set itself. Stop early and it logs what you actually held.</p></div>
|
||||
<div class="feat"><div class="ic">🧮</div><h3>Estimated 1RM</h3><p>Per exercise, from your best eligible set — and it names which one. Won't guess above 12 reps.</p></div>
|
||||
<div class="feat"><div class="ic">🔗</div><h3>Supersets & cardio</h3><p>Plan them, or pair two exercises mid-session and unpair them again. Work the group back-to-back with one rest per round — and log time + speed where weight × reps makes no sense.</p></div>
|
||||
<div class="feat"><div class="ic">📤</div><h3>Share a plan</h3><p>Send someone your routines as a small file — no workouts, no weigh-ins — or print it as a clean PDF. Importing merges, never overwrites.</p></div>
|
||||
<div class="feat"><div class="ic">🎯</div><h3>Effort per set</h3><p>Rate a set as RIR or RPE — whichever scale you already think in. Optional, and every set keeps the scale it was logged with.</p></div>
|
||||
<div class="feat"><div class="ic">☀️</div><h3>Screen stays awake</h3><p>No unlocking the phone between sets. The screen stays lit while a workout runs, and lets go the moment you finish.</p></div>
|
||||
<div class="feat"><div class="ic">📥</div><h3>Bring your history</h3><p>Import from FitNotes, Strong, Hevy — including the RPE they recorded — or body weight straight out of an Apple Health export.</p></div>
|
||||
<div class="feat"><div class="ic">🌍</div><h3>13 languages</h3><p>Full UI translation, exercise instructions in 11 languages, and bilingual PT-BR exercise names, loaded on demand.</p></div>
|
||||
<div class="feat"><div class="ic">🔑</div><h3>Passkeys, not passwords</h3><p>Self-hosted profiles sign in with Face ID / fingerprint. Each person's data stays their own.</p></div>
|
||||
<div class="feat"><div class="ic">🎨</div><h3>Designed, not assembled</h3><p>Light & dark themes, 8 accent colors, a hand-drawn icon set. Looks the same on every phone.</p></div>
|
||||
<div class="feat"><div class="ic">🔥</div><h3>Warm-up sets</h3><p>Mark the ramp-up rows as warm-ups and they stay out of your 1RM, your progression and the fatigue map — present in the session, absent from the numbers.</p></div>
|
||||
<div class="feat"><div class="ic">🤖</div><h3>Ask an AI about your training</h3><p>An optional MCP server lets a client like Claude Desktop read your history in your own words — <i>"what did I bench last week?"</i>. Read-only, runs on your machine, not in the Docker build.</p></div>
|
||||
<div class="feat"><div class="ic">📦</div><h3>Yours to keep</h3><p>One-tap JSON export and import. Your training log is a file you own, not a row in someone's cloud.</p></div>
|
||||
</div>
|
||||
</div></section>
|
||||
|
||||
<section id="screens"><div class="wrap">
|
||||
<p class="kicker">Screenshots</p>
|
||||
<h2>Five screens, zero clutter</h2>
|
||||
<div class="shots">
|
||||
<figure><img src="img/home.png" alt="openGym home screen with weekly overview and body-weight chart" loading="lazy" width="1170" height="2532"><figcaption>Home</figcaption></figure>
|
||||
<figure><img src="img/workout.png" alt="Guided workout screen with sets, rest timer and pre-filled weights" loading="lazy" width="1170" height="2532"><figcaption>Workout</figcaption></figure>
|
||||
<figure><img src="img/stats.png" alt="Stats screen with activity heatmap and charts" loading="lazy" width="1170" height="2532"><figcaption>Stats</figcaption></figure>
|
||||
<figure><img src="img/plan.png" alt="Weekly plan screen with routines per weekday" loading="lazy" width="1170" height="2532"><figcaption>Plan</figcaption></figure>
|
||||
<figure><img src="img/library.png" alt="Exercise library with search and filters" loading="lazy" width="1170" height="2532"><figcaption>Library</figcaption></figure>
|
||||
</div>
|
||||
</div></section>
|
||||
|
||||
<section id="demo"><div class="wrap">
|
||||
<p class="kicker">Live demo</p>
|
||||
<h2>Try it right here</h2>
|
||||
<p class="lead">This is the real app with seeded example data, running in your browser —
|
||||
poke around, start a workout, change anything.</p>
|
||||
<div class="demo-wrap">
|
||||
<div class="phone"><iframe src="/demo/" title="openGym live demo" loading="lazy"></iframe></div>
|
||||
</div>
|
||||
<p class="demo-note">Demo data lives only in this browser tab-family and can be reset in its
|
||||
Settings. Prefer a full window? <a href="/demo/">Open the demo full-screen →</a></p>
|
||||
</div></section>
|
||||
|
||||
<section id="download"><div class="wrap">
|
||||
<p class="kicker">Get openGym</p>
|
||||
<h2>One app, two flavors</h2>
|
||||
<p class="lead">Same codebase, your choice of where the data lives: entirely on your phone,
|
||||
or on a server you control.</p>
|
||||
<div class="duo">
|
||||
<div class="card hl">
|
||||
<h3>📱 Mobile app</h3>
|
||||
<p class="for">For anyone — install and you're done.</p>
|
||||
<ul>
|
||||
<li>Everything stays on your phone</li>
|
||||
<li>No account, no server, no setup</li>
|
||||
<li>Native workout-day reminders</li>
|
||||
<li>Backups via the share sheet</li>
|
||||
<li class="no">No cross-device sync</li>
|
||||
</ul>
|
||||
<a class="btn" href="openGym.apk" download>Download for Android</a>
|
||||
<p class="meta">v1.2.9 · 4.3 MB · Android 6.0+ · signed APK, sideload (your browser will ask — that's normal outside the Play Store)</p>
|
||||
<p class="meta">Every release is also built and signed by CI and attached to the
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab
|
||||
releases page</a>, checksums and all.</p>
|
||||
<p class="meta"><b>iPhone?</b> Apple doesn't allow installs outside the App Store — use the
|
||||
self-hosted version as a home-screen app instead, or see <a href="docs.html#iphone">the docs</a>.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>🖥️ Self-hosted</h3>
|
||||
<p class="for">For homelabbers — and their friends & family.</p>
|
||||
<ul>
|
||||
<li>Sync across all your devices</li>
|
||||
<li>Passkey profiles for multiple people</li>
|
||||
<li>Your data readable on the desktop</li>
|
||||
<li>Works as a home-screen app on iPhone & Android</li>
|
||||
<li>One <code>docker compose up</code></li>
|
||||
</ul>
|
||||
<a class="btn ghost" href="docs.html#selfhost">Self-hosting guide</a>
|
||||
<p class="meta">AGPL-3.0 · prebuilt images for amd64 + arm64</p>
|
||||
<header class="hero">
|
||||
<div class="wrap">
|
||||
<p class="eyebrow">openGym</p>
|
||||
<h1>Your workouts.<br>Your weights.<br><span>Your data.</span></h1>
|
||||
<p class="lead">A free, open-source gym and body-weight tracker. No subscription, no
|
||||
account required, and no telemetry — not now, not later.</p>
|
||||
<div class="actions">
|
||||
<a class="btn" href="#download">Get openGym</a>
|
||||
<a class="link" href="#demo">Try the live demo</a>
|
||||
</div>
|
||||
</div>
|
||||
</div></section>
|
||||
<div class="hero-stage">
|
||||
<div class="device">
|
||||
<img src="img/home.png" alt="openGym home screen: the week at a glance, today's session and a body-weight chart"
|
||||
width="1170" height="2532" fetchpriority="high">
|
||||
</div>
|
||||
</div>
|
||||
<div class="hero-fade"></div>
|
||||
</header>
|
||||
|
||||
<section id="story"><div class="wrap">
|
||||
<div class="story">
|
||||
<p class="kicker">Why openGym exists</p>
|
||||
<blockquote>openGym started as <strong>a tiny app I built for myself</strong> — I just wanted to
|
||||
log my workouts and weight without a subscription app claiming my training data.
|
||||
Then friends wanted in, then it grew a mind of its own.</blockquote>
|
||||
<p class="who">— Duarte Santos · <a href="about.html">read the whole story →</a></p>
|
||||
</div>
|
||||
</div></section>
|
||||
<section id="features">
|
||||
<div class="wrap">
|
||||
<div class="sec-head rv">
|
||||
<p class="eyebrow">Features</p>
|
||||
<h2>Built on the gym floor.</h2>
|
||||
<p class="lead">Every feature here exists because something was awkward between two sets.
|
||||
Nothing is here to sell you anything.</p>
|
||||
</div>
|
||||
|
||||
<section id="opensource"><div class="wrap">
|
||||
<p class="kicker">Open source</p>
|
||||
<h2>AGPL-licensed, forever</h2>
|
||||
<p class="lead">The code is public, the license keeps every fork open, and there is no
|
||||
commercial version waiting behind a curtain. If openGym is useful to you,
|
||||
a ⭐ on GitLab helps more people find it.</p>
|
||||
<p class="lead">There is a Discord for release announcements, self-hosting help and bug
|
||||
reports. It is the fastest way to hear about a new version — and the fastest way
|
||||
to get unstuck if a reverse proxy or a passkey is fighting you.</p>
|
||||
<div class="os">
|
||||
<div class="stat"><b data-gh="stars-n">–</b><span>GitLab stars</span></div>
|
||||
<div class="stat"><b data-gh="forks-n">–</b><span>forks</span></div>
|
||||
<div class="stat"><b data-gh="issues-n">–</b><span>open issues</span></div>
|
||||
<div class="stat"><b>1,324</b><span>exercises</span></div>
|
||||
<div class="stat"><b>13</b><span>languages</span></div>
|
||||
<div class="bento">
|
||||
<div class="tile wide rv">
|
||||
<div class="ic"><svg><use href="#i-play"/></svg></div>
|
||||
<h3>Guided workouts</h3>
|
||||
<p>It already knows what day it is. Today's session opens with your weights from last
|
||||
time filled in, rest timed between sets, and a PR called out the moment you beat one.</p>
|
||||
</div>
|
||||
<div class="tile wide rv">
|
||||
<div class="ic"><svg><use href="#i-trend"/></svg></div>
|
||||
<h3>Progression that follows a rule</h3>
|
||||
<p>Linear, Greyskull LP, double progression or added time, set per routine and
|
||||
overridable per exercise. The targets are right when the session opens, and each
|
||||
one tells you where it came from.</p>
|
||||
</div>
|
||||
|
||||
<div class="tile full rv">
|
||||
<div class="ic"><svg><use href="#i-body"/></svg></div>
|
||||
<h3>A muscle map that reads three ways</h3>
|
||||
<p>The same body diagram, three questions.</p>
|
||||
<div class="trio">
|
||||
<div><b>Balance</b>Where the volume actually went, and which muscles got nothing.</div>
|
||||
<div><b>Fatigue</b>What is still recovering, weighted by how hard each set was.</div>
|
||||
<div><b>Strength</b>How long since you trained it, and the lifts behind it with their estimated 1RM.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tile rv">
|
||||
<div class="ic"><svg><use href="#i-library"/></svg></div>
|
||||
<h3>1,324 exercises</h3>
|
||||
<p>Animated demos, searchable, filtered by body part and by the equipment you actually
|
||||
own. Add your own and they behave like the rest.</p>
|
||||
</div>
|
||||
<div class="tile rv">
|
||||
<div class="ic"><svg><use href="#i-scale"/></svg></div>
|
||||
<h3>Body weight, with a goal line</h3>
|
||||
<p>An interactive chart with your target drawn across it. Every change is coloured by
|
||||
whether it moved you toward it.</p>
|
||||
</div>
|
||||
<div class="tile rv">
|
||||
<div class="ic"><svg><use href="#i-grid"/></svg></div>
|
||||
<h3>A year of training, at a glance</h3>
|
||||
<p>Every session as a square in a heatmap, shaded by how long you trained. Streaks
|
||||
counted, quiet weeks impossible to miss.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="more rv">
|
||||
<h3>And the rest of it</h3>
|
||||
<p class="more-hint">Fourteen more things it does.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hero-btns" style="justify-content:flex-start;margin-top:24px">
|
||||
<a class="btn ghost" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">openGym on GitLab</a>
|
||||
<a class="btn ghost" href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/CONTRIBUTING.md" rel="noopener">Contributing</a>
|
||||
<a class="btn ghost" href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/CHANGELOG.md" rel="noopener">Changelog</a>
|
||||
<a class="btn" href="https://discord.gg/e62jY6fwVb" rel="noopener">Join the Discord</a>
|
||||
|
||||
<!-- A rail rather than a wall of text: this is the "and also" list, so it should be
|
||||
skimmable and skippable. Each card opens the full paragraph in a dialog, and a few
|
||||
carry a link into the docs. Without JS the cards are plain, fully readable blocks. -->
|
||||
<div class="bleed rv">
|
||||
<div class="rail frail">
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-calendar"/></svg></span>
|
||||
<b class="fcard-t">Weekly plan</b>
|
||||
<span class="fcard-b">A routine per weekday. Any single day can be moved when life happens, without editing the plan itself.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-link"/></svg></span>
|
||||
<b class="fcard-t">Supersets and cardio</b>
|
||||
<span class="fcard-b">Plan them, or pair two exercises mid-session and unpair them again. One rest per round, and time-plus-speed logging where weight times reps says nothing.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-timer"/></svg></span>
|
||||
<b class="fcard-t">Timed sets</b>
|
||||
<span class="fcard-b">Planks, hangs and carries are logged by time, with a timer for the set itself. Stop early and it records what you actually held.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-flame"/></svg></span>
|
||||
<b class="fcard-t">Warm-up sets</b>
|
||||
<span class="fcard-b">Mark the ramp-up rows and they stay out of your 1RM, your progression and the fatigue map. Present in the session, absent from the numbers.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-trend"/></svg></span>
|
||||
<b class="fcard-t">Estimated 1RM</b>
|
||||
<span class="fcard-b">Per exercise, from your best eligible set, naming which set it used. It will not guess above 12 reps.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-gauge"/></svg></span>
|
||||
<b class="fcard-t">Effort per set</b>
|
||||
<span class="fcard-b">Rate a set as RIR or RPE, whichever scale you already think in. Optional, and each set keeps the scale it was logged with.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-share"/></svg></span>
|
||||
<b class="fcard-t">Share a plan</b>
|
||||
<span class="fcard-b">Send someone your routines as a small file, or print them as a clean PDF. No workouts, no weigh-ins, and importing merges instead of overwriting.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-import"/></svg></span>
|
||||
<b class="fcard-t">Bring your history</b>
|
||||
<span class="fcard-b">Import from FitNotes, Strong or Hevy, including the RPE they recorded, or body weight straight out of an Apple Health export.</span>
|
||||
<a class="fcard-link" href="docs.html#import">How importing works →</a>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-phone"/></svg></span>
|
||||
<b class="fcard-t">The screen stays awake</b>
|
||||
<span class="fcard-b">No unlocking the phone between sets. The display stays lit while a workout runs and lets go the moment you finish.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-globe"/></svg></span>
|
||||
<b class="fcard-t">13 languages</b>
|
||||
<span class="fcard-b">The full interface, plus exercise instructions in 11 languages and bilingual Brazilian Portuguese names, all loaded on demand.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-key"/></svg></span>
|
||||
<b class="fcard-t">Passkeys, not passwords</b>
|
||||
<span class="fcard-b">Self-hosted profiles sign in with Face ID or a fingerprint. Everyone’s data stays their own.</span>
|
||||
<a class="fcard-link" href="docs.html#selfhost">Self-hosting guide →</a>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-palette"/></svg></span>
|
||||
<b class="fcard-t">Designed, not assembled</b>
|
||||
<span class="fcard-b">Light and dark themes, eight accent colours, a hand-drawn icon set, and the same layout on every phone.</span>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-sparkle"/></svg></span>
|
||||
<b class="fcard-t">Ask an AI about your training</b>
|
||||
<span class="fcard-b">An optional MCP server lets a client like Claude Desktop read your history in plain language. Read-only, on your machine, and not part of the Docker build.</span>
|
||||
<a class="fcard-link" href="docs.html#mcp">Set up the MCP server →</a>
|
||||
</article>
|
||||
<article class="fcard">
|
||||
<span class="fcard-ic"><svg aria-hidden="true"><use href="#i-archive"/></svg></span>
|
||||
<b class="fcard-t">Yours to keep</b>
|
||||
<span class="fcard-b">One-tap JSON export and import. Your training log is a file you own, not a row in someone’s database.</span>
|
||||
<a class="fcard-link" href="docs.html#backup">Backups →</a>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</div></section>
|
||||
<div class="wrap">
|
||||
<div class="frail-nav" hidden>
|
||||
<button class="rnav" type="button" data-dir="-1" aria-label="Previous"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 5.5L8 12l6.5 6.5"/></svg></button>
|
||||
<button class="rnav" type="button" data-dir="1" aria-label="Next"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 5.5L16 12l-6.5 6.5"/></svg></button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="screens">
|
||||
<div class="wrap">
|
||||
<div class="sec-head rv">
|
||||
<p class="eyebrow">Screenshots</p>
|
||||
<h2>Five screens, and that's the app.</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bleed rv">
|
||||
<div class="rail">
|
||||
<figure><div class="device"><img src="img/home.png" alt="Home screen with the weekly overview and body-weight chart" loading="lazy" width="1170" height="2532"></div><figcaption>Home</figcaption></figure>
|
||||
<figure><div class="device"><img src="img/workout.png" alt="Guided workout screen with sets, rest timer and pre-filled weights" loading="lazy" width="1170" height="2532"></div><figcaption>Workout</figcaption></figure>
|
||||
<figure><div class="device"><img src="img/stats.png" alt="Stats screen with the activity heatmap and charts" loading="lazy" width="1170" height="2532"></div><figcaption>Stats</figcaption></figure>
|
||||
<figure><div class="device"><img src="img/plan.png" alt="Weekly plan screen with a routine per weekday" loading="lazy" width="1170" height="2532"></div><figcaption>Plan</figcaption></figure>
|
||||
<figure><div class="device"><img src="img/library.png" alt="Exercise library with search and filters" loading="lazy" width="1170" height="2532"></div><figcaption>Library</figcaption></figure>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrap"><p class="rail-hint">Swipe through them.</p></div>
|
||||
</section>
|
||||
|
||||
<section id="demo">
|
||||
<div class="wrap">
|
||||
<div class="sec-head rv">
|
||||
<p class="eyebrow">Live demo</p>
|
||||
<h2>Try it right here.</h2>
|
||||
<p class="lead">The real app with a seeded example history, running in your browser.
|
||||
Start a workout, break something, change anything you like.</p>
|
||||
</div>
|
||||
|
||||
<!-- The iframe is injected by site.js, and only on viewports wide enough to show the
|
||||
frame. On a phone, a phone inside a phone is not worth the download. -->
|
||||
<div class="demo-stage rv">
|
||||
<div class="device"><div class="device-slot" data-demo="/demo/"></div></div>
|
||||
</div>
|
||||
<p class="demo-note">Demo data lives only in this browser and can be reset from its own
|
||||
Settings. <a href="/demo/">Open it full-screen</a> if you would rather have the room.</p>
|
||||
|
||||
<div class="demo-card">
|
||||
<p>The demo wants the whole screen to itself. Its data lives only in this browser and
|
||||
can be reset from its own Settings.</p>
|
||||
<a class="btn" href="/demo/">Open the live demo</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="download">
|
||||
<div class="wrap">
|
||||
<div class="sec-head rv">
|
||||
<p class="eyebrow">Get openGym</p>
|
||||
<h2>One app, two flavors.</h2>
|
||||
<p class="lead">Same codebase. The choice is where your data lives: entirely on your
|
||||
phone, or on a server you control.</p>
|
||||
</div>
|
||||
<div class="duo">
|
||||
<div class="card hl rv">
|
||||
<div class="ic"><svg><use href="#i-phone"/></svg></div>
|
||||
<h3>Mobile app</h3>
|
||||
<p class="for">For anyone. Install it and you are done.</p>
|
||||
<ul>
|
||||
<li>Everything stays on your phone</li>
|
||||
<li>No account, no server, no setup</li>
|
||||
<li>Native workout-day reminders</li>
|
||||
<li>Backups through the share sheet</li>
|
||||
<li class="no">No sync across devices</li>
|
||||
</ul>
|
||||
<div class="push">
|
||||
<a class="btn" href="openGym.apk" download>Download for Android</a>
|
||||
<p class="meta">v1.2.12 · 4.4 MB · Android 6.0+ · signed APK. Your browser will ask
|
||||
before installing; that is normal outside the Play Store.</p>
|
||||
<p class="meta">Every release is also built and signed by CI and attached to the
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab
|
||||
releases page</a>, checksums and all.</p>
|
||||
<p class="meta"><b>On iPhone?</b> Apple does not allow installs outside the App Store.
|
||||
Use the self-hosted version as a home-screen app instead, or see
|
||||
<a href="docs.html#iphone">the docs</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card rv">
|
||||
<div class="ic"><svg><use href="#i-server"/></svg></div>
|
||||
<h3>Self-hosted</h3>
|
||||
<p class="for">For homelabbers, and the people they train with.</p>
|
||||
<ul>
|
||||
<li>Sync across all your devices</li>
|
||||
<li>Passkey profiles for several people</li>
|
||||
<li>Your data readable on the desktop</li>
|
||||
<li>A home-screen app on iPhone and Android</li>
|
||||
<li>One <code>docker compose up</code></li>
|
||||
</ul>
|
||||
<div class="push">
|
||||
<a class="btn ghost" href="docs.html#selfhost">Self-hosting guide</a>
|
||||
<p class="meta">AGPL-3.0 · prebuilt images for amd64 and arm64</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="story">
|
||||
<div class="wrap story rv">
|
||||
<blockquote>openGym started as <b>a tiny app I built for myself.</b> I wanted to log my
|
||||
workouts and my weight without a subscription app claiming my training data. Then
|
||||
friends wanted in, and it grew a mind of its own.</blockquote>
|
||||
<p class="who">Duarte Santos · <a href="about.html">read the whole story</a></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="opensource">
|
||||
<div class="wrap">
|
||||
<div class="sec-head rv">
|
||||
<p class="eyebrow">Open source</p>
|
||||
<h2>AGPL-licensed, and staying that way.</h2>
|
||||
<p class="lead">The code is public, the license keeps every fork open, and there is no
|
||||
commercial edition waiting behind a curtain.</p>
|
||||
</div>
|
||||
|
||||
<div class="specs rv">
|
||||
<div class="spec-head">
|
||||
<span>openGym in numbers</span>
|
||||
<span class="live">repo counts are live</span>
|
||||
</div>
|
||||
<div class="spec-cells">
|
||||
<div><b data-gh="stars-n">–</b><span>stars</span></div>
|
||||
<div><b data-gh="forks-n">–</b><span>forks</span></div>
|
||||
<div><b data-gh="issues-n">–</b><span>open issues</span></div>
|
||||
<div><b>1,324</b><span>exercises</span></div>
|
||||
<div><b>13</b><span>languages</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions rv" style="margin-top:28px">
|
||||
<a class="btn ghost" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">openGym on GitLab <span class="ct" data-gh="stars">★</span></a>
|
||||
<a class="link" href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/CONTRIBUTING.md" rel="noopener">Contributing</a>
|
||||
<a class="link" href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/CHANGELOG.md" rel="noopener">Changelog</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="elsewhere">
|
||||
<div class="wrap">
|
||||
<div class="sec-head rv">
|
||||
<p class="eyebrow">Elsewhere</p>
|
||||
<h2>Where openGym lives.</h2>
|
||||
</div>
|
||||
|
||||
<div class="quad rv">
|
||||
<a class="pad gitlab" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">
|
||||
<span class="pad-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-gitlab"/></svg></span>
|
||||
<span class="pad-body">
|
||||
<b>GitLab</b>
|
||||
<span>The code, the issues and the releases.</span>
|
||||
<span class="rest">The CI here builds the container images and signs every APK.</span>
|
||||
</span>
|
||||
<span class="pad-go">Open the repo</span>
|
||||
</a>
|
||||
|
||||
<a class="pad github dead" href="https://github.com/DuarteSantos8/openGym" rel="noopener">
|
||||
<span class="pad-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-github"/></svg></span>
|
||||
<span class="pad-body">
|
||||
<b>GitHub <span class="tag">404</span></b>
|
||||
<span>Where openGym was open-sourced — and where a lot of links still point.</span>
|
||||
<span class="rest">The account is suspended, so this one goes nowhere.</span>
|
||||
</span>
|
||||
<span class="pad-go">Dead link, kept honest</span>
|
||||
</a>
|
||||
|
||||
<a class="pad bmc" href="https://buymeacoffee.com/duartesantos" rel="noopener">
|
||||
<span class="pad-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-bmc"/></svg></span>
|
||||
<span class="pad-body">
|
||||
<b>Buy me a coffee</b>
|
||||
<span>openGym is free, and stays free.</span>
|
||||
<span class="rest">If it saved you a subscription, this is the one place to say thanks.</span>
|
||||
</span>
|
||||
<span class="pad-go">Support the project</span>
|
||||
</a>
|
||||
|
||||
<a class="pad discord" href="https://discord.gg/e62jY6fwVb" rel="noopener">
|
||||
<span class="pad-ic"><svg viewBox="0 0 71 55" aria-hidden="true"><use href="#i-discord"/></svg></span>
|
||||
<span class="pad-body">
|
||||
<b>Discord</b>
|
||||
<span>Releases, self-hosting help, and somewhere to report a bug.</span>
|
||||
<span class="rest">Docker, reverse proxies and passkeys — new versions land here first.</span>
|
||||
</span>
|
||||
<span class="pad-go">Join the server</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<footer><div class="wrap foot">
|
||||
<span>openGym · AGPL-3.0 · © 2026 <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></span>
|
||||
<span class="c">openGym · AGPL-3.0 · © 2026 <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></span>
|
||||
<div class="links">
|
||||
<a href="docs.html">Docs</a>
|
||||
<a href="about.html" class="hide-s">About</a>
|
||||
<a href="about.html">About</a>
|
||||
<a href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab</a>
|
||||
<a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
|
||||
<a href="/#download">Download</a>
|
||||
<a href="#download">Download</a>
|
||||
</div>
|
||||
</div></footer>
|
||||
|
||||
<script src="site.js" defer></script>
|
||||
<script src="site.js?v=9" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
+139
-13
@@ -1,11 +1,100 @@
|
||||
// Live repo numbers in the nav + open-source strip. Fails silently — the site works
|
||||
// fine without them. Points at gitlab.com while the GitHub account is suspended;
|
||||
// switch the two API URLs back to api.github.com once it is restored.
|
||||
//
|
||||
// The cache keys carry a _gl suffix: a visitor with a still-warm sessionStorage entry
|
||||
// from the gitea era would otherwise be read with the old field names and show NaN.
|
||||
// Behaviour for the openGym site: the phone menu, the scroll reveals, the demo frame,
|
||||
// and the two things that come from the GitLab API (repo counts, release timeline).
|
||||
// Every one of them fails soft — the page is complete without any of this running.
|
||||
|
||||
const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym'
|
||||
|
||||
/* ------------------------------------------------------------------ phone menu */
|
||||
;(() => {
|
||||
const btn = document.querySelector('.nav-toggle')
|
||||
const menu = document.getElementById('menu')
|
||||
if (!btn || !menu) return
|
||||
|
||||
const close = () => {
|
||||
menu.classList.remove('open')
|
||||
btn.setAttribute('aria-expanded', 'false')
|
||||
// menu-open drives the dimming scrim; overflow keeps the page still underneath.
|
||||
document.body.classList.remove('menu-open')
|
||||
document.body.style.overflow = ''
|
||||
}
|
||||
btn.addEventListener('click', () => {
|
||||
const open = menu.classList.toggle('open')
|
||||
btn.setAttribute('aria-expanded', String(open))
|
||||
document.body.classList.toggle('menu-open', open)
|
||||
// The sheet scrolls on its own; letting the page scroll behind it is the classic
|
||||
// mobile-menu bug where the reader loses their place on close.
|
||||
document.body.style.overflow = open ? 'hidden' : ''
|
||||
})
|
||||
// The scrim is body::after, so it has no element of its own to listen on — a tap
|
||||
// that lands outside both the sheet and the button is a tap on the scrim.
|
||||
document.addEventListener('click', e => {
|
||||
if (!document.body.classList.contains('menu-open')) return
|
||||
if (e.target.closest('#menu') || e.target.closest('.nav-toggle')) return
|
||||
close()
|
||||
})
|
||||
// Tapping a link inside the sheet navigates, so the sheet has to get out of the way —
|
||||
// in-page anchors especially, which do not reload anything.
|
||||
menu.addEventListener('click', e => { if (e.target.closest('a')) close() })
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape') close() })
|
||||
// Rotating to landscape can widen past the breakpoint while the sheet is open, which
|
||||
// would leave the body scroll-locked with no visible sheet to close.
|
||||
addEventListener('resize', () => { if (innerWidth > 780) close() })
|
||||
})()
|
||||
|
||||
/* --------------------------------------------------------------- scroll reveal */
|
||||
;(() => {
|
||||
const items = document.querySelectorAll('.rv')
|
||||
if (!items.length) return
|
||||
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
if (reduce || !('IntersectionObserver' in window)) {
|
||||
items.forEach(el => el.classList.add('in'))
|
||||
return
|
||||
}
|
||||
const io = new IntersectionObserver((entries, obs) => {
|
||||
for (const e of entries) {
|
||||
if (!e.isIntersecting) continue
|
||||
e.target.classList.add('in')
|
||||
obs.unobserve(e.target) // one-way: nothing re-hides on the way back up
|
||||
}
|
||||
}, { rootMargin: '0px 0px -12% 0px', threshold: .06 })
|
||||
items.forEach(el => io.observe(el))
|
||||
})()
|
||||
|
||||
/* ------------------------------------------------------------------ demo frame
|
||||
The demo is the whole frontend bundle. It is only worth loading when the framed
|
||||
phone is actually on screen, and never on a narrow viewport, where the CSS hides
|
||||
the frame in favour of a plain "open it full-screen" card. */
|
||||
;(() => {
|
||||
const slot = document.querySelector('[data-demo]')
|
||||
if (!slot) return
|
||||
|
||||
const mount = () => {
|
||||
if (slot.dataset.mounted) return
|
||||
if (!slot.offsetParent) return // frame hidden — phone layout
|
||||
slot.dataset.mounted = '1'
|
||||
const f = document.createElement('iframe')
|
||||
f.src = slot.dataset.demo
|
||||
f.title = 'openGym live demo'
|
||||
f.loading = 'lazy'
|
||||
f.style.cssText = 'width:100%;height:100%;border:0;display:block;border-radius:34px;background:#000'
|
||||
slot.appendChild(f)
|
||||
}
|
||||
|
||||
if (!('IntersectionObserver' in window)) { mount(); return }
|
||||
const io = new IntersectionObserver((entries, obs) => {
|
||||
for (const e of entries) if (e.isIntersecting) { mount(); obs.disconnect() }
|
||||
}, { rootMargin: '600px' }) // load just before it scrolls into view
|
||||
io.observe(slot)
|
||||
// A rotation or a resized window can reveal the frame long after that first check.
|
||||
addEventListener('resize', mount, { passive: true })
|
||||
})()
|
||||
|
||||
/* ------------------------------------------------------- repo counts (nav + specs)
|
||||
Points at gitlab.com while the GitHub account is suspended; switch the two API URLs
|
||||
back to api.github.com once it is restored.
|
||||
|
||||
The cache keys carry a _gl suffix: a visitor with a still-warm sessionStorage entry
|
||||
from the gitea era would otherwise be read with the old field names and show NaN. */
|
||||
;(async () => {
|
||||
const set = (id, v) => document.querySelectorAll('[data-gh="' + id + '"]').forEach(el => { el.textContent = v })
|
||||
try {
|
||||
@@ -37,13 +126,14 @@ const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym'
|
||||
} catch (e) { /* offline / rate-limited — leave placeholders */ }
|
||||
})()
|
||||
|
||||
// About page: build the milestones timeline from the published GitLab releases, so the
|
||||
// page updates itself with every release. The static entries marked data-fallback stay
|
||||
// in place when the API is unreachable; the hand-written first entry is always kept.
|
||||
//
|
||||
// GitLab's release objects differ from Gitea's: the notes are `description` (not `body`),
|
||||
// the date is `released_at` (not `published_at`), the web link sits in `_links.self`, and
|
||||
// there is no draft/prerelease pair — a not-yet-released one is `upcoming_release`.
|
||||
/* -------------------------------------------------------------- about timeline
|
||||
Built from the published GitLab releases, so the page updates itself with every
|
||||
release. The static entries marked data-fallback stay in place when the API is
|
||||
unreachable; the hand-written first entry is always kept.
|
||||
|
||||
GitLab's release objects differ from Gitea's: the notes are `description` (not `body`),
|
||||
the date is `released_at` (not `published_at`), the web link sits in `_links.self`, and
|
||||
there is no draft/prerelease pair — a not-yet-released one is `upcoming_release`. */
|
||||
;(async () => {
|
||||
const tl = document.getElementById('milestones')
|
||||
if (!tl) return
|
||||
@@ -86,3 +176,39 @@ const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym'
|
||||
}
|
||||
} catch (e) { /* fallback entries stay */ }
|
||||
})()
|
||||
|
||||
/* The "and the rest of it" rail: arrows for pointers that cannot swipe. The cards are plain
|
||||
reading, so there is nothing to activate on them. */
|
||||
;(() => {
|
||||
const rail = document.querySelector('.frail')
|
||||
if (!rail) return
|
||||
const nav = document.querySelector('.frail-nav')
|
||||
if (nav) {
|
||||
nav.hidden = false
|
||||
const [prev, next] = nav.querySelectorAll('.rnav')
|
||||
const step = () => (rail.querySelector('.fcard')?.offsetWidth || 260) + 16
|
||||
nav.addEventListener('click', e => {
|
||||
const btn = e.target.closest('.rnav')
|
||||
if (btn) rail.scrollBy({ left: Number(btn.dataset.dir) * step(), behavior: 'smooth' })
|
||||
})
|
||||
const sync = () => {
|
||||
prev.disabled = rail.scrollLeft < 4
|
||||
next.disabled = rail.scrollLeft > rail.scrollWidth - rail.clientWidth - 4
|
||||
}
|
||||
rail.addEventListener('scroll', sync, { passive: true })
|
||||
addEventListener('resize', sync)
|
||||
sync()
|
||||
}
|
||||
})()
|
||||
|
||||
/* The hero intro is armed in the inline <head> script, before the first paint — a deferred
|
||||
script would arm it too late and the hero would flash. All this does is take the class off
|
||||
once the last element has landed, so nothing stays mid-animation. */
|
||||
;(() => {
|
||||
const root = document.documentElement
|
||||
if (!root.classList.contains('intro')) return
|
||||
const done = () => root.classList.remove('intro')
|
||||
const last = document.querySelector('.hero-stage') || document.querySelector('.hero .actions')
|
||||
if (last) last.addEventListener('animationend', done, { once: true })
|
||||
setTimeout(done, 2400) // if the animation never fires, do not leave the hero hidden
|
||||
})()
|
||||
+760
-221
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user