Compare commits

..
15 Commits
Author SHA1 Message Date
Duarte Santos 4c829b6d1f Release v1.2.3: fold in the screen lock, the rest timer and the settings grouping
v1.2.3 was tagged but never published, so everything since v1.2.2 -- the last
published release -- belongs in this one version rather than a new number.

CHANGELOG gets the three new sections, README a feature bullet, SELF_HOSTING a note
that the Wake Lock API wants HTTPS (or localhost) like passkeys do and that iOS
refuses it in Low Power Mode. Website: the APK line said v1.2.2 while the download is
1.2.3, and the feature grid gained the screen-awake card.
2026-07-31 15:35:36 +02:00
Duarte Santos c5e131f81c Rest timer: take 15 seconds off, not only add them
addRest now accepts a negative step, and taking off more than is left finishes the
rest instead of counting into the negative -- which also kept a negative duration out
of the progress bar and out of the server-side push schedule.

Three controls and the clock do not fit one line on a phone: at 360px the bar was
left with about 30px and stopped saying anything. The rest variant stacks -- clock and
bar on top, controls beneath, -15 and +15 together in number-line order, Skip pushed
to the far edge so the button that ends the rest is not next to the one you tap to buy
more time. Scoped to #timer.rest, so the work timer keeps its single row. Back to one
line at >=1000px, and the card is nearly opaque now -- the set rows underneath were
reading through it.
2026-07-31 15:35:27 +02:00
Duarte Santos 248da53dca Keep the screen awake while a workout is running
Locking and unlocking the phone between every set was the worst part of logging on
one. Settings -> During a workout -> Keep screen awake, on by default; the lock is
held only while S.active exists, so it follows the workout rather than the route and
lets go when you finish.

The browser drops the lock whenever the document stops being visible, which is what
happens the moment you glance at a message, so wakelock.js keeps its own 'wanted'
intent and re-acquires on every visibilitychange. It also releases a sentinel that
arrives after a release landed mid-request, and swallows the rejection iOS gives in
Low Power Mode. Where the API is missing the row shows disabled instead of offering
a switch that does nothing.

Settings is regrouped by what each thing affects while the row needed a home:
General (language, units), During a workout (rest timer, keep awake, sounds, effort),
Notifications, Appearance, Data. Nothing removed, no setting changed meaning.
2026-07-31 15:35:18 +02:00
Duarte Santos 42d3659615 Release v1.2.3: effort per set, and the RPE your old app already had
Everything published since v1.2.2 is one number: the RIR column from #21 and
the RIR/RPE scale choice built on top of it, plus the importer reading the
RPE that Hevy and Strong export.

Changelog, README, roadmap and the website all describe the feature as it
actually shipped — a rating that is optional, keeps its scale per set, and
is deliberately not an input to progression or the 1RM estimate.

Android versionCode 4: it has to increase strictly or the APK will not
install over the v1.2.2 build already out there.
2026-07-31 00:16:43 +02:00
Duarte Santos ca917f0320 Merge branch 'effort-metric': effort per set (RIR / RPE)
Adds an optional per-set effort rating on either of the two scales people
actually use, generalising the RIR column from #21 rather than bolting a
second one next to it, and teaches the importer to read the RPE that Hevy
and Strong already export.
2026-07-31 00:14:51 +02:00
Duarte Santos 54fb14be13 Import: bring the RPE other apps already recorded
Hevy and Strong both write an RPE next to every set and the importer was
dropping the column, so a history imported from either arrived flatter than
the file it came from. It is read now, along with an RIR column if a file
happens to have one.

A blank cell stays unrated rather than becoming 0, and a written-out 0 is
only a rating on the RIR scale — RIR 0 is a set taken to failure, while RPE
runs 1-10, so an app writing 0 there means "nothing here" and reading it as
an effort would stamp one on every unrated set in the file. Ratings above
the scale are capped rather than thrown away, junk is ignored, and effort
only rides along on weighted rep sets — a treadmill row has nowhere to show
it. A file carrying both columns is read as RIR, the precedence setLabel
already reads them back with.

The import summary reports how many sets brought a rating, and says where
to switch the column on when the profile is not logging effort yet —
otherwise the ratings arrive invisibly and look like they were lost.

Export needed no change: the backup is the whole state serialised, so both
fields and the setting travel with it. There is a test pinning that now,
along with 11 for the import paths.
2026-07-30 23:59:01 +02:00
Duarte Santos 6905117352 Effort stepper: count up from the bottom of the scale
The first + on an empty cell jumped straight to a "typical working set"
(RIR 2 / RPE 8), skipping 0 and 1 with no way to see why. A stepper that
lands somewhere other than where counting would take you is just puzzling,
so it now starts at the bottom of the scale and walks up in even steps like
every other stepper in the app: RIR from 0, RPE from 6 — the scale is only
meaningful for working sets and anything lighter is a warm-up nobody rates.

Stepping back off the floor clears the cell again, so a mistap is undoable
instead of sticking at 0 — which on the RIR scale claims the set went to
failure. − on a cell that was never filled in still leaves it empty.

The stepping moved out of the view into stepEffort/capEffort in history.js,
where it can be tested: 16 new cases covering the scale walk, the floor and
ceiling, the clear-on-undershoot, half-step rounding, junk settings values,
the showRir overlay every load path performs, and a session's worth of
logging end to end.

A typed value is still only capped, never floored — clamping up would turn
the "1" of "10" into the floor and fight the input.

The help sheet no longer claims the highlighted row is where + starts; it is
where working sets usually land. Reworded in all 11 language packs.
2026-07-30 23:52:57 +02:00
Duarte Santos 0c6c22c04b Effort help: show the two scales as one table, (i) before the control
The sheet explained RIR and RPE in three paragraphs, which is a bad way to
say "these are the same judgement counted from opposite ends" — you had to
hold both sentences in your head to see the correspondence. A conversion
table shows it in one look: RIR and RPE in fixed tabular columns you can
read straight down, the feel in words next to them, and the row a working
set usually lands on highlighted in the accent.

The table is built from the same parts as the app's grouped lists (surface
fill, inset hairlines) instead of a real <table>, so it inherits the card
look and wraps on a narrow phone.

The (i) moves ahead of the segmented control: you reach the explanation on
the way to the choice rather than past it.

The three paragraph strings are replaced by the table's strings in all 11
language packs.
2026-07-30 23:42:21 +02:00
Duarte Santos 4e27461b7e Effort per set: RIR or RPE, whichever scale you think in
The RIR column becomes a three-way setting (Off / RIR / RPE). Both scales
measure the same judgement from opposite ends — RPE 8 is RIR 2 — so they
share one column and one stepper, but keep their own field on the set.

A set is never silently rewritten into the other scale: switching the
setting changes what new sets ask for, and old sets still read back with
the scale they were logged with.

Profiles carrying the old showRir boolean keep their column (effortOf
falls back to it until the new setting is chosen), so a backup or another
device that still has the flag does not lose the column.

The steppers now know the scale: the first + lands on a typical working
set (RIR 2 / RPE 8) instead of the end of the scale, and typed values are
capped at 10 — there is no RPE 12.
2026-07-30 23:35:47 +02:00
Duarte Santos fa978a1bb4 Merge PR #21: optional RIR column on reps-mode sets
octaviodimarco's RIR (reps in reserve) stepper for reps-mode sets, opt-in under
Settings → Units & timer, plus a fixup for the leftover RIR-0 stamp and the
header alignment.
2026-07-30 19:53:21 +02:00
Duarte Santos c08381e558 RIR: an unlogged RIR stays unlogged, and the header lines up
A set that never had an RIR could still end up carrying one: NumberField mapped an
empty field to 0 and the − button clamped to 0, so one stray tap stamped '(RIR 0)' —
went to failure — on the set for good, in history and in backups, with no way back.
An optional field now clears to null (the key is dropped), and stepping down from
empty leaves it empty. A typed 0 still logs a real 0.

The row's three-stepper sizing also has to reach the header, or the labels sit up
to 5px off the columns they name.
2026-07-30 19:53:14 +02:00
Octavio Di Marco c5172d0633 i18n: add RIR strings to all 11 language packs
t('RIR') and the new Settings toggle label had no entries in
src/locales/ — RIR itself is kept as the acronym across languages
(same treatment as 1RM), only the surrounding label text is translated.
2026-07-30 19:20:00 +02:00
Octavio Di Marco c3929b0a70 Remove RIR auto-check; gate the column behind a setting
Two blockers from review:

- NumberField.commit() fires onChange on every keystroke, so typing
  a decimal RIR (e.g. 1.5) committed the auto-check after the first
  character, before the value was finished — and the same auto-check
  turned a stray tap on an empty field's "−" (or clearing it) into a
  permanent "RIR 0", since 0 is indistinguishable from unset once the
  key exists on the set. Logging RIR is back to a plain field with no
  side effect; the checkbox is the only way to mark a set done, same
  as weight and reps.

- The RIR stepper narrowed every reps-mode row's +/- buttons for
  everyone, including the majority not running an RIR-based program.
  It's now behind a `showRir` setting (Settings → Units & timer,
  default off), so the existing row is untouched unless opted in.
2026-07-30 19:20:00 +02:00
Octavio Di Marco eb582e3c7b Auto-check a set when its RIR is logged
Logging RIR is naturally the last thing you do for a set — by the
time you're rating how many reps you had left, you've already
finished it. Editing the RIR field (typing or the +/- stepper) now
checks the set off itself, same beep/vibrate/rest-timer as tapping
the checkbox by hand, so that's one less tap per set.

Weight and reps are unaffected — those are often set before the set
is performed (pre-filled targets), so editing them shouldn't imply
it's done. Guarded by !s.done so re-editing RIR on an already-done
set (e.g. a correction) doesn't re-fire the toggle side effects.
2026-07-28 22:45:28 +02:00
Octavio Di Marco 6714b16e6a Add optional RIR (reps in reserve) to reps-mode sets
Adds a third stepper column, next to weight and reps, for logging RIR
on strength sets — not shown for cardio or timed holds, where it has
no meaning. RIR is purely a logging/display addition: it never
touches the progression engine (linear/Greyskull/double progression
only ever read weight/reps/seconds), and it round-trips through the
existing whole-object backup export/import with no code changes there.

