Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Effort per set: RIR or RPE, whichever scale you think in
Duarte Santos4e27461b7e34
diff --git a/frontend/src/index.css b/frontend/src/index.cssindex 5f740276a..2102abf70 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -236,6 +236,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) next to 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+ negative margin keeps it from making the row taller. Sits after the control so a long+ translation wrapping the title never pushes it around. */+.helpbtn{+ color:var(--label-3);font-size:16px;background:none;line-height:0;flex:none;+ margin:-11px -4px -11px 0;padding:11px 4px;+}+.helpbtn:active{color:var(--label)}/* -------------------------------------------------------------- buttons -- */.btn{@@ -539,7 +548,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 .rir-sp{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{@@ -552,20 +561,20 @@ h4.sec{}.setrow .stp.w{flex:1.4;min-width:0}.setrow .stp.r{flex:1;min-width:0}-.setrow .stp.rir{flex:1.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+repson 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/repsjust 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.rir3,.sethead.rir3{gap:6px}-.setrow.rir3 .stp.w,.sethead.rir3 .w-sp{flex:1.2}-.setrow.rir3 .stp.r,.sethead.rir3 .r-sp{flex:1}-.setrow.rir3 .stp.rir,.sethead.rir3 .rir-sp{flex:.85}-.setrow.rir3 .stp button{width:23px}-.setrow.rir3 .stp.rir button{width:20px}-.setrow.rir3 .stp .num{font-size:14px}+.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) */diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.jsindex 65e541e46..64789ff3d 100644--- a/frontend/src/lib/history.js+++ b/frontend/src/lib/history.js@@ -23,13 +23,35 @@ 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.+// `start` is where the first + tap lands: a typical working set, not the end of the scale.+export const EFFORT = {+ rir: { f: 'rir', hd: 'RIR', step: 0.5, max: 10, start: 2 },+ rpe: { f: 'rpe', hd: 'RPE', step: 0.5, max: 10, start: 8 }+}+// 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}` + (s.rir != null ? ` (RIR ${fmtNum(s.rir)})` : '')+ return `${fmtNum(s.w || 0)}×${s.r || 0}` + effortTail(s)}// Default config for a freshly added exercise.export function defaultConfig(id, mode) {diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.jsindex 77bda11d2..a577c4abd 100644--- a/frontend/src/lib/history.test.js+++ b/frontend/src/lib/history.test.js@@ -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 } from './history.js'import { EXDB } from './exercises.js'// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.@@ -75,6 +75,39 @@ describe('setLabel', () => {// cleared in the UI: the key is dropped, but a null must read the same as absentexpect(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')+ })})describe('defaultConfig', () => {diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex b22493525..a6f2ff0d3 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -512,7 +512,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'RIR-Spalte anzeigen',+ '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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'Wie schwer ein Satz war, direkt neben Gewicht und Wiederholungen. Sonst liest das nichts — Progression und geschätztes 1RM bleiben unberührt.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — Wiederholungen in Reserve: wie viele du noch geschafft hättest. 2 heißt zwei übrig, 0 heißt bis zum Muskelversagen.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — empfundene Anstrengung, dasselbe auf einer 10er-Skala: RPE 8 heißt zwei Wiederholungen übrig, RPE 10 heißt Muskelversagen.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Also RPE ≈ 10 − RIR. Nimm die Skala, in der du ohnehin denkst; bereits protokollierte Sätze behalten ihre eigene.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 93f8d6a0b..b3c697d5f 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -494,7 +494,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'Mostrar columna de 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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'Lo dura que fue una serie, junto al peso y las repeticiones. Nada más lo lee: tu progresión y el 1RM estimado no cambian.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — repeticiones en reserva: cuántas más habrías podido hacer. 2 significa dos de margen, 0 significa al fallo.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — esfuerzo percibido, lo mismo en una escala de 10: RPE 8 son dos repeticiones de margen, RPE 10 es el fallo.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Así que RPE ≈ 10 − RIR. Elige la escala en la que ya piensas; las series ya registradas conservan la suya.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex c4f59b733..9e77c8b28 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -494,7 +494,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'Afficher la colonne 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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'La difficulté d’une série, notée à côté du poids et des répétitions. Rien d’autre ne s’en sert — ta progression et le 1RM estimé restent inchangés.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — répétitions en réserve : combien tu aurais encore pu en faire. 2 = deux en réserve, 0 = jusqu’à l’échec.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — effort perçu, la même chose sur une échelle de 10 : RPE 8 = deux répétitions en réserve, RPE 10 = échec.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Donc RPE ≈ 10 − RIR. Choisis l’échelle dans laquelle tu penses déjà ; les séries déjà enregistrées gardent la leur.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 47e9e5e31..daae05121 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -494,7 +494,13 @@ export default {'Bodyweight — every rep last time, so go for {0} this time.': 'बॉडीवेट — पिछली बार सारे रेप्स, तो इस बार {0} का लक्ष्य रखें।','Bodyweight — same target again until every set is clean.': 'बॉडीवेट — जब तक हर सेट साफ़ न हो, वही लक्ष्य।',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'RIR कॉलम दिखाएं',+ 'RPE': 'RPE',+ 'Effort per set': 'हर सेट की मेहनत',+ 'What are RIR and RPE?': 'RIR और RPE क्या हैं?',+ 'How hard a set was, logged next to weight and reps. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'सेट कितना कठिन था, यह वज़न और रेप्स के साथ दर्ज होता है। इसे और कुछ नहीं पढ़ता — आपकी प्रोग्रेशन और अनुमानित 1RM वैसे ही रहते हैं।',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — रिज़र्व में रेप्स: आप और कितने रेप्स कर सकते थे। 2 यानी दो बाकी, 0 यानी पूरी थकान तक।',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — महसूस की गई मेहनत, वही बात 10 अंकों के पैमाने पर: RPE 8 यानी दो रेप्स बाकी, RPE 10 यानी पूरी थकान।',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'यानी RPE ≈ 10 − RIR। जिस पैमाने में आप पहले से सोचते हैं वही चुनें; पहले दर्ज सेट अपने पैमाने पर बने रहते हैं।',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 6ef1363bd..6142947e4 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -494,7 +494,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'Mostra colonna 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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'Quanto è stata dura una serie, accanto a peso e ripetizioni. Nient’altro lo legge: progressione e 1RM stimato non cambiano.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — ripetizioni di riserva: quante altre ne avresti fatte. 2 significa due di margine, 0 significa a cedimento.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — sforzo percepito, la stessa cosa su una scala da 10: RPE 8 sono due ripetizioni di margine, RPE 10 è il cedimento.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Quindi RPE ≈ 10 − RIR. Scegli la scala in cui già ragioni; le serie già registrate mantengono la loro.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 10f278b6d..d04904f04 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -494,7 +494,13 @@ export default {'Bodyweight — every rep last time, so go for {0} this time.': '맨몸 운동 — 지난번 전 세트 완수, 이번엔 {0}회를 노려보세요.','Bodyweight — same target again until every set is clean.': '맨몸 운동 — 모든 세트가 깔끔해질 때까지 같은 목표로.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'RIR 열 표시',+ 'RPE': 'RPE',+ 'Effort per set': '세트당 강도',+ 'What are RIR and RPE?': 'RIR과 RPE란?',+ 'How hard a set was, logged next to weight and reps. Nothing else reads it — your progression and estimated 1RM are unaffected.': '세트가 얼마나 힘들었는지를 무게·횟수 옆에 기록합니다. 다른 기능은 이 값을 쓰지 않아요 — 프로그레션과 예상 1RM은 그대로입니다.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — 남은 횟수: 몇 번 더 할 수 있었는지. 2는 두 번 남음, 0은 실패 지점까지 했다는 뜻입니다.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — 주관적 운동강도, 같은 개념을 10점 척도로: RPE 8은 두 번 남음, RPE 10은 실패 지점입니다.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': '즉 RPE ≈ 10 − RIR. 익숙한 쪽을 고르세요. 이미 기록한 세트는 원래 척도를 유지합니다.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex b5a5d030a..21e3f3479 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -494,7 +494,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'Pokaż kolumnę 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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'Jak ciężka była seria — zapisywane obok ciężaru i powtórzeń. Nic innego z tego nie korzysta: progresja i szacowany 1RM pozostają bez zmian.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — powtórzenia w zapasie: ile jeszcze dałoby się zrobić. 2 znaczy dwa w zapasie, 0 znaczy do upadku mięśniowego.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — odczuwany wysiłek, to samo w skali 10: RPE 8 to dwa powtórzenia w zapasie, RPE 10 to upadek mięśniowy.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Czyli RPE ≈ 10 − RIR. Wybierz skalę, w której już myślisz; zapisane serie zachowują swoją.',}diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 67f0a75bc..f81c8f1d7 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -494,7 +494,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'Mostrar coluna de 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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'O quão dura foi uma série, ao lado do peso e das repetições. Mais nada lê isto — a tua progressão e o 1RM estimado não mudam.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — repetições em reserva: quantas ainda conseguirias fazer. 2 significa duas de margem, 0 significa até à falha.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — esforço percebido, o mesmo numa escala de 10: RPE 8 são duas repetições de margem, RPE 10 é a falha.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Ou seja, RPE ≈ 10 − RIR. Escolhe a escala em que já pensas; as séries já registadas mantêm a sua.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 001291bba..0f0f0ecbf 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -494,7 +494,13 @@ export default {'Bodyweight — every rep last time, so go for {0} this time.': 'Собственный вес — в прошлый раз все повторения, так что в этот раз целься на {0}.','Bodyweight — same target again until every set is clean.': 'Собственный вес — та же цель, пока все подходы не станут чистыми.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'Показывать столбец RIR',+ 'RPE': 'RPE',+ 'Effort per set': 'Усилие в подходе',+ 'What are RIR and RPE?': 'Что такое RIR и RPE?',+ 'How hard a set was, logged next to weight and reps. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'Насколько тяжёлым был подход — рядом с весом и повторениями. Больше это нигде не используется: прогрессия и расчётный 1ПМ не меняются.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — повторения в запасе: сколько ещё могли бы сделать. 2 — два в запасе, 0 — до отказа.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — воспринимаемое усилие, то же самое по 10-балльной шкале: RPE 8 — два повторения в запасе, RPE 10 — отказ.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'То есть RPE ≈ 10 − RIR. Выберите шкалу, в которой вы уже думаете; уже записанные подходы сохраняют свою.',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex de87f7256..4d472c665 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -494,7 +494,13 @@ export default {'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.',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': 'RIR sütununu göster',+ '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. Nothing else reads it — your progression and estimated 1RM are unaffected.': 'Bir setin ne kadar zor geçtiği; ağırlık ve tekrarın yanına yazılır. Başka hiçbir yer bunu okumaz — ilerleme ve tahmini 1TM etkilenmez.',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR — yedekteki tekrar: kaç tekrar daha yapabilirdin. 2 iki tekrar kaldı, 0 tükenene kadar demek.',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE — algılanan zorluk, aynı şey 10’luk ölçekte: RPE 8 iki tekrar kaldı, RPE 10 tükenme demek.',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': 'Yani RPE ≈ 10 − RIR. Zaten hangisiyle düşünüyorsan onu seç; kayıtlı setler kendi ölçeğinde kalır.',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 8b1f28dba..3801ca0d8 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -494,7 +494,13 @@ export default {'Bodyweight — every rep last time, so go for {0} this time.': '徒手动作——上次全部完成,这次冲 {0} 次。','Bodyweight — same target again until every set is clean.': '徒手动作——保持同样的目标,直到每组都做干净。',- // --- RIR (reps in reserve) ---+ // --- effort per set (RIR / RPE) ---'RIR': 'RIR',- 'Show RIR column': '显示RIR列',+ 'RPE': 'RPE',+ 'Effort per set': '每组强度',+ 'What are RIR and RPE?': 'RIR 和 RPE 是什么?',+ 'How hard a set was, logged next to weight and reps. Nothing else reads it — your progression and estimated 1RM are unaffected.': '记录这一组有多吃力,就写在重量和次数旁边。其他功能不会读取它——进阶计划和预估 1RM 都不受影响。',+ 'RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.': 'RIR——储备次数:你还能再做几次。2 表示还剩两次,0 表示做到力竭。',+ 'RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.': 'RPE——自觉用力程度,同一件事换成 10 分制:RPE 8 表示还剩两次,RPE 10 表示力竭。',+ 'So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.': '所以 RPE ≈ 10 − RIR。选你习惯的那一种;已经记录的组保留原来的标度。',}diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.jsindex 9bdb253b2..232b8800f 100644--- a/frontend/src/store/useStore.js+++ b/frontend/src/store/useStore.js@@ -11,7 +11,11 @@ export const DEF = {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 }, showRir: false+ // 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))diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex 59fee80e6..ddc5ac307 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -3,6 +3,7 @@ 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 { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'@@ -133,8 +134,13 @@ export default function Settings() {<Row icon="bell" iconTint="var(--pink)" title={t('Sounds')}><Switch checked={!!S.sound} onChange={v => update(s => { s.sound = v })} /></Row>- <Row icon="target" iconTint="var(--purple)" title={t('Show RIR column')}>- <Switch checked={!!S.showRir} onChange={v => update(s => { s.showRir = v })} />+ {/* Two names for the same judgement, so the column asks in the scale you already think in.+ The (i) explains the difference rather than making the row title carry it. */}+ <Row icon="target" iconTint="var(--purple)" title={t('Effort per set')}>+ <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 })} />+ <button className="helpbtn" aria-label={t('What are RIR and RPE?')} onClick={effortHelpSheet}><Icon name="info" /></button></Row></Section>@@ -169,6 +175,21 @@ export default function Settings() {</div>}+// Short on purpose: the two scales measure the same thing from opposite ends, and that one+// sentence is what people actually come looking for.+function effortHelpSheet() {+ useUI.getState().openSheet(close => <>+ <h3>{t('Effort per set')}</h3>+ <div className="muted small" style={{ lineHeight: 1.55, display: 'grid', gap: 10 }}>+ <div>{t('How hard a set was, logged next to weight and reps. Nothing else reads it — your progression and estimated 1RM are unaffected.')}</div>+ <div>{t('RIR — reps in reserve: how many more reps you had in you. 2 means two left, 0 means you went to failure.')}</div>+ <div>{t('RPE — perceived exertion, the same effort read off a 10-point scale: RPE 8 means two reps left, RPE 10 means failure.')}</div>+ <div>{t('So RPE ≈ 10 − RIR. Pick the one you already think in; sets you have already logged keep their own scale.')}</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} />diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex 892deffe4..07a739a1f 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -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 } 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,24 +75,28 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemovconst 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') }- // RIR (reps in reserve) only makes sense for weighted rep sets, not cardio/timed holds,- // and is opt-in (Settings) since it adds a third stepper to every row. `opt` because an- // unlogged RIR is not the same as RIR 0 — 0 says the set went to failure.- const col3 = mode === 'reps' && S.showRir ? { f: 'rir', step: 0.5, dec: true, opt: true, hd: t('RIR') } : null- // Stepping an optional field that was never filled in stays empty rather than clamping to 0:- // otherwise one stray − on a fresh row stamps "(RIR 0)" on the set for good. Going down from- // 0.5 still reaches a real 0.+ // 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 eff = EFFORT[effortOf(S)]+ const col3 = mode === 'reps' && eff ? { ...eff, dec: true, opt: true, hd: t(eff.hd) } : null+ // Stepping an optional field that was never filled in must not clamp to 0: one stray − on a+ // fresh row would stamp "(RIR 0)" — to failure — on the set for good. − leaves it empty, and+ // the first + lands on a typical working set (RIR 2 / RPE 8) rather than the end of the scale.const bump = (s, i, col, dir) => {const cur = s[col.f]- if (col.opt && cur == null && dir < 0) return- onField(i, col.f, Math.max(0, Math.round(((cur || 0) + dir * col.step) * 100) / 100))+ if (col.opt && cur == null) return dir < 0 ? undefined : onField(i, col.f, col.start)+ const n = Math.round(((cur || 0) + dir * col.step) * 100) / 100+ onField(i, col.f, Math.min(col.max ?? Infinity, Math.max(0, n)))}// 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={() => bump(s, i, col, -1)}><Icon name="minus" /></button>- <span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''} onChange={v => onField(i, col.f, v)} /></span>+ {/* a typed value is capped too — RPE has no 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, v == null || col.max == null ? v : Math.min(col.max, v))} /></span><button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button></div>)@@ -114,13 +118,13 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov<span>{t(...plan.why)}</span></div>}<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>- {/* the header carries the same rir3 sizing as the rows, or the labels drift off their columns */}- <div className={'sethead' + (col3 ? ' rir3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{col3 && <span className="rir-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 ? ' rir3' : '')}>+ {/* 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, 'rir')}+ {col3 && cell(s, i, col3, 'eff')}{/* A timed set is started, not typed: the timer counts the hold down and checks theset 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}