The set object only gains an `rir` key once the user actually logs a
value (buildSets/addSet don't pre-seed it), matching how missing
fields already read as undefined elsewhere in the store — no schema
version or migration needed for existing logged workouts.

Fitting a third stepper next to weight+reps on narrow phones needed
the same treatment as the exercise-config sheet's three-steppers-in-a-row
(.cfgrow): narrower buttons and a smaller value font just for rows
that show RIR, verified by hand at 360-390px with edge-case values
(2-3 digit weight, double-digit reps, decimal RIR together).

"Last time" summaries now append "(RIR n)" when a set has one logged,
covered by new setLabel tests including the rir: 0 case (0 is a valid
RIR and must not be treated as absent).
2026-07-28 17:10:03 +02:00
34 changed files with 1113 additions and 68 deletions

No files matched your search

+78
View File
@@ -1,5 +1,83 @@
# Changelog
## v1.2.3 — 2026-07-31
How hard a set was, in whichever of the two scales you already think in — and the ratings your
old app recorded come across with the rest of your history. Plus: the phone stops locking itself
mid-workout, the rest timer can hand time back as well as take it, and Settings is grouped by
what each thing actually affects.
### The screen stays on while you train
- ☀️ **Keep screen awake — Settings → *During a workout*, on by default.** Locking, unlocking
and finding your place again between every set was the single most annoying thing about
logging on a phone. The screen now stays lit for as long as a workout is running and lets go
the moment you finish it, so nothing is held while you are not training.
- **It survives a tab switch.** Browsers release the lock whenever the page stops being visible,
which is exactly what happens when you glance at a message. The lock is taken again each time
the app comes back, rather than dying the first time you look away.
- **It follows the workout, not the screen you are on.** Checking Stats mid-session keeps the
screen awake.
- **Where it isn't available, it says so.** iOS grants no wake lock in Low Power Mode, and older
browsers have no Wake Lock API at all — the first is silent, the second shows the row disabled
rather than offering a switch that does nothing. Needs HTTPS, like every other modern browser
capability.
### Rest timer: take 15 seconds off, too
- ⏳ **A −15s button next to +15s.** The timer could only ever be extended or skipped outright;
now it goes both ways. Taking off more than is left finishes the rest rather than counting
into the negative — the same thing Skip does.
- **Rearranged so three controls fit.** The clock and the progress bar take the top row and the
controls sit underneath: −15 and +15 together in number-line order, Skip pushed to the far
edge so the button that ends the rest is not next to the one you tap to buy more time. On a
wide screen it stays on one line. Tap targets are bigger than they were.
- **The bar is nearly opaque.** The set rows underneath were reading through it and making the
clock hard to pick out.
### Settings, grouped by what it affects
- **General** (language, units) · **During a workout** (rest timer, keep screen awake, sounds,
effort per set) · **Notifications** · **Appearance** (theme, body diagram, accent) · **Data**.
- The old grouping mixed axes: "Units & timer" put a display preference next to two workout
behaviours, language sat under Appearance, and *Load starter plan* was buried between the
backup actions and the destructive reset. Data now reads in the order you would use it — fill
the plan, bring history over from another app, restore a backup, export one, wipe everything.
- Nothing was removed and no setting changed its meaning.
### Effort per set: RIR or RPE (#21)
- 🎯 **A third column on a working set, off by default.** Settings → *Effort per set* switches
it between **Off**, **RIR** and **RPE**. It only appears on weighted rep sets: a plank or a
treadmill row has nowhere to put it.
- **Two names for the same judgement.** RIR counts the reps you left in the tank; RPE reads the
same effort off a 10-point scale, so RPE ≈ 10 − RIR. The setting has an (i) that lays the two
scales side by side in a conversion table rather than explaining them in a paragraph.
- **Each set keeps the scale it was logged with.** Switching the setting changes what new sets
ask for and nothing else — history is never silently rewritten, and a set logged as RIR 2
still reads back as RIR 2 years later.
- **An unrated set stays unrated.** Blank and 0 are different things: RIR 0 says the set went to
failure. So `−` on an untouched cell leaves it empty, `+` starts at the bottom of the scale
and walks up in even steps, and stepping back off the bottom clears the cell again — a mistap
is always undoable.
- **Nothing else reads the value.** Progression rules and estimated 1RM are unaffected; the
rating is yours to look at, not an input to the maths.
- Upgrading keeps the column you had: a profile still carrying the old `showRir` flag — from
this device, a sync, or a backup restored later — comes across as RIR.
### Import brings your ratings with it
- 📥 **The RPE Hevy and Strong export is no longer dropped.** An `RPE` column is read into the
set, as is an `RIR` column if a file has one, and the import summary says how many sets
arrived with a rating — plus where to switch the column on if it's off.
- A blank cell stays unrated rather than becoming 0. A written-out `0` counts as a rating on the
RIR scale (a set to failure) but not on RPE, which starts at 1 — apps write 0 there to mean
"nothing here", and reading it as an effort would stamp one on every unrated set in the file.
- Ratings above the scale are capped instead of thrown away, and junk in the column is ignored
without losing the set.
- Backups already carried both fields and the setting, since a backup is the whole state — there
are now tests pinning that, so it can't quietly stop being true.
## v1.2.2 — 2026-07-25
Training that moves on its own: an exercise can now be logged by time instead of reps, the
+4 -1
View File
@@ -60,10 +60,12 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a
- 🏋️ **Weekly plan** — a routine per weekday, over a library of **1,324 exercises** (searchable, with animated demos)
- 🗓️ **Reschedule any day** — sick, missed a session, or fewer gym days this week? Move a workout to another day without touching your weekly plan
- ▶️ **Guided workouts** — it knows what day it is and starts today's session; asks your body weight first, pre-fills your weights from last time, rest timer, PR detection, per-exercise weight tracking
- ☀️ **The screen stays awake while you train** — no unlocking the phone and finding your place again between every set. On for as long as a workout is running, released the moment you finish it, and switchable off in Settings
- 🔗 **Supersets** — build them, and log them back-to-back with a rest only after the pair
- ⏱️ **Timed exercises** — planks, hangs, wall sits and loaded carries are logged by time, not reps, with a work timer that counts the set itself (separate from the rest timer) and logs the time you actually held. They can carry weight too
- 📈 **Progression that follows a rule** — pick one per routine, override it per exercise: linear, **Greyskull LP** (AMRAP top set, double jumps, 10 % resets), double progression through a rep range, or adding time. Your weights are already right when the session opens, and every target says *why* it's that number. Missed reps never advance the load, stalls trigger a deload, and bodyweight exercises progress in reps instead
- 💪 **Estimated 1RM** — per exercise, from your best eligible set (it names which one), with its own progress curve and a calculator for sets you haven't done. Won't guess above 12 reps
- 🎯 **Effort per set, in your scale** — an optional third column rating how hard a set was, as **RIR** (reps left in the tank) or **RPE** (the same judgement on a 10-point scale). Off by default; each set keeps the scale it was logged with, and nothing else reads the value — your progression and 1RM are unaffected
- 🏃 **Cardio** — log time + speed, not just weight × reps
- 📤 **Share a plan** — send someone your routines and week schedule as a small file (no workouts, no weigh-ins), or print it as a clean PDF. Importing merges, so their plan is never overwritten
- 🔧 **Filter by equipment** — narrow the library to what you actually own; the options adapt to what you've picked, so every combination on screen has results behind it
@@ -162,7 +164,8 @@ Rough, community-driven — ideas and PRs welcome:
- [x] Estimated 1RM per exercise
- [ ] Percentage / training-max programming (5/3/1-style) on top of the progression engine
- [ ] More starter plans (upper/lower, full-body, 5×5)
- [x] Importers from FitNotes / Strong / Hevy, and body weight from Apple Health
- [x] Importers from FitNotes / Strong / Hevy (including the RPE they record), and body weight from Apple Health
- [x] Effort per set — RIR or RPE, whichever scale you think in
- [ ] Body measurements (waist, arms…) alongside weight
- [ ] Per-exercise notes & plate calculator
- [ ] Exercise instructions in German & Portuguese (UI is translated; upstream dataset doesn't ship these yet)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gym-api",
"version": "1.2.2",
"version": "1.2.3",
"private": true,
"type": "module",
"main": "server.js",
+5
View File
@@ -130,6 +130,11 @@ first run and saved to `./data/vapid.json`, and each user's browser reports its
automatically when they turn the reminder on — it fires at their local time, and follows them if
they travel, regardless of what timezone the server itself runs in.
**Keep screen awake** (Settings → *During a workout*) has the same transport requirement: the
Wake Lock API is only available over HTTPS or on `http://localhost`, so on a plain-LAN-IP
instance the switch shows as unsupported. Nothing to configure server-side either way, and iOS
refuses the lock while the phone is in Low Power Mode.
## 7. Updating
Running prebuilt images:
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "ch.duartesantos.opengym"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3
versionName "1.2.2"
versionCode 4
versionName "1.2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "opengym-frontend",
"version": "1.2.2",
"version": "1.2.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opengym-frontend",
"version": "1.2.2",
"version": "1.2.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@capacitor/core": "^7.6.8",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "opengym-frontend",
"private": true,
"version": "1.2.2",
"version": "1.2.3",
"type": "module",
"scripts": {
"dev": "vite",
+3
View File
@@ -6,6 +6,7 @@ import { bindUI } from './components/ui.jsx'
import { ACCENTS } from './lib/format.js'
import { setLang, useLang } from './lib/i18n.js'
import { setNav } from './lib/nav.js'
import { useWakeLock } from './lib/wakelock.js'
import { startFlow } from './sheets.jsx'
import Icon from './components/Icon.jsx'
import TabBar from './components/TabBar.jsx'
@@ -46,6 +47,8 @@ function Shell() {
useEffect(() => { document.documentElement.lang = S.lang || 'en' }, [langV, S.lang])
// every tab/route change starts at the top of the page
useEffect(() => { window.scrollTo(0, 0) }, [loc.pathname])
// bound to the workout, not to the route — checking Stats mid-session keeps the screen on
useWakeLock(!!S.active && S.keepAwake !== false)
const authed = user || isGuest
if (!ready && !authed) return (
+14 -5
View File
@@ -34,12 +34,21 @@ export default function RestTimer() {
<Button size="sm" variant="primary" icon="check" onClick={finishWorkEarly}>{t('Done')}</Button>
</div>
)
// Three controls plus the clock don't fit one line on a phone — at 360px the bar is left
// with about 30px and stops saying anything. So the rest variant stacks: clock and bar
// read at a glance, controls get their own row. −15 and +15 sit together in number-line
// order; Skip is pushed to the far edge, away from the button you tap to buy more time.
return (
<div id="timer">
<div className="t">{clock(timer.left)}</div>
<div className="bar"><i style={{ width: pct + '%' }} /></div>
<Button size="sm" icon="plus" onClick={() => addRest(15)}>15s</Button>
<Button size="sm" variant="primary" onClick={stopRest}>{t('Skip')}</Button>
<div id="timer" className="rest">
<div className="head">
<div className="t">{clock(timer.left)}</div>
<div className="bar"><i style={{ width: pct + '%' }} /></div>
</div>
<div className="acts">
<Button size="sm" icon="minus" onClick={() => addRest(-15)}>15s</Button>
<Button size="sm" icon="plus" onClick={() => addRest(15)}>15s</Button>
<Button size="sm" variant="primary" className="skip" onClick={stopRest}>{t('Skip')}</Button>
</div>
</div>
)
}
+6 -3
View File
@@ -21,15 +21,18 @@ import Icon from './Icon.jsx'
// Numeric input accepting "," as decimal separator — iOS decimal keypads in many
// locales only offer a comma, and type="number" reports "" for it (value snaps to
// 0). Keeps a local string draft while focused so partial input like "33," survives.
export function NumberField({ value, onChange, decimal = true, className = '', ...rest }) {
// `nullable` is for fields where "nothing entered" and 0 mean different things (RIR: a
// logged 0 is a set taken to failure). Those clear back to null instead of snapping to 0.
export function NumberField({ value, onChange, decimal = true, nullable = false, className = '', ...rest }) {
const [draft, setDraft] = useState(null)
const committed = useRef(null)
if (draft !== null && committed.current !== value) { setDraft(null); committed.current = null }
// null and undefined are the same "empty" here — a nullable field's key is dropped once cleared.
if (draft !== null && (committed.current ?? null) !== (value ?? null)) { setDraft(null); committed.current = null }
const commit = raw => {
let s = raw.replace(/,/g, '.').replace(/[^0-9.]/g, '')
const i = s.indexOf('.')
if (i !== -1) s = decimal ? s.slice(0, i + 1) + s.slice(i + 1).replace(/\./g, '') : s.slice(0, i)
const n = s === '' || s === '.' ? 0 : Math.max(0, parseFloat(s))
const n = s === '' || s === '.' ? (nullable ? null : 0) : Math.max(0, parseFloat(s))
committed.current = n
setDraft(s)
onChange(n)
+66 -3
View File
@@ -165,8 +165,9 @@ button,.chip,.tile,.item,.wday,.cal-d,.swatch,.hm-c,.lrow,.seg button,.stp butto
padding:calc(var(--sat) + 8px) var(--pad) calc(128px + var(--sab));
max-width:560px;margin:0 auto;
}
/* while the rest timer floats above the tab bar, keep its height scrollable-past */
body.resting #app{padding-bottom:calc(206px + var(--sab))}
/* while the rest timer floats above the tab bar, keep its height scrollable-past
(the rest variant is two rows tall — ~44px more than the single-row work timer) */
body.resting #app{padding-bottom:calc(250px + var(--sab))}
@keyframes viewfade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
#app.vfade{animation:viewfade var(--med) var(--ease)}
@@ -236,6 +237,15 @@ h4.sec{
.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)}
/* 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
hit area back under the row's own 12px gap instead of adding to it. */
.helpbtn{
color:var(--label-3);font-size:16px;background:none;line-height:0;flex:none;
margin:-11px -2px -11px -4px;padding:11px 4px;
}
.helpbtn:active{color:var(--label)}
/* -------------------------------------------------------------- buttons -- */
.btn{
@@ -539,6 +549,7 @@ h4.sec{
.sethead .n-sp{width:24px;flex:none}
.sethead .w-sp{flex:1.4;text-align:center}
.sethead .r-sp{flex:1;text-align:center}
.sethead .eff-sp{text-align:center}
.sethead .ck-sp{width:30px;flex:none}
.setrow{display:flex;align-items:center;gap:8px;padding:7px 0;position:relative}
.setrow+.setrow::before{
@@ -551,7 +562,20 @@ h4.sec{
}
.setrow .stp.w{flex:1.4;min-width:0}
.setrow .stp.r{flex:1;min-width:0}
.setrow .stp.eff{flex:1.1;min-width:0}
.setrow .stp button{width:32px;height:40px}
/* a 3rd stepper (RIR) needs narrower buttons and a tighter row gap to fit next to weight+reps
on narrow phones, same technique as the exercise-config sheet's three-steppers-in-a-row
(.cfgrow below) — RIR's own value is short ("1.5") so its buttons shrink the most, weight/reps
just enough to make room since their values ("82.5", "12") need more of what's left.
The header shares the numbers so its labels stay centred over the steppers they name. */
.setrow.eff3,.sethead.eff3{gap:6px}
.setrow.eff3 .stp.w,.sethead.eff3 .w-sp{flex:1.2}
.setrow.eff3 .stp.r,.sethead.eff3 .r-sp{flex:1}
.setrow.eff3 .stp.eff,.sethead.eff3 .eff-sp{flex:.85}
.setrow.eff3 .stp button{width:23px}
.setrow.eff3 .stp.eff button{width:20px}
.setrow.eff3 .stp .num{font-size:14px}
.setrow.done .n{background:var(--acc);color:var(--on-acc)}
.setrow.done{opacity:.45}
/* why the next target is what it is (issue #17) */
@@ -580,7 +604,9 @@ h4.sec{
/* --- rest timer --- */
#timer{
position:fixed;left:12px;right:12px;bottom:calc(88px + var(--sab));z-index:60;
background:color-mix(in srgb,var(--surface) 82%,transparent);
/* nearly opaque: the set rows underneath were reading through the old 82% and made the
clock hard to pick out mid-set. The blur stays, so it still sits above the page. */
background:color-mix(in srgb,var(--surface) 97%,transparent);
backdrop-filter:saturate(180%) blur(24px);-webkit-backdrop-filter:saturate(180%) blur(24px);
border-radius:var(--r-lg);padding:12px 14px;
display:flex;align-items:center;gap:12px;
@@ -591,6 +617,14 @@ h4.sec{
#timer .t{font-size:26px;font-weight:600;letter-spacing:-.026em;font-variant-numeric:tabular-nums;min-width:66px}
#timer .bar{flex:1;height:4px;background:var(--surface-3);border-radius:99px;overflow:hidden}
#timer .bar i{display:block;height:100%;background:var(--acc);transition:width 1s linear}
/* rest variant: −15/+15/Skip and the clock won't share one line on a phone, so the clock and
bar take the top row and the controls take their own. The work timer keeps a single row —
it only ever has two buttons. */
#timer.rest{flex-direction:column;align-items:stretch;gap:10px}
#timer.rest .head{display:flex;align-items:center;gap:12px}
#timer.rest .acts{display:flex;align-items:center;gap:8px}
#timer.rest .acts .btn{padding-top:11px;padding-bottom:11px} /* sweaty hands, mid-set */
#timer.rest .acts .skip{margin-left:auto;min-width:84px}
/* work timer (issue #16): the same bar doing the opposite job — outlined and tinted so a
glance tells "you are holding this" apart from "you are recovering". */
#timer.working{border:var(--hair) solid var(--acc)}
@@ -630,6 +664,32 @@ h4.sec{
:root[data-theme="light"] .center{background:#fff}
@keyframes pop{from{transform:translate(-50%,-50%) scale(.94);opacity:0}to{transform:translate(-50%,-50%) scale(1);opacity:1}}
/* --- RIR/RPE conversion table (effort help sheet) ---
The two scales only click when you see them side by side, so the numbers get fixed-width
tabular columns you can read straight down, and the words take whatever is left. Built out
of the same grouped-list parts as the rest of the app (surface fill, inset hairlines) rather
than a real <table>, so it inherits the card look and wraps properly on a narrow phone. */
.efftbl{background:var(--surface);border-radius:var(--r-lg);overflow:hidden;margin:14px 0 12px}
.efftbl .r{display:flex;align-items:center;gap:10px;padding:10px 14px;position:relative}
.efftbl .r+.r::before{
content:'';position:absolute;left:14px;right:0;top:0;height:var(--hair);background:var(--sep);
}
.efftbl .n{
width:36px;flex:none;text-align:center;font-size:17px;font-weight:600;
letter-spacing:-.02em;font-variant-numeric:tabular-nums;
}
.efftbl .f{flex:1;min-width:0;font-size:15px;color:var(--label-2);line-height:1.3}
/* the header names the columns without competing with them */
.efftbl .hd{background:var(--surface-2);padding-top:8px;padding-bottom:8px}
.efftbl .hd .n,.efftbl .hd .f{
font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;
color:var(--label-3);
}
/* the row a working set usually lands on — the anchor the others are read against */
.efftbl .r.on{background:var(--acc-soft)}
.efftbl .r.on .n{color:var(--acc)}
.efftbl .r.on .f{color:var(--label)}
/* --- glyph picker (replaces the emoji grid) --- */
.glyph-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:9px}
.glyph-cell{
@@ -844,6 +904,9 @@ h4.sec{
.sheet{left:50%;right:auto;margin-left:-320px;width:640px;border-radius:var(--r-xl) var(--r-xl) 0 0}
.center{width:340px}
#timer{left:50%;right:auto;margin-left:-260px;width:520px;bottom:112px}
/* 520px fits the clock, the bar and all three controls on one line again */
#timer.rest{flex-direction:row;align-items:center;gap:14px}
#timer.rest .head{flex:1;min-width:0}
.exmedia img{height:380px}
.hm-wrap{display:flex;flex-direction:column;align-items:center}
}
+44 -1
View File
@@ -23,13 +23,56 @@ export function fmtSec(sec) {
return Math.floor(n / 60) + ':' + String(n % 60).padStart(2, '0')
}
// How hard a set felt, if the profile logs it at all. Two scales for the same thing, kept in
// their own fields: RIR counts the reps still in the tank, RPE reads the same effort off a
// 10-point scale from the top (RPE 8 ≈ RIR 2). A set logged on one scale is never silently
// rewritten as the other — switching the setting changes what new sets ask for, nothing else.
// `min`..`max` is the range the stepper walks. RIR bottoms out at 0 (a set taken to failure);
// RPE bottoms out at 6, since the scale is only meaningful for working sets and anything
// lighter is a warm-up nobody rates.
export const EFFORT = {
rir: { f: 'rir', hd: 'RIR', step: 0.5, min: 0, max: 10 },
rpe: { f: 'rpe', hd: 'RPE', step: 0.5, min: 6, max: 10 }
}
// One tap of an effort stepper. Empty is not 0 — an unlogged effort must not become "went to
// failure" from one stray tap — so − on an empty cell leaves it empty, and + starts at the
// bottom of the scale and walks up from there in even steps. Stepping back off the bottom
// clears the cell again, so a mistap is undoable. null means "nothing logged"; the caller
// stores that by dropping the key rather than writing a null.
export function stepEffort(kind, cur, dir) {
const e = EFFORT[kind]
if (!e) return cur ?? null
if (cur == null) return dir < 0 ? null : e.min
const n = Math.round((cur + dir * e.step) * 100) / 100
if (dir < 0 && n < e.min) return null
// only the ceiling is enforced on the way up: a value typed below the floor (nothing stops
// someone entering RPE 3) still steps in even increments instead of snapping to the floor.
return dir > 0 ? Math.min(e.max, n) : Math.max(e.min, n)
}
// A typed effort is capped but not floored — clamping up while someone types "10" would turn
// the first keystroke into the floor and fight the input.
export const capEffort = (kind, v) =>
(v == null || !EFFORT[kind] ? v : Math.min(EFFORT[kind].max, v))
// Which scale a profile logs. `showRir` is the boolean this replaced and is only consulted
// when the profile has no answer of its own — an explicit 'none' has to win over it, or a
// backup or another device that still carries the old flag would switch the column back on.
export const effortOf = S => {
const e = S && S.effort
return e === 'none' || EFFORT[e] ? e : (S && S.showRir ? 'rir' : 'none')
}
// The "(RIR 2)" / "(RPE 8)" tail on a set summary, empty when nothing was logged.
const effortTail = s => {
const k = s.rir != null ? 'rir' : s.rpe != null ? 'rpe' : null
return k ? ` (${EFFORT[k].hd} ${fmtNum(s[k])})` : ''
}
// One-line summary of a logged set. `cfg` carries the mode when the caller has it (a routine
// entry or a workout entry); passing an id alone keeps the old body-part behaviour.
export function setLabel(id, s, cfg) {
const mode = modeOf(cfg || { id })
if (mode === 'cardio') return `${s.min || 0} min @ ${fmtNum(s.speed || 0)} km/h`
if (mode === 'time') return fmtSec(s.sec) + (s.w > 0 ? ` · ${fmtNum(s.w)}` : '')
return `${fmtNum(s.w || 0)}×${s.r || 0}`
return `${fmtNum(s.w || 0)}×${s.r || 0}` + effortTail(s)
}
// Default config for a freshly added exercise.
export function defaultConfig(id, mode) {
+185 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume } from './history.js'
import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort } from './history.js'
import { EXDB } from './exercises.js'
// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.
@@ -63,6 +63,190 @@ describe('setLabel', () => {
expect(setLabel(LIFT, { w: 0, r: 0 })).toBe('0×0')
expect(setLabel(CARDIO, {})).toBe('0 min @ 0 km/h')
})
it('appends RIR when present, including a valid 0', () => {
expect(setLabel(LIFT, { w: 60, r: 10, rir: 2 })).toBe('60×10 (RIR 2)')
expect(setLabel(LIFT, { w: 60, r: 10, rir: 1.5 })).toBe('60×10 (RIR 1.5)')
expect(setLabel(LIFT, { w: 60, r: 10, rir: 0 })).toBe('60×10 (RIR 0)')
})
it('says nothing about RIR on a set that never logged one', () => {
expect(setLabel(LIFT, { w: 60, r: 10 })).toBe('60×10')
// cleared in the UI: the key is dropped, but a null must read the same as absent
expect(setLabel(LIFT, { w: 60, r: 10, rir: null })).toBe('60×10')
})
it('appends RPE for a set logged on that scale', () => {
expect(setLabel(LIFT, { w: 60, r: 10, rpe: 8 })).toBe('60×10 (RPE 8)')
expect(setLabel(LIFT, { w: 60, r: 10, rpe: 9.5 })).toBe('60×10 (RPE 9.5)')
expect(setLabel(LIFT, { w: 60, r: 10, rpe: null })).toBe('60×10')
})
it('keeps each set on the scale it was logged with', () => {
// switching the setting must not rewrite history: an old RIR set still reads as RIR
expect(setLabel(LIFT, { w: 60, r: 10, rir: 2 })).toBe('60×10 (RIR 2)')
// and a set that somehow carries both is described once, by the one it was logged with
expect(setLabel(LIFT, { w: 60, r: 10, rir: 2, rpe: 8 })).toBe('60×10 (RIR 2)')
})
})
describe('effortOf', () => {
it('reads the scale a profile logs', () => {
expect(effortOf({ effort: 'rpe' })).toBe('rpe')
expect(effortOf({ effort: 'rir' })).toBe('rir')
expect(effortOf({ effort: 'none' })).toBe('none')
expect(effortOf({})).toBe('none')
})
it('keeps the column for a profile still carrying the old showRir flag', () => {
expect(effortOf({ showRir: true })).toBe('rir')
// what a stored profile actually looks like once it is overlaid on DEF
expect(effortOf({ effort: null, showRir: true })).toBe('rir')
expect(effortOf({ effort: null })).toBe('none')
expect(effortOf({ showRir: false })).toBe('none')
// once the new setting is chosen it wins, whatever the old flag said
expect(effortOf({ showRir: true, effort: 'rpe' })).toBe('rpe')
expect(effortOf({ showRir: true, effort: 'none' })).toBe('none')
})
// The store cannot be imported here (it reaches for `navigator` at module load), so the
// overlay it performs is reproduced literally: stored profile spread over the defaults.
// DEF.effort is null precisely so this lands on the showRir fallback rather than on 'none'.
const overlay = stored => ({ unit: 'kg', effort: null, ...stored })
it('survives the overlay every load path performs', () => {
// upgrading with the column on: local state, a server pull and a restored backup all
// arrive as a stored object spread over the defaults, and all must keep the column
expect(effortOf(overlay({ showRir: true }))).toBe('rir')
expect(effortOf(overlay({ showRir: false }))).toBe('none')
// a profile predating the RIR feature entirely
expect(effortOf(overlay({}))).toBe('none')
// and one written by this version
expect(effortOf(overlay({ effort: 'rpe' }))).toBe('rpe')
// an old backup restored over a profile that had already chosen: the file wins, because
// an import replaces state wholesale rather than merging
expect(effortOf(overlay({ showRir: true, effort: undefined }))).toBe('rir')
})
it('is not fooled by a junk value', () => {
expect(effortOf({ effort: 'rpe10' })).toBe('none')
expect(effortOf({ effort: 'RIR' })).toBe('none')
expect(effortOf({ effort: 'f' })).toBe('none')
expect(effortOf(null)).toBe('none')
expect(effortOf(undefined)).toBe('none')
// a junk value with the old flag still set falls back rather than showing nothing
expect(effortOf({ effort: 'nope', showRir: true })).toBe('rir')
})
})
describe('stepEffort', () => {
it('starts at the bottom of the scale and walks up', () => {
// the first + on an empty cell lands on the lowest value, not on some "typical" middle:
// the stepper counts up from the floor the way every other stepper in the app does
expect(stepEffort('rir', null, 1)).toBe(0)
expect(stepEffort('rpe', null, 1)).toBe(6)
// and then in even steps
expect(stepEffort('rir', 0, 1)).toBe(0.5)
expect(stepEffort('rir', 0.5, 1)).toBe(1)
expect(stepEffort('rpe', 6, 1)).toBe(6.5)
})
it('leaves an untouched cell unlogged when stepped down', () => {
// one stray − on a fresh row must not stamp "(RIR 0)" — went to failure — on the set
expect(stepEffort('rir', null, -1)).toBe(null)
expect(stepEffort('rpe', null, -1)).toBe(null)
expect(stepEffort('rir', undefined, -1)).toBe(null)
})
it('clears the cell again when stepped back off the floor', () => {
// so a mistap is undoable rather than sticking at the floor for good
expect(stepEffort('rir', 0, -1)).toBe(null)
expect(stepEffort('rpe', 6, -1)).toBe(null)
// but a step that stays inside the scale is an ordinary step
expect(stepEffort('rir', 0.5, -1)).toBe(0)
expect(stepEffort('rpe', 6.5, -1)).toBe(6)
})
it('stops at the top of the scale', () => {
expect(stepEffort('rir', 9.5, 1)).toBe(10)
expect(stepEffort('rir', 10, 1)).toBe(10)
expect(stepEffort('rpe', 10, 1)).toBe(10)
})
it('keeps halves clean instead of drifting into float dust', () => {
let v = null
for (let i = 0; i < 6; i++) v = stepEffort('rpe', v, 1)
expect(v).toBe(8.5)
expect(stepEffort('rir', 0.1 + 0.2, 1)).toBe(0.8)
})
it('steps evenly from a value typed below the floor rather than snapping', () => {
// nothing stops someone typing RPE 3; the stepper must not jump them to 6 on one tap
expect(stepEffort('rpe', 3, 1)).toBe(3.5)
// stepping down out of the scale from there just clears it
expect(stepEffort('rpe', 3, -1)).toBe(null)
})
it('does nothing when the profile logs no effort at all', () => {
expect(stepEffort('none', null, 1)).toBe(null)
expect(stepEffort('none', 2, 1)).toBe(2)
expect(stepEffort(undefined, 2, -1)).toBe(2)
})
})
describe('capEffort', () => {
it('caps a typed value at the top of the scale', () => {
expect(capEffort('rir', 12)).toBe(10)
expect(capEffort('rpe', 99)).toBe(10)
expect(capEffort('rpe', 8)).toBe(8)
})
it('does not floor a typed value, so typing "10" survives its first keystroke', () => {
// clamping up would turn the "1" of "10" into 6 and fight the input
expect(capEffort('rpe', 1)).toBe(1)
expect(capEffort('rir', 0)).toBe(0)
})
it('passes an emptied field through untouched', () => {
expect(capEffort('rir', null)).toBe(null)
expect(capEffort('rpe', undefined)).toBe(undefined)
expect(capEffort('none', 12)).toBe(12)
})
})
// End-to-end on the data, not the pixels: what a set carries after the taps a real session
// makes, and what it reads back as afterwards.
describe('logging effort across a session', () => {
it('logs a working set on the chosen scale', () => {
// four + taps from empty on an RPE profile: 6, 6.5, 7, 7.5
let v = null
for (let i = 0; i < 4; i++) v = stepEffort('rpe', v, 1)
expect(setLabel(LIFT, { w: 80, r: 5, rpe: v })).toBe('80×5 (RPE 7.5)')
})
it('a set taken to failure is logged, not left blank', () => {
const v = stepEffort('rir', null, 1) // one + on an RIR profile
expect(v).toBe(0)
expect(setLabel(LIFT, { w: 100, r: 3, rir: v })).toBe('100×3 (RIR 0)')
})
it('switching the setting mid-history rewrites nothing', () => {
const old = { w: 60, r: 10, rir: 2 } // logged while the profile was on RIR
const fresh = { w: 60, r: 10, rpe: 8 } // logged after switching to RPE
expect(effortOf({ effort: 'rpe' })).toBe('rpe')
expect(setLabel(LIFT, old)).toBe('60×10 (RIR 2)')
expect(setLabel(LIFT, fresh)).toBe('60×10 (RPE 8)')
// turning the column off entirely hides the control but keeps both sets readable
expect(effortOf({ effort: 'none' })).toBe('none')
expect(setLabel(LIFT, old)).toBe('60×10 (RIR 2)')
})
it('never attaches effort to a mode that has no place for it', () => {
// cardio and timed sets have no third stepper, and their labels ignore the field even
// if an import or an old file put one there
expect(setLabel(CARDIO, { min: 20, speed: 9, rpe: 8 })).toBe('20 min @ 9 km/h')
expect(setLabel(LIFT, { sec: 45, rir: 2 }, { id: LIFT, mode: 'time' })).toBe('0:45')
})
})
describe('defaultConfig', () => {
+27 -2
View File
@@ -66,6 +66,10 @@ const COLUMNS = [
['weight', ['weight']],
['weightUnit', ['weight unit', 'unit']],
['reps', ['reps', 'repetitions']],
// Hevy and Strong both write an RPE per set. Nothing mainstream exports RIR, but read it
// when it is there rather than dropping the column on the floor.
['rpe', ['rpe', 'rpe rating']],
['rir', ['rir', 'reps in reserve']],
['distanceKm', ['distance km']],
['distance', ['distance']],
['distanceUnit', ['distance unit']],
@@ -226,6 +230,18 @@ const CATEGORY_BP = {
/* ----------------------------------------------------------- conversion --- */
const num = v => { const n = parseFloat(String(v ?? '').replace(',', '.')); return isFinite(n) ? n : 0 }
// An effort rating out of someone else's export. A blank cell means "not rated" and has to
// stay absent rather than becoming 0 — and 0 itself means opposite things on the two scales:
// RIR 0 is a set taken to failure and worth keeping, while RPE has no 0 (the scale is 1–10),
// so an app writing 0 for "nothing here" must not be read as an effort. Ratings above the
// scale are capped rather than dropped — the set was still rated, just written oddly.
const effortNum = (raw, zeroMeansRated) => {
const s = String(raw ?? '').trim()
if (!s) return null
const n = parseFloat(s.replace(',', '.'))
if (!isFinite(n) || n < 0 || (n === 0 && !zeroMeansRated)) return null
return Math.min(10, Math.round(n * 100) / 100)
}
const LB_TO_KG = 0.45359237
const p2 = n => String(n).padStart(2, '0')
const MON = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }
@@ -288,7 +304,7 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
const byDate = new Map()
const created = new Map()
const unmatched = new Set()
let sets = 0, skipped = 0, matched = 0, warmups = 0
let sets = 0, skipped = 0, matched = 0, warmups = 0, rpeSets = 0, rirSets = 0
let sawLb = false, sawKg = false
const cell = (r, f) => (map[f] === undefined ? '' : String(r[map[f]] ?? '').trim())
@@ -343,6 +359,15 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
const set = isCardio
? { min: mins || 0, speed: mins > 0 ? Math.round(km / (mins / 60) * 10) / 10 : 0, done: true }
: { w, r: reps || 0, done: true, u: rowUnit }
// Effort rides along only where the app can show it again: a weighted rep set. A treadmill
// row with an RPE would have nowhere to put it. A set is kept on one scale, so a file
// carrying both columns is read as RIR — the same precedence setLabel reads them back with.
if (!isCardio) {
const rir = effortNum(cell(r, 'rir'), true)
const rpe = rir == null ? effortNum(cell(r, 'rpe'), false) : null
if (rir != null) { set.rir = rir; rirSets++ }
else if (rpe != null) { set.rpe = rpe; rpeSets++ }
}
let day = byDate.get(when.d)
if (!day) {
@@ -401,7 +426,7 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
matched: new Set([...resolved.values()].filter(Boolean)).size,
matchedSets: matched,
created: created.size, unmatchedNames: [...unmatched].sort(),
sets, skipped, warmups, fileUnit, mixedUnits, converted,
sets, skipped, warmups, fileUnit, mixedUnits, converted, rpeSets, rirSets,
from: dates[0] || null, to: dates[dates.length - 1] || null,
}
}
+148
View File
@@ -0,0 +1,148 @@
import { describe, it, expect } from 'vitest'
import { parseWorkoutCSV } from './import-csv.js'
import { setLabel, effortOf } from './history.js'
// Headers as the real exports write them, trimmed to the columns that matter here.
const HEVY = 'title,start_time,end_time,exercise_title,set_index,set_type,weight_kg,reps,rpe'
const STRONG = 'Date,Workout Name,Exercise Name,Set Order,Weight,Reps,Seconds,RPE'
const FITNOTES = 'Date,Exercise,Category,Weight,Reps,Distance,Distance Unit,Time'
const rows = (head, ...lines) => parseWorkoutCSV([head, ...lines].join('\n'), { unit: 'kg' })
// every set of the first workout, in file order
const setsOf = p => p.workouts.flatMap(w => w.entries.flatMap(e => e.sets))
describe('importing effort from another app', () => {
it('reads the RPE Hevy writes per set', () => {
const p = rows(HEVY,
'Push,"12 Jan 2026, 18:00","12 Jan 2026, 19:00",Bench Press (Barbell),0,normal,60,10,8',
'Push,"12 Jan 2026, 18:00","12 Jan 2026, 19:00",Bench Press (Barbell),1,normal,60,8,9.5')
expect(p.error).toBeUndefined()
expect(setsOf(p).map(s => s.rpe)).toEqual([8, 9.5])
expect(p.rpeSets).toBe(2)
expect(p.rirSets).toBe(0)
})
it('reads the RPE Strong writes per set', () => {
const p = rows(STRONG,
'2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,7.5')
expect(setsOf(p)[0].rpe).toBe(7.5)
expect(p.rpeSets).toBe(1)
})
it('reads an RIR column when a file has one', () => {
const p = rows('Date,Exercise,Weight,Reps,RIR',
'2026-01-12,Bench Press,60,10,2',
'2026-01-12,Bench Press,60,6,0') // 0 RIR is a real rating: taken to failure
expect(setsOf(p).map(s => s.rir)).toEqual([2, 0])
expect(p.rirSets).toBe(2)
expect(setsOf(p).every(s => s.rpe === undefined)).toBe(true)
})
it('treats a blank rating as not rated, not as zero', () => {
const p = rows(HEVY,
'Push,"12 Jan 2026, 18:00",,Bench Press (Barbell),0,normal,60,10,',
'Push,"12 Jan 2026, 18:00",,Bench Press (Barbell),1,normal,60,10,8')
const s = setsOf(p)
expect('rpe' in s[0]).toBe(false) // the key is absent, so the set reads as unrated
expect(s[1].rpe).toBe(8)
expect(p.rpeSets).toBe(1)
})
it('does not read a written-out 0 as an RPE', () => {
// RPE runs 1–10, so a 0 in that column is an app saying "nothing here". Reading it as a
// rating would stamp an effort on every unrated set in the file.
const p = rows(STRONG, '2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,0')
expect('rpe' in setsOf(p)[0]).toBe(false)
expect(p.rpeSets).toBe(0)
})
it('caps a rating that overruns the scale instead of dropping the set', () => {
const p = rows(STRONG, '2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,12')
expect(setsOf(p)[0].rpe).toBe(10)
})
it('ignores junk in the rating column', () => {
const p = rows(STRONG,
'2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,hard',
'2026-01-12 18:00:00,Push,Bench Press (Barbell),2,60,10,0,-3')
expect(setsOf(p).every(s => !('rpe' in s))).toBe(true)
expect(p.rpeSets).toBe(0)
expect(p.sets).toBe(2) // the sets still import, just unrated
})
it('keeps one scale per set when a file carries both columns', () => {
const p = rows('Date,Exercise,Weight,Reps,RPE,RIR',
'2026-01-12,Bench Press,60,10,8,2')
const s = setsOf(p)[0]
expect(s.rir).toBe(2)
expect('rpe' in s).toBe(false)
// and it reads back on the scale it was stored with
expect(setLabel('0025', s)).toBe('60×10 (RIR 2)')
})
it('puts no effort on a cardio row', () => {
// a treadmill row has no third stepper to show it in
const p = rows('Date,Exercise,Distance,Distance Unit,Time,RPE',
'2026-01-12,Running,5,km,00:30:00,7')
const s = setsOf(p)[0]
expect(s.min).toBe(30)
expect('rpe' in s).toBe(false)
expect(p.rpeSets).toBe(0)
})
it('leaves a file without any rating column exactly as it was', () => {
const p = rows(FITNOTES, '2026-01-12,Bench Press,Chest,60,10,,,')
const s = setsOf(p)[0]
expect(s).toEqual({ w: 60, r: 10, done: true })
expect(p.rpeSets + p.rirSets).toBe(0)
})
it('carries the rating through the unit conversion', () => {
// lb -> kg rewrites the weight; the rating must survive that pass untouched
const p = parseWorkoutCSV([
'Date,Exercise,Weight,Weight Unit,Reps,RPE',
'2026-01-12,Bench Press,135,lbs,10,8',
].join('\n'), { unit: 'kg' })
const s = setsOf(p)[0]
expect(s.w).toBe(61.2)
expect(s.rpe).toBe(8)
expect('u' in s).toBe(false) // the row's unit marker never reaches the set
})
})
// The backup is the whole state serialised, so effort travels with it by construction. This
// pins that it stays true — a set losing its rating on a backup round trip would be silent.
describe('effort in a backup', () => {
// what Settings does on import: the file spread over the defaults. DEF cannot be imported
// here (the store reaches for `navigator` at load), so its shape is reproduced literally.
const DEF_LIKE = { unit: 'kg', workouts: [], routines: [], effort: null }
const roundTrip = S => Object.assign({ ...DEF_LIKE }, JSON.parse(JSON.stringify(S)))
it('exports and re-imports both scales and the setting', () => {
const S = {
unit: 'kg', effort: 'rpe', routines: [],
workouts: [{
d: '2026-01-12', entries: [{ id: '0025', sets: [
{ w: 60, r: 10, rpe: 8, done: true },
{ w: 60, r: 8, rir: 1, done: true },
{ w: 60, r: 12, done: true },
] }],
}],
}
const back = roundTrip(S)
expect(effortOf(back)).toBe('rpe')
const [a, b, c] = back.workouts[0].entries[0].sets
expect(a.rpe).toBe(8)
expect(b.rir).toBe(1)
expect('rpe' in c || 'rir' in c).toBe(false)
expect(setLabel('0025', a)).toBe('60×10 (RPE 8)')
expect(setLabel('0025', b)).toBe('60×8 (RIR 1)')
expect(setLabel('0025', c)).toBe('60×12')
})
it('restores a backup written before the setting existed', () => {
// the old flag survives the round trip and still decides the column
expect(effortOf(roundTrip({ showRir: true, workouts: [], routines: [] }))).toBe('rir')
expect(effortOf(roundTrip({ workouts: [], routines: [] }))).toBe('none')
})
})
+57
View File
@@ -0,0 +1,57 @@
// Screen Wake Lock — keeps the display on while a workout is running, so nobody has to
// unlock their phone between sets.
//
// The browser drops the lock on its own whenever the document stops being visible (tab
// switch, app backgrounded, screen locked by hand). A one-shot request therefore works
// exactly once and then silently dies, which is why `wanted` is kept as our own intent
// and the lock is re-acquired on every visibilitychange for as long as it holds.
import { useEffect } from 'react'
export const wakeLockSupported = () => 'wakeLock' in navigator
let sentinel = null // the live WakeLockSentinel, null when we hold nothing
let wanted = false // do we currently want the screen to stay on?
let pending = false // a request() is in flight — don't stack a second one
async function acquire() {
if (!wanted || sentinel || pending || !wakeLockSupported()) return
if (document.visibilityState !== 'visible') return // request() rejects on a hidden document
pending = true
try {
const s = await navigator.wakeLock.request('screen')
if (!wanted) { s.release().catch(() => {}); return } // released while we were awaiting
sentinel = s
s.addEventListener('release', () => { if (sentinel === s) sentinel = null })
} catch (e) {
// iOS refuses in Low Power Mode, and some browsers refuse on low battery. Nothing to
// do about it and nothing the user could act on — stay quiet and try again next time
// the document becomes visible.
sentinel = null
} finally { pending = false }
}
const onVisible = () => { if (document.visibilityState === 'visible') acquire() }
export function requestWakeLock() {
if (wanted) return
wanted = true
document.addEventListener('visibilitychange', onVisible)
acquire()
}
export function releaseWakeLock() {
wanted = false
document.removeEventListener('visibilitychange', onVisible)
const s = sentinel
sentinel = null
if (s) s.release().catch(() => {})
}
// Holds the lock for as long as `enabled` stays true.
export function useWakeLock(enabled) {
useEffect(() => {
if (!enabled) return
requestWakeLock()
return releaseWakeLock
}, [enabled])
}
+109
View File
@@ -0,0 +1,109 @@
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
// The whole point of the module is surviving what the browser does on its own: it drops the
// lock every time the document goes hidden. So the fake browser here has to do that too,
// otherwise the tests pass against a one-shot implementation that dies on the first tab switch.
let requests, released, live, listeners, reject
function fakeBrowser() {
requests = 0; released = 0; live = null; reject = false
listeners = new Set()
globalThis.document = {
visibilityState: 'visible',
addEventListener: (type, fn) => { if (type === 'visibilitychange') listeners.add(fn) },
removeEventListener: (type, fn) => { if (type === 'visibilitychange') listeners.delete(fn) },
}
globalThis.navigator = {
wakeLock: {
request: async () => {
requests++
if (reject) throw new Error('NotAllowedError') // iOS Low Power Mode
const subs = new Set()
const s = { addEventListener: (_, fn) => subs.add(fn), release: async () => { if (live === s) live = null; released++; subs.forEach(fn => fn()) } }
live = s
return s
},
},
}
}
const fire = () => listeners.forEach(fn => fn())
const settle = () => new Promise(r => setTimeout(r, 0))
const background = async () => { globalThis.document.visibilityState = 'hidden'; if (live) await live.release(); fire(); await settle() }
const foreground = async () => { globalThis.document.visibilityState = 'visible'; fire(); await settle() }
let requestWakeLock, releaseWakeLock, wakeLockSupported
beforeEach(async () => {
fakeBrowser()
vi.resetModules() // the module holds process-wide state; each test gets a fresh one
;({ requestWakeLock, releaseWakeLock, wakeLockSupported } = await import('./wakelock.js'))
})
afterEach(() => { delete globalThis.document; delete globalThis.navigator })
describe('wakeLockSupported', () => {
it('is false when the browser has no wakeLock at all', () => {
globalThis.navigator = {}
expect(wakeLockSupported()).toBe(false)
})
it('is true when it does', () => {
expect(wakeLockSupported()).toBe(true)
})
})
describe('requestWakeLock', () => {
it('takes a lock', async () => {
requestWakeLock(); await settle()
expect(requests).toBe(1)
expect(live).not.toBeNull()
})
it('does not stack a second lock while one is held', async () => {
requestWakeLock(); await settle()
requestWakeLock(); await settle()
expect(requests).toBe(1)
})
it('does not request one on a hidden document', async () => {
globalThis.document.visibilityState = 'hidden'
requestWakeLock(); await settle()
expect(requests).toBe(0)
})
it('re-acquires after the browser drops it on backgrounding', async () => {
requestWakeLock(); await settle()
await background()
expect(live).toBeNull()
await foreground()
expect(requests).toBe(2)
expect(live).not.toBeNull()
})
it('survives a rejection and retries when the document comes back', async () => {
reject = true
requestWakeLock(); await settle()
expect(live).toBeNull()
reject = false
await foreground()
expect(live).not.toBeNull()
})
})
describe('releaseWakeLock', () => {
it('releases the held lock and stops re-acquiring', async () => {
requestWakeLock(); await settle()
releaseWakeLock(); await settle()
expect(released).toBe(1)
expect(live).toBeNull()
await background(); await foreground()
expect(requests).toBe(1)
})
it('does not leak a lock when it lands while a request is in flight', async () => {
requestWakeLock() // no await — the request is still pending
releaseWakeLock()
await settle()
expect(live).toBeNull() // the arriving sentinel was released immediately
await foreground()
expect(requests).toBe(1) // and we did not start wanting it again
})
})
+21 -1
View File
@@ -256,7 +256,10 @@ export default {
'Dark': 'Dunkel',
'Light': 'Hell',
'Accent color': 'Akzentfarbe',
'Units & timer': 'Einheiten & Timer',
'General': 'Allgemein',
'During a workout': 'Während des Trainings',
'Keep screen awake': 'Bildschirm anlassen',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Der Bildschirm bleibt an, solange ein Workout läuft — so musst du zwischen den Sätzen nicht entsperren.',
'Weight unit': 'Gewichtseinheit',
'Rest timer': 'Pausen-Timer',
'Sounds': 'Töne',
@@ -511,4 +514,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Letztes Mal Wiederholungen verfehlt — dasselbe Gewicht noch einmal (noch {0} von {1}).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Körpergewicht — letztes Mal jede Wiederholung, also diesmal {0} anpeilen.',
'Bodyweight — same target again until every set is clean.': 'Körpergewicht — dieselbe Vorgabe, bis jeder Satz sauber sitzt.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} Sätze bringen ein {1} mit — schalte in den Einstellungen „Anstrengung pro Satz“ ein, um es zu sehen.',
'{0} sets bring an {1} with them.': '{0} Sätze bringen ein {1} mit.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Anstrengung pro Satz',
'What are RIR and RPE?': 'Was sind RIR und RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Wie schwer ein Satz war, direkt neben Gewicht und Wiederholungen. Zwei Skalen für dieselbe Einschätzung, von entgegengesetzten Enden gezählt.',
'How it felt': 'Wie es sich anfühlte',
'Nothing left — went to failure': 'Nichts mehr übrig — bis zum Muskelversagen',
'One more rep in the tank': 'Eine Wiederholung wäre noch gegangen',
'Two more reps': 'Zwei Wiederholungen übrig',
'Three more reps': 'Drei Wiederholungen übrig',
'Easy — warm-up territory': 'Locker — Aufwärmbereich',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR zählt die Wiederholungen, die du übrig lässt; RPE liest dieselbe Anstrengung auf einer 10er-Skala ab — also RPE ≈ 10 − RIR. Nimm die Skala, in der du ohnehin denkst.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'Die hervorgehobene Zeile ist der Bereich, in dem die meisten Arbeitssätze landen. Bereits protokollierte Sätze behalten ihre eigene Skala, und sonst liest den Wert nichts — Progression und geschätztes 1RM bleiben unberührt.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Oscuro',
'Light': 'Claro',
'Accent color': 'Color de acento',
'Units & timer': 'Unidades y temporizador',
'General': 'General',
'During a workout': 'Durante el entrenamiento',
'Keep screen awake': 'Mantener la pantalla encendida',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'La pantalla se mantiene encendida mientras hay un entrenamiento en curso, así no tienes que desbloquear el móvil entre series.',
'Weight unit': 'Unidad de peso',
'Rest timer': 'Temporizador de descanso',
'Sounds': 'Sonidos',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Fallaste repeticiones la última vez: el mismo peso otra vez (quedan {0} de {1}).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Peso corporal: la última vez todas las repeticiones, así que ve a por {0} esta vez.',
'Bodyweight — same target again until every set is clean.': 'Peso corporal: el mismo objetivo hasta que todas las series salgan limpias.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} series traen un {1} — activa «Esfuerzo por serie» en Ajustes para verlo.',
'{0} sets bring an {1} with them.': '{0} series traen un {1}.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Esfuerzo por serie',
'What are RIR and RPE?': '¿Qué son RIR y RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Lo dura que fue una serie, junto al peso y las repeticiones. Dos escalas para lo mismo, contadas desde extremos opuestos.',
'How it felt': 'Cómo se sintió',
'Nothing left — went to failure': 'Nada más — hasta el fallo',
'One more rep in the tank': 'Una repetición más en reserva',
'Two more reps': 'Dos repeticiones más',
'Three more reps': 'Tres repeticiones más',
'Easy — warm-up territory': 'Fácil — zona de calentamiento',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'El RIR cuenta las repeticiones que dejas; el RPE lee ese mismo esfuerzo en una escala de 10 — así que RPE ≈ 10 − RIR. Elige la que ya usas para pensar.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'La fila resaltada es donde cae la mayoría de las series efectivas. Las series ya registradas conservan su escala, y nada más lee el valor: la progresión y el 1RM estimado no cambian.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Sombre',
'Light': 'Clair',
'Accent color': "Couleur d'accent",
'Units & timer': 'Unités et minuteur',
'General': 'Général',
'During a workout': 'Pendant la séance',
'Keep screen awake': 'Garder l’écran allumé',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'L’écran reste allumé tant qu’une séance est en cours, pas besoin de déverrouiller ton téléphone entre les séries.',
'Weight unit': 'Unité de poids',
'Rest timer': 'Minuteur de repos',
'Sounds': 'Sons',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Répétitions manquées la dernière fois — même poids à nouveau ({0} sur {1} restants).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Poids du corps — toutes les répétitions la dernière fois, alors vise {0} cette fois.',
'Bodyweight — same target again until every set is clean.': 'Poids du corps — même objectif jusqu’à ce que chaque série soit propre.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} séries arrivent avec un {1} — active « Effort par série » dans les réglages pour le voir.',
'{0} sets bring an {1} with them.': '{0} séries arrivent avec un {1}.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Effort par série',
'What are RIR and RPE?': 'Que sont le RIR et le RPE ?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'La difficulté d’une série, à côté du poids et des répétitions. Deux échelles pour la même appréciation, comptées par les deux bouts.',
'How it felt': 'La sensation',
'Nothing left — went to failure': 'Plus rien — jusqu’à l’échec',
'One more rep in the tank': 'Encore une répétition en réserve',
'Two more reps': 'Encore deux répétitions',
'Three more reps': 'Encore trois répétitions',
'Easy — warm-up territory': 'Facile — zone d’échauffement',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'Le RIR compte les répétitions qu’il te restait ; le RPE lit le même effort sur une échelle de 10 — donc RPE ≈ 10 − RIR. Prends celle dans laquelle tu penses déjà.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'La ligne mise en avant est celle où tombent la plupart des séries de travail. Les séries déjà enregistrées gardent leur échelle, et rien d’autre ne lit la valeur — la progression et le 1RM estimé ne changent pas.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'डार्क',
'Light': 'लाइट',
'Accent color': 'एक्सेंट रंग',
'Units & timer': 'इकाइयाँ और टाइमर',
'General': 'सामान्य',
'During a workout': 'वर्कआउट के दौरान',
'Keep screen awake': 'स्क्रीन चालू रखें',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'वर्कआउट चलने के दौरान स्क्रीन चालू रहती है, ताकि सेट के बीच फ़ोन अनलॉक न करना पड़े।',
'Weight unit': 'वज़न की इकाई',
'Rest timer': 'आराम टाइमर',
'Sounds': 'ध्वनियाँ',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'पिछली बार रेप्स चूके — वही वज़न दोबारा ({1} में से {0} बाकी)।',
'Bodyweight — every rep last time, so go for {0} this time.': 'बॉडीवेट — पिछली बार सारे रेप्स, तो इस बार {0} का लक्ष्य रखें।',
'Bodyweight — same target again until every set is clean.': 'बॉडीवेट — जब तक हर सेट साफ़ न हो, वही लक्ष्य।',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} सेट अपने साथ {1} लाते हैं — इसे देखने के लिए सेटिंग्स में “प्रति सेट मेहनत” चालू करें।',
'{0} sets bring an {1} with them.': '{0} सेट अपने साथ {1} लाते हैं।',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'हर सेट की मेहनत',
'What are RIR and RPE?': 'RIR और RPE क्या हैं?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'सेट कितना भारी था, वज़न और रेप्स के बगल में दर्ज। एक ही आकलन के लिए दो पैमाने, उलटे सिरों से गिने हुए।',
'How it felt': 'कैसा लगा',
'Nothing left — went to failure': 'कुछ नहीं बचा — फेलियर तक',
'One more rep in the tank': 'एक रेप और बाकी था',
'Two more reps': 'दो रेप और बाकी',
'Three more reps': 'तीन रेप और बाकी',
'Easy — warm-up territory': 'आसान — वॉर्म-अप का दायरा',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR बचे हुए रेप्स गिनता है; RPE उसी मेहनत को 10 के पैमाने पर पढ़ता है — यानी RPE ≈ 10 − RIR. वही चुनें जिसमें आप पहले से सोचते हैं।',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'हाइलाइट की गई पंक्ति वह है जहाँ ज़्यादातर वर्किंग सेट आते हैं। पहले दर्ज किए सेट अपना पैमाना बनाए रखते हैं, और इस मान को और कुछ नहीं पढ़ता — प्रोग्रेशन और अनुमानित 1RM अछूते रहते हैं।',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Scuro',
'Light': 'Chiaro',
'Accent color': 'Colore accento',
'Units & timer': 'Unità e timer',
'General': 'Generale',
'During a workout': 'Durante l’allenamento',
'Keep screen awake': 'Mantieni lo schermo acceso',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Lo schermo resta acceso mentre un allenamento è in corso, così non devi sbloccare il telefono tra una serie e l’altra.',
'Weight unit': 'Unità di peso',
'Rest timer': 'Timer di riposo',
'Sounds': 'Suoni',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Ripetizioni mancate l’ultima volta: stesso peso ancora ({0} di {1} rimasti).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Corpo libero — l’ultima volta tutte le ripetizioni, quindi punta a {0} stavolta.',
'Bodyweight — same target again until every set is clean.': 'Corpo libero — stesso obiettivo finché ogni serie non è pulita.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} serie portano con sé un {1} — attiva «Sforzo per serie» nelle impostazioni per vederlo.',
'{0} sets bring an {1} with them.': '{0} serie portano con sé un {1}.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Sforzo per serie',
'What are RIR and RPE?': 'Che cosa sono RIR e RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Quanto è stata dura una serie, accanto a peso e ripetizioni. Due scale per lo stesso giudizio, contate dai lati opposti.',
'How it felt': 'Come è andata',
'Nothing left — went to failure': 'Niente più — fino a cedimento',
'One more rep in the tank': 'Un’altra ripetizione in canna',
'Two more reps': 'Altre due ripetizioni',
'Three more reps': 'Altre tre ripetizioni',
'Easy — warm-up territory': 'Facile — zona riscaldamento',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'Il RIR conta le ripetizioni che ti restavano; l’RPE legge lo stesso sforzo su una scala da 10 — quindi RPE ≈ 10 − RIR. Scegli quella con cui già ragioni.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'La riga evidenziata è dove finisce la maggior parte delle serie di lavoro. Le serie già registrate mantengono la loro scala, e nient’altro legge il valore: progressione e 1RM stimato non cambiano.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': '다크',
'Light': '라이트',
'Accent color': '강조 색상',
'Units & timer': '단위와 타이머',
'General': '일반',
'During a workout': '운동 중',
'Keep screen awake': '화면 켜두기',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': '운동이 진행되는 동안 화면이 켜져 있어 세트 사이에 잠금을 해제할 필요가 없습니다.',
'Weight unit': '무게 단위',
'Rest timer': '휴식 타이머',
'Sounds': '소리',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': '지난번 목표 횟수 미달 — 같은 무게로 한 번 더 ({1}회 중 {0}회 남음).',
'Bodyweight — every rep last time, so go for {0} this time.': '맨몸 운동 — 지난번 전 세트 완수, 이번엔 {0}회를 노려보세요.',
'Bodyweight — same target again until every set is clean.': '맨몸 운동 — 모든 세트가 깔끔해질 때까지 같은 목표로.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0}개 세트에 {1}이(가) 함께 들어 있습니다 — 설정에서 ‘세트당 강도’를 켜면 보입니다.',
'{0} sets bring an {1} with them.': '{0}개 세트에 {1}이(가) 함께 들어 있습니다.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': '세트당 강도',
'What are RIR and RPE?': 'RIR과 RPE란?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': '세트가 얼마나 힘들었는지를 무게·횟수 옆에 함께 기록합니다. 같은 판단을 양쪽 끝에서 세는 두 가지 척도입니다.',
'How it felt': '느낌',
'Nothing left — went to failure': '더는 못 함 — 실패 지점까지',
'One more rep in the tank': '한 개 더 남았음',
'Two more reps': '두 개 더 남았음',
'Three more reps': '세 개 더 남았음',
'Easy — warm-up territory': '가벼움 — 웜업 구간',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR은 남긴 횟수를 세고, RPE는 같은 노력을 10점 척도로 읽습니다 — 즉 RPE ≈ 10 − RIR. 평소에 쓰던 쪽을 고르세요.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': '강조된 줄은 대부분의 본세트가 들어가는 구간입니다. 이미 기록한 세트는 원래 척도를 그대로 유지하며, 이 값을 읽는 곳은 없습니다 — 프로그레션과 예상 1RM은 영향을 받지 않습니다.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Ciemny',
'Light': 'Jasny',
'Accent color': 'Kolor akcentu',
'Units & timer': 'Jednostki i minutnik',
'General': 'Ogólne',
'During a workout': 'Podczas treningu',
'Keep screen awake': 'Nie wygaszaj ekranu',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Ekran pozostaje włączony w trakcie treningu, więc nie musisz odblokowywać telefonu między seriami.',
'Weight unit': 'Jednostka wagi',
'Rest timer': 'Minutnik przerwy',
'Sounds': 'Dźwięki',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Ostatnio nieudane powtórzenia — ten sam ciężar jeszcze raz (zostało {0} z {1}).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Masa własna — ostatnio wszystkie powtórzenia, więc tym razem celuj w {0}.',
'Bodyweight — same target again until every set is clean.': 'Masa własna — ten sam cel, dopóki każda seria nie będzie czysta.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} serii ma zapisane {1} — włącz „Wysiłek w serii” w ustawieniach, aby to zobaczyć.',
'{0} sets bring an {1} with them.': '{0} serii ma zapisane {1}.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Wysiłek na serię',
'What are RIR and RPE?': 'Czym są RIR i RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Jak ciężka była seria, zapisane obok ciężaru i powtórzeń. Dwie skale tej samej oceny, liczone z przeciwnych stron.',
'How it felt': 'Jak to było',
'Nothing left — went to failure': 'Nic nie zostało — do upadku',
'One more rep in the tank': 'Jeszcze jedno powtórzenie w zapasie',
'Two more reps': 'Jeszcze dwa powtórzenia',
'Three more reps': 'Jeszcze trzy powtórzenia',
'Easy — warm-up territory': 'Lekko — poziom rozgrzewki',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR liczy powtórzenia, które zostały w zapasie; RPE odczytuje ten sam wysiłek w skali 10 — czyli RPE ≈ 10 − RIR. Wybierz tę, w której już myślisz.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'Wyróżniony wiersz to miejsce, w które trafia większość serii roboczych. Zapisane wcześniej serie zachowują swoją skalę, a wartości nic więcej nie czyta — progresja i szacowany 1RM pozostają bez zmian.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Escuro',
'Light': 'Claro',
'Accent color': 'Cor de destaque',
'Units & timer': 'Unidades e temporizador',
'General': 'Geral',
'During a workout': 'Durante o treino',
'Keep screen awake': 'Manter o ecrã ligado',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'O ecrã fica ligado enquanto há um treino a decorrer, para não teres de desbloquear o telemóvel entre séries.',
'Weight unit': 'Unidade de peso',
'Rest timer': 'Temporizador de descanso',
'Sounds': 'Sons',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Falhaste repetições da última vez — o mesmo peso outra vez (faltam {0} de {1}).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Peso do corpo — da última vez todas as repetições, por isso vai a {0} desta vez.',
'Bodyweight — same target again until every set is clean.': 'Peso do corpo — o mesmo objetivo até todas as séries saírem limpas.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} séries trazem um {1} — liga «Esforço por série» nas definições para o veres.',
'{0} sets bring an {1} with them.': '{0} séries trazem um {1}.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Esforço por série',
'What are RIR and RPE?': 'O que são RIR e RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'O quão dura foi uma série, ao lado do peso e das repetições. Duas escalas para o mesmo juízo, contadas de pontas opostas.',
'How it felt': 'Como se sentiu',
'Nothing left — went to failure': 'Não sobrou nada — até à falha',
'One more rep in the tank': 'Mais uma repetição de margem',
'Two more reps': 'Mais duas repetições',
'Three more reps': 'Mais três repetições',
'Easy — warm-up territory': 'Fácil — zona de aquecimento',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'O RIR conta as repetições que deixaste; o RPE lê o mesmo esforço numa escala de 10 — ou seja, RPE ≈ 10 − RIR. Escolhe aquela em que já pensas.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'A linha destacada é onde cai a maioria das séries de trabalho. As séries já registadas mantêm a sua escala, e mais nada lê o valor — a progressão e o 1RM estimado não mudam.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Тёмная',
'Light': 'Светлая',
'Accent color': 'Акцентный цвет',
'Units & timer': 'Единицы и таймер',
'General': 'Основное',
'During a workout': 'Во время тренировки',
'Keep screen awake': 'Не гасить экран',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Экран не гаснет, пока идёт тренировка, — не нужно разблокировать телефон между подходами.',
'Weight unit': 'Единица веса',
'Rest timer': 'Таймер отдыха',
'Sounds': 'Звуки',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'В прошлый раз повторения не дались — тот же вес ещё раз (осталось {0} из {1}).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Собственный вес — в прошлый раз все повторения, так что в этот раз целься на {0}.',
'Bodyweight — same target again until every set is clean.': 'Собственный вес — та же цель, пока все подходы не станут чистыми.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} подходов несут с собой {1} — включите «Усилие в подходе» в настройках, чтобы увидеть.',
'{0} sets bring an {1} with them.': '{0} подходов несут с собой {1}.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Усилие в подходе',
'What are RIR and RPE?': 'Что такое RIR и RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Насколько тяжёлым был подход — рядом с весом и повторениями. Две шкалы для одной и той же оценки, отсчитанные с разных концов.',
'How it felt': 'Ощущения',
'Nothing left — went to failure': 'Ничего не осталось — до отказа',
'One more rep in the tank': 'Ещё одно повторение в запасе',
'Two more reps': 'Ещё два повторения',
'Three more reps': 'Ещё три повторения',
'Easy — warm-up territory': 'Легко — разминочная зона',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR считает повторения, оставшиеся в запасе; RPE читает то же усилие по 10-балльной шкале — то есть RPE ≈ 10 − RIR. Выберите ту, в которой вы уже думаете.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'Выделенная строка — это диапазон, в который попадает большинство рабочих подходов. Уже записанные подходы сохраняют свою шкалу, и больше это значение нигде не используется: прогрессия и расчётный 1ПМ не меняются.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': 'Koyu',
'Light': 'Açık',
'Accent color': 'Vurgu rengi',
'Units & timer': 'Birimler ve sayaç',
'General': 'Genel',
'During a workout': 'Antrenman sırasında',
'Keep screen awake': 'Ekranı açık tut',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'Antrenman sürerken ekran açık kalır, böylece setler arasında telefonunu açmak zorunda kalmazsın.',
'Weight unit': 'Ağırlık birimi',
'Rest timer': 'Dinlenme sayacı',
'Sounds': 'Sesler',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': 'Geçen sefer tekrarlar eksikti — aynı ağırlık bir kez daha ({1} denemeden {0} kaldı).',
'Bodyweight — every rep last time, so go for {0} this time.': 'Vücut ağırlığı — geçen sefer bütün tekrarlar tamamdı, bu sefer {0} hedefle.',
'Bodyweight — same target again until every set is clean.': 'Vücut ağırlığı — her set temiz çıkana kadar aynı hedef.',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} set beraberinde bir {1} getiriyor — görmek için Ayarlar’da «Set başına efor» seçeneğini aç.',
'{0} sets bring an {1} with them.': '{0} set beraberinde bir {1} getiriyor.',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': 'Set başına zorluk',
'What are RIR and RPE?': 'RIR ve RPE nedir?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Bir setin ne kadar zor geçtiği, ağırlık ve tekrarların yanında. Aynı değerlendirme için iki ölçek, ters uçlardan sayılıyor.',
'How it felt': 'Nasıl hissettirdi',
'Nothing left — went to failure': 'Hiç kalmadı — tükenmeye kadar',
'One more rep in the tank': 'Bir tekrar daha vardı',
'Two more reps': 'İki tekrar daha vardı',
'Three more reps': 'Üç tekrar daha vardı',
'Easy — warm-up territory': 'Kolay — ısınma bölgesi',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR yedekte bıraktığın tekrarları sayar; RPE aynı eforu 10’luk ölçekte okur — yani RPE ≈ 10 − RIR. Zaten hangisiyle düşünüyorsan onu seç.',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': 'Vurgulanan satır, çalışma setlerinin çoğunun denk geldiği yerdir. Daha önce kaydettiğin setler kendi ölçeğini korur ve bu değeri başka hiçbir şey okumaz — ilerleme ve tahmini 1RM etkilenmez.',
}
+21 -1
View File
@@ -242,7 +242,10 @@ export default {
'Dark': '深色',
'Light': '浅色',
'Accent color': '强调色',
'Units & timer': '单位与计时',
'General': '通用',
'During a workout': '训练期间',
'Keep screen awake': '保持屏幕常亮',
'The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': '训练进行时屏幕保持常亮,组间无需再解锁手机。',
'Weight unit': '重量单位',
'Rest timer': '休息计时',
'Sounds': '声音',
@@ -493,4 +496,21 @@ export default {
'Missed reps last time — same weight again ({0} of {1} to go).': '上次次数未完成——再用同样的重量(还剩 {0}/{1} 次)。',
'Bodyweight — every rep last time, so go for {0} this time.': '徒手动作——上次全部完成,这次冲 {0} 次。',
'Bodyweight — same target again until every set is clean.': '徒手动作——保持同样的目标,直到每组都做干净。',
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} 组自带 {1}——在设置中打开“每组强度”即可看到。',
'{0} sets bring an {1} with them.': '{0} 组自带 {1}。',
'RIR': 'RIR',
'RPE': 'RPE',
'Effort per set': '每组强度',
'What are RIR and RPE?': 'RIR 和 RPE 是什么?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': '记录这一组有多吃力,就写在重量和次数旁边。同一个判断的两种标度,只是从相反的一端开始数。',
'How it felt': '感受',
'Nothing left — went to failure': '一点不剩——做到力竭',
'One more rep in the tank': '还能再做一次',
'Two more reps': '还能再做两次',
'Three more reps': '还能再做三次',
'Easy — warm-up territory': '轻松——热身区间',
'RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.': 'RIR 数的是你还留了几次;RPE 把同样的吃力程度换成 10 分制来读——所以 RPE ≈ 10 − RIR。选你习惯的那一种。',
'The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.': '高亮那一行是大多数正式组落在的位置。已经记录的组保留原来的标度,而且这个值不会被别处读取——进阶计划和预估 1RM 都不受影响。',
}
+9 -1
View File
@@ -3,7 +3,7 @@ import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { EXDB, EXIDX, BODYPARTS, isCardio, allExercises, equipmentOf } from './lib/exercises.js'
import { fmtDate, fmtNum, fmtVol, fmtDur, durPart, todayISO, uid, exCount, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'
import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf } from './lib/history.js'
import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf } from './lib/history.js'
import { beep, vibrate } from './lib/sound.js'
import { t, instrFor, getLang, INSTR_LANGS } from './lib/i18n.js'
import { nav } from './lib/nav.js'
@@ -181,6 +181,14 @@ function ImportSummary({ parsed, close }) {
{have > 0 && <div className="small dim" style={{ marginBottom: 10 }}>
{t('{0} days already have data here and will be left alone.', have)}
</div>}
{/* The file rated its sets. Say so: the column is off by default, so the ratings would
otherwise arrive invisibly and look like they had been dropped. */}
{!isBW && (parsed.rirSets + parsed.rpeSets) > 0 && <div className="small dim" style={{ marginBottom: 10 }}>
{t(effortOf(st) === 'none'
? '{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.'
: '{0} sets bring an {1} with them.',
parsed.rirSets || parsed.rpeSets, parsed.rirSets ? 'RIR' : 'RPE')}
</div>}
{!isBW && parsed.unmatchedNames.length > 0 && <>
<h4 className="sec">{t('Not in the library — added as your own exercises')}</h4>
<div className="mchips" style={{ marginBottom: 12 }}>
+6 -2
View File
@@ -7,11 +7,15 @@ import { MOBILE, nativeLoad, nativeSave, syncReminder } from '../lib/mobile.js'
const KEY = 'gym_state_v1'
export const DEF = {
unit: 'kg', restSec: 90, sound: true, lang: 'en',
unit: 'kg', restSec: 90, sound: true, keepAwake: true, lang: 'en',
theme: 'dark', accent: 'lime', body: 'male', targetW: null,
bodyweight: [], routines: [], week: {}, dayPlan: {},
exWeights: {}, workouts: [], active: null, customEx: [], gifSize: 'full',
reminder: { on: false, time: '08:00', tz: null }
// effort: which per-set effort scale is logged — 'none' | 'rir' | 'rpe'. null, not 'none', so
// that a profile which never chose (loaded state is overlaid on DEF, on every path: local,
// server pull, backup import) still falls back to the `showRir` boolean this replaced and
// keeps the column it had. See effortOf.
reminder: { on: false, time: '08:00', tz: null }, effort: null
}
const clone = o => JSON.parse(JSON.stringify(o))
+3
View File
@@ -63,6 +63,9 @@ export const useUI = create((set, get) => ({
const tm = get().timer
if (!tm) return
const left = tm.left + sec
// taking off more than is left means "I'm ready now" — same as skipping, and it keeps a
// negative duration out of both the progress bar and the server-side push schedule
if (left <= 0) { get().stopRest(); return }
set({ timer: { ...tm, left, total: tm.total + sec, endsAt: tm.endsAt + sec * 1000 } })
pushRestTimer(left)
},
+81 -23
View File
@@ -3,8 +3,10 @@ import { useNavigate } from 'react-router-dom'
import { useStore, DEF, hasData } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { ACCENTS, todayISO, localTZ } from '../lib/format.js'
import { effortOf } from '../lib/history.js'
import { webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
import { pushSupported, enablePush, disablePush, sendTestPush } from '../lib/push.js'
import { wakeLockSupported } from '../lib/wakelock.js'
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
import { DEMO, REPO } from '../lib/demo.js'
import { MOBILE, shareExport, syncReminder } from '../lib/mobile.js'
@@ -20,6 +22,7 @@ export default function Settings() {
const toast = useUI(s => s.toast)
const fileRef = useRef(null)
const importRef = useRef(null)
const wakeOK = wakeLockSupported()
const doExport = async () => {
const json = JSON.stringify(S, null, 2)
@@ -82,8 +85,8 @@ export default function Settings() {
</Section>
{!user && !DEMO && !MOBILE && <p className="sect-f" style={{ marginTop: -18, marginBottom: 22 }}>{t('Guest mode — data lives only in this browser.')}</p>}
{/* ---------- appearance ---------- */}
<Section title={t('Appearance')} footer={DEMO || MOBILE ? undefined : t('synced with your profile')}>
{/* ---------- general ---------- */}
<Section title={t('General')} footer={t('Note: switching units only changes the label — logged numbers are not converted.')}>
<SelectRow
icon="globe" iconTint="var(--blue)" title={t('Language')}
value={S.lang || 'en'} onChange={v => update(s => { s.lang = v })}
@@ -92,6 +95,42 @@ export default function Settings() {
subtitle: INSTR_LANGS.includes(k) ? null : t("Exercise instructions aren't available in this language yet — they stay in English."),
}))}
/>
<Row icon="scale" iconTint="var(--teal)" title={t('Weight unit')}>
<Segmented className="seg-inline"
options={[{ value: 'kg', label: 'kg' }, { value: 'lb', label: 'lb' }]}
value={S.unit} onChange={v => update(s => { s.unit = v })} />
</Row>
</Section>
{/* ---------- during a workout ---------- */}
<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' }))} />
{(wakeOK || !MOBILE) && (
<Row icon="sun" iconTint="var(--yellow)" title={t('Keep screen awake')}
subtitle={wakeOK ? null : t('Not supported in this browser.')}>
<Switch checked={wakeOK && S.keepAwake !== false} disabled={!wakeOK}
onChange={v => update(s => { s.keepAwake = v })} />
</Row>
)}
<Row icon="bell" iconTint="var(--pink)" title={t('Sounds')}>
<Switch checked={!!S.sound} onChange={v => update(s => { s.sound = v })} />
</Row>
{/* Two names for the same judgement, so the column asks in the scale you already think in.
The (i) sits before the control — you read it on the way to the choice, not after it. */}
<Row icon="target" iconTint="var(--purple)" title={t('Effort per set')}>
<button className="helpbtn" aria-label={t('What are RIR and RPE?')} onClick={effortHelpSheet}><Icon name="info" /></button>
<Segmented className="seg-inline"
options={[{ value: 'none', label: t('Off') }, { value: 'rir', label: t('RIR') }, { value: 'rpe', label: t('RPE') }]}
value={effortOf(S)} onChange={v => update(s => { s.effort = v; delete s.showRir })} />
</Row>
</Section>
{(user || MOBILE) && <NotificationsCard S={S} update={update} toast={toast} />}
{/* ---------- appearance ---------- */}
<Section title={t('Appearance')} footer={DEMO || MOBILE ? undefined : t('synced with your profile')}>
<Row icon="moon" iconTint="var(--indigo)" title={t('Theme')}>
<Segmented
className="seg-inline"
@@ -120,31 +159,14 @@ export default function Settings() {
</div>
</Section>
{/* ---------- units & timer ---------- */}
<Section title={t('Units & timer')} footer={t('Note: switching units only changes the label — logged numbers are not converted.')}>
<Row icon="scale" iconTint="var(--teal)" title={t('Weight unit')}>
<Segmented className="seg-inline"
options={[{ value: 'kg', label: 'kg' }, { value: 'lb', label: 'lb' }]}
value={S.unit} onChange={v => update(s => { s.unit = v })} />
</Row>
<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' }))} />
<Row icon="bell" iconTint="var(--pink)" title={t('Sounds')}>
<Switch checked={!!S.sound} onChange={v => update(s => { s.sound = v })} />
</Row>
</Section>
{(user || MOBILE) && <NotificationsCard S={S} update={update} toast={toast} />}
{/* ---------- data ---------- */}
{/* ---------- data: fill it, bring things over, back it up, wipe it ---------- */}
<Section title={t('Data')}>
<Row icon="download" iconTint="var(--blue)" title={t('Export backup (JSON)')} accessory="chevron" onClick={doExport} />
<Row icon="upload" iconTint="var(--blue)" title={t('Import backup')} accessory="chevron" onClick={() => fileRef.current.click()} />
<Row icon="sparkles" iconTint="var(--acc)" title={t('Load starter plan (PPL)')} accessory="chevron" onClick={loadStarterPlan} />
<Row icon="shuffle" iconTint="var(--teal)" title={t('Import from another app')}
subtitle={t('FitNotes, Strong, Hevy — or body weight from Apple Health')}
accessory="chevron" onClick={() => importRef.current.click()} />
<Row icon="sparkles" iconTint="var(--acc)" title={t('Load starter plan (PPL)')} accessory="chevron" onClick={loadStarterPlan} />
<Row icon="upload" iconTint="var(--blue)" title={t('Import backup')} accessory="chevron" onClick={() => fileRef.current.click()} />
<Row icon="download" iconTint="var(--blue)" title={t('Export backup (JSON)')} accessory="chevron" onClick={doExport} />
<Row icon="trash" iconTint="var(--red)" title={t('Reset everything')} danger onClick={() => confirmSheet({ title: t('Reset everything?'), message: t('Deletes your plan, workouts and body weight on this device. This cannot be undone.'), confirmText: t('Delete everything'), danger: true, onConfirm: () => { replaceState(JSON.parse(JSON.stringify(DEF)), true); nav('/home'); toast(t('All data reset')) } })} />
</Section>
<input ref={fileRef} type="file" accept=".json,application/json" style={{ display: 'none' }} onChange={doImport} />
@@ -166,6 +188,42 @@ export default function Settings() {
</div>
}
// The whole point is that the two scales are one judgement counted from opposite ends, and a
// paragraph is a bad way to say that — the conversion table shows it in one look. Reading down
// a column is the answer to "what do I put here", so the numbers get their own aligned columns.
const EFFORT_ROWS = [
['0', '10', 'Nothing left — went to failure'],
['1', '9', 'One more rep in the tank'],
['2', '8', 'Two more reps'],
['3', '7', 'Three more reps'],
['4+', '≤6', 'Easy — warm-up territory'],
]
// RIR 2 / RPE 8: the row a working set usually lands on — the anchor the others are read
// against. Not where the stepper starts; + walks up from the bottom of the scale.
const EFFORT_TYPICAL = 2
function effortHelpSheet() {
useUI.getState().openSheet(close => <>
<h3>{t('Effort per set')}</h3>
<div className="muted small" style={{ lineHeight: 1.5 }}>
{t('How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.')}
</div>
<div className="efftbl">
<div className="r hd"><span className="n">{t('RIR')}</span><span className="n">{t('RPE')}</span><span className="f">{t('How it felt')}</span></div>
{EFFORT_ROWS.map(([rir, rpe, feel], i) => (
<div key={rir} className={'r' + (i === EFFORT_TYPICAL ? ' on' : '')}>
<span className="n">{rir}</span><span className="n">{rpe}</span><span className="f">{t(feel)}</span>
</div>
))}
</div>
<div className="dim small" style={{ lineHeight: 1.5, display: 'grid', gap: 8 }}>
<div>{t('RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.')}</div>
<div>{t('The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.')}</div>
</div>
<div style={{ height: 8 }} />
</>)
}
function NotificationsCard({ S, update, toast }) {
if (MOBILE) return <MobileReminderCard S={S} update={update} toast={toast} />
return <PushCard S={S} update={update} toast={toast} />
+27 -7
View File
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { exOr } from '../lib/exercises.js'
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf } from '../lib/history.js'
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, EFFORT, effortOf, stepEffort, capEffort } from '../lib/history.js'
import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
import { beep, vibrate } from '../lib/sound.js'
import { t } from '../lib/i18n.js'
@@ -75,13 +75,27 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
const col2 = cardio ? { f: 'speed', step: 0.5, dec: true, hd: t('Speed (km/h)') }
: timed ? { f: 'w', step: 2.5, dec: true, hd: t('Weight ({0})', S.unit) }
: { f: 'r', step: 1, dec: false, hd: t('Reps') }
// Effort (RIR or RPE, whichever the profile logs) only makes sense for weighted rep sets,
// not cardio/timed holds, and is opt-in since it adds a third stepper to every row. `opt`
// because an unlogged effort is not the same as 0 — RIR 0 says the set went to failure.
const kind = effortOf(S)
const eff = EFFORT[kind]
const col3 = mode === 'reps' && eff ? { ...eff, eff: kind, dec: true, opt: true, hd: t(eff.hd) } : null
// The effort column walks its own scale — see stepEffort. Weight and reps step up from 0
// with no ceiling, as they always did.
const bump = (s, i, col, dir) => {
if (col.eff) return onField(i, col.f, stepEffort(col.eff, s[col.f], dir))
onField(i, col.f, Math.max(0, Math.round(((s[col.f] || 0) + dir * col.step) * 100) / 100))
}
// Uses the shared stepper markup so a set row picks up the same control styling
// as every other +/- field in the app.
const cell = (s, i, col, cls) => (
<div className={'stp ' + cls}>
<button aria-label="Decrease" onClick={() => onField(i, col.f, Math.max(0, Math.round(((s[col.f] || 0) - col.step) * 100) / 100))}><Icon name="minus" /></button>
<span className="val"><NumberField decimal={col.dec} value={s[col.f] ?? ''} onChange={v => onField(i, col.f, v)} /></span>
<button aria-label="Increase" onClick={() => onField(i, col.f, Math.max(0, Math.round(((s[col.f] || 0) + col.step) * 100) / 100))}><Icon name="plus" /></button>
<button aria-label="Decrease" onClick={() => bump(s, i, col, -1)}><Icon name="minus" /></button>
{/* a typed effort is capped — there is no RPE 12, and 12 reps in reserve is a warm-up */}
<span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''}
onChange={v => onField(i, col.f, col.eff ? capEffort(col.eff, v) : v)} /></span>
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
</div>
)
return <>
@@ -102,11 +116,13 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
<span>{t(...plan.why)}</span>
</div>}
<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>
<div className="sethead"><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>
{entry.sets.map((s, i) => <div key={i} className={'setrow' + (s.done ? ' done' : '')}>
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}
<div className={'sethead' + (col3 ? ' eff3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{col3 && <span className="eff-sp">{col3.hd}</span>}{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>
{entry.sets.map((s, i) => <div key={i} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' eff3' : '')}>
<div className="n">{i + 1}</div>
{cell(s, i, col1, 'w')}
{cell(s, i, col2, 'r')}
{col3 && cell(s, i, col3, 'eff')}
{/* A timed set is started, not typed: the timer counts the hold down and checks the
set off itself. The checkbox stays for anyone who timed it on their own watch. */}
{timed && <button className="setgo" aria-label={t('Start set')} disabled={s.done || !!working}
@@ -139,7 +155,11 @@ function ActiveWorkout() {
const done = setsDoneActive(A)
const mutEntry = (idx, fn) => update(s => { fn(s.active.entries[idx]) }, true)
const setField = (idx, i, field, v) => mutEntry(idx, e => { e.sets[i][field] = v })
// Clearing an optional field drops the key rather than storing null, so a set only carries
// what was actually logged — in the session, in history and in a backup.
const setField = (idx, i, field, v) => mutEntry(idx, e => {
if (v == null) delete e.sets[i][field]; else e.sets[i][field] = v
})
const modeAt = idx => modeOf({ ...(A.entries[idx].target || {}), id: A.entries[idx].id })
const addSet = idx => mutEntry(idx, e => {
const l = e.sets[e.sets.length - 1]
+4 -2
View File
@@ -75,7 +75,9 @@
<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 &amp; cardio</h3><p>Pair exercises back-to-back with one rest, 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>Bring your history</h3><p>Import from FitNotes, Strong, Hevy — or body weight straight out of an Apple Health export.</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>12 languages</h3><p>Full UI translation, exercise instructions in 10 languages, 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 &amp; dark themes, 8 accent colors, a hand-drawn icon set. Looks the same on every phone.</p></div>
@@ -124,7 +126,7 @@
<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.2 · 4.4 MB · Android 6.0+ · signed APK, sideload (your browser will ask — that's normal outside the Play Store)</p>
<p class="meta">v1.2.3 · 4.3 MB · Android 6.0+ · signed APK, sideload (your browser will ask — that's normal outside the Play Store)</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>