Skip to content

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.

feat(workout): colour-coded RIR/RPE quick picker

Sebastian G5e42bd29d68b
diff --git a/frontend/src/index.css b/frontend/src/index.css
index ca0528eea..c9cbf4057 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -642,20 +642,65 @@ 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). The buttons stay 28px wide — anything narrower is a miss-prone target —
- so the room comes from the smaller glyphs and from the value fields giving up their padding.
- The header shares the numbers so its labels stay centred over the steppers they name. */
+/* The effort column is a single tap-to-pick button, not a stepper. It is a direct flex child
+ of the row (like the .stp cells), carrying its own column width via flex. `align-self` and
+ a fixed height stop the row from stretching it taller than the weight/reps cells; it is NOT
+ inside `.stp`, so the stepper's 32px fixed button width (which wrapped "RIR") never applies. */
+/* flex-basis:0 so the button's width comes from its flex share, not its text, and the column
+ never jumps between an empty "RIR" and a logged "2". The unrated state uses `.is-empty`, not
+ the generic `.empty` (which is a full-page empty-state with 44px padding — sharing that name
+ inflated the cell to ~90px). */
+.setrow .effcell,.sethead .eff-sp{flex:.8 1 0;min-width:0}
+.effcell{
+ box-sizing:border-box;height:44px;border-radius:10px;
+ background:var(--surface-2);border:1.5px solid transparent;
+ color:var(--label);font-size:15px;font-weight:600;letter-spacing:-.01em;
+ font-variant-numeric:tabular-nums;white-space:nowrap;line-height:1;
+ display:flex;align-items:center;justify-content:center;
+ transition:background var(--fast),transform var(--fast),border-color var(--fast);
+}
+.effcell:active{transform:scale(.94)}
+.effcell.is-empty{color:var(--label-2);font-weight:500;font-size:12px;letter-spacing:.02em}
+/* the effort cell needs less room now (one short value, no +/- buttons), so weight/reps keep
+ more of the row on narrow phones than they did when three steppers had to share it */
.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:28px;font-size:14px}
+.setrow.eff3 .stp.w,.sethead.eff3 .w-sp{flex:1.4}
+.setrow.eff3 .stp.r,.sethead.eff3 .r-sp{flex:1.1}
+.setrow.eff3 .effcell,.sethead.eff3 .eff-sp{flex:.7 1 0}
+.setrow.eff3 .stp.w button,.setrow.eff3 .stp.r button{width:26px}
.setrow.eff3 .stp .num{font-size:14px}
-.setrow.eff3 .stp .val{padding:0}
+/* effort quick picker sheet: colour-coded preset buttons, hardest (purple) first */
+.effpick{display:grid;grid-template-columns:repeat(2,1fr);gap:9px;margin-bottom:16px}
+.effpick-b{
+ display:flex;flex-direction:column;align-items:flex-start;gap:3px;
+ padding:12px 14px;border-radius:13px;text-align:left;
+ background:var(--surface);border:1.5px solid var(--sep-op);
+ border-left:4px solid var(--bc);
+ transition:background var(--fast),transform var(--fast),border-color var(--fast);
+}
+.effpick-b:active{transform:scale(.97)}
+.effpick-b.on{background:color-mix(in srgb,var(--bc) 16%,var(--surface));border-color:var(--bc)}
+.effpick-n{font-size:20px;font-weight:700;color:var(--bc);line-height:1;font-variant-numeric:tabular-nums}
+.effpick-f{font-size:12px;color:var(--label-2);line-height:1.25}
+/* the free field sits as a full-width row the same size as a preset button: its label on the
+ left, a large right-aligned input on the right, same padding and radius as .effpick-b */
+.effpick-free{
+ display:flex;align-items:center;justify-content:space-between;gap:12px;
+ padding:12px 14px;border-radius:13px;margin-top:2px;
+ background:var(--surface);border:1.5px solid var(--sep-op);
+}
+.effpick-free-l{font-size:14px;color:var(--label-2)}
+/* the `.num` base styling (transparent bg, no border) is scoped to `.stp .num`; this input is
+ not in a stepper, so it must set its own or the browser paints a native white field. */
+.effpick-free-in.num{
+ flex:none;width:90px;text-align:right;padding:0;
+ background:none;border:none;outline:none;
+ font-size:20px;font-weight:700;color:var(--label);
+ -moz-appearance:textfield;appearance:textfield;
+}
+.effpick-free-in.num::-webkit-inner-spin-button{display:none}
+.effpick-free-in.num::placeholder{color:var(--label-3);font-weight:600}
.setrow.done .n{background:var(--acc);color:var(--on-acc)}
.setrow.done{opacity:.45}
/* drop-set drops / rest-pause bursts riding on a work row, editable like the row itself
diff --git a/frontend/src/lib/effort.js b/frontend/src/lib/effort.js
index e6448dac5..9649f358a 100644
--- a/frontend/src/lib/effort.js
+++ b/frontend/src/lib/effort.js
@@ -132,3 +132,43 @@ export function effortHistogram(S, days) {
/** A set that counts as hard — the filter behind the muscle map's "hard sets" mode. */
export const isHardSet = s => { const r = rirOf(s); return r != null && r <= HARD_RIR }
+
+// ---------------------------------------------------------------- colour bands --
+//
+// A set's effort read as a colour, so a glance down a workout tells you how hard it ran
+// without reading every number. Bands are defined once, in RIR (the internal scale), and
+// apply unchanged whether the profile logs RIR or RPE — RPE 8 and RIR 2 are the same set and
+// get the same colour. The scale runs from "nothing left" (purple, past red — the far end,
+// not just "very hard") through to "easy, warm-up range" (green).
+//
+// The named buckets are also the quick-pick presets: one tap logs the middle of a band. They
+// are deliberately coarse where estimation is coarse — nobody reliably tells 5 RIR from 7, so
+// everything from 4 up shares one bucket — and fine near failure, where the difference between
+// 0, 0.5 and 1 actually changes the training. A typed value between presets still colours by
+// the band it falls in, so the flexibility of a free number is never lost.
+export const EFFORT_BANDS = [
+ { rir: 0, max: 0.25, color: 'var(--purple)', feel: 'Nothing left — went to failure' },
+ { rir: 0.5, max: 0.75, color: 'var(--red)', feel: 'Maybe half a rep left' },
+ { rir: 1, max: 1.5, color: 'var(--orange)', feel: 'One more rep in the tank' },
+ { rir: 2, max: 2.5, color: 'var(--yellow)', feel: 'Two more reps' },
+ { rir: 3, max: 3.5, color: 'var(--green)', feel: 'Three more reps' },
+ { rir: 4, max: Infinity, color: 'var(--acc-2)', feel: 'Easy — warm-up territory' }
+]
+// The presets shown in the picker, hardest first — the order they read on the scale and the
+// order the colours run. `tail` is the collapsed top bucket ("4+"): its value is the floor it
+// stands for, so a tap logs a concrete 4, not a range nothing downstream could average.
+export const EFFORT_PRESETS = EFFORT_BANDS.map((b, i) => ({
+ rir: b.rir, color: b.color, feel: b.feel, tail: i === EFFORT_BANDS.length - 1
+}))
+
+/**
+ * The colour for one effort value, given in RIR (use rirOf to convert a set first). Picks the
+ * band the value falls into: an exact preset lands on its own band, a typed in-between value
+ * (RIR 1.5) takes the band it sits within so it is never left uncoloured. null (unrated) has
+ * no colour — the caller shows a neutral control, not a green one.
+ */
+export const effortColor = rir => {
+ if (rir == null) return null
+ for (const b of EFFORT_BANDS) if (rir <= b.max) return b.color
+ return EFFORT_BANDS[EFFORT_BANDS.length - 1].color
+}
diff --git a/frontend/src/lib/effort.test.js b/frontend/src/lib/effort.test.js
index 8a5de70f8..c21b16647 100644
--- a/frontend/src/lib/effort.test.js
+++ b/frontend/src/lib/effort.test.js
@@ -1,7 +1,8 @@
import { describe, it, expect } from 'vitest'
import {
rirOf, toScale, displayScale, avgRir, effortSummary, hasEffort, effortWeeks,
- effortHistogram, isHardSet, HARD_RIR, MIN_RATED
+ effortHistogram, isHardSet, HARD_RIR, MIN_RATED,
+ effortColor, EFFORT_BANDS, EFFORT_PRESETS
} from './effort.js'
import { isoOf } from './format.js'
@@ -184,3 +185,78 @@ describe('isHardSet', () => {
expect(isHardSet({})).toBe(false) // unrated is not hard, and not easy either
})
})
+
+describe('EFFORT_BANDS / EFFORT_PRESETS', () => {
+ it('runs hardest-first and covers the whole scale with no gap', () => {
+ // presets are the quick-pick buttons, top of the scale (0 RIR = failure) first
+ expect(EFFORT_PRESETS.map(p => p.rir)).toEqual([0, 0.5, 1, 2, 3, 4])
+ // only the last bucket is the collapsed "4+" tail
+ expect(EFFORT_PRESETS.map(p => p.tail)).toEqual([false, false, false, false, false, true])
+ // the bands are contiguous: each band's ceiling is below the next band's floor, and the
+ // last reaches infinity so no rating is ever left without a colour
+ expect(EFFORT_BANDS[EFFORT_BANDS.length - 1].max).toBe(Infinity)
+ for (let i = 1; i < EFFORT_BANDS.length; i++) {
+ expect(EFFORT_BANDS[i].rir).toBeGreaterThan(EFFORT_BANDS[i - 1].max)
+ }
+ })
+
+ it('every preset carries a colour and a human description', () => {
+ for (const p of EFFORT_PRESETS) {
+ expect(p.color).toMatch(/^var\(--/)
+ expect(typeof p.feel).toBe('string')
+ expect(p.feel.length).toBeGreaterThan(0)
+ }
+ })
+})
+
+describe('effortColor', () => {
+ it('gives each preset value its own band colour', () => {
+ // hardest to easiest — the colours the picker shows on its buttons
+ expect(effortColor(0)).toBe('var(--purple)')
+ expect(effortColor(0.5)).toBe('var(--red)')
+ expect(effortColor(1)).toBe('var(--orange)')
+ expect(effortColor(2)).toBe('var(--yellow)')
+ expect(effortColor(3)).toBe('var(--green)')
+ expect(effortColor(4)).toBe('var(--acc-2)')
+ })
+
+ it('colours a typed in-between value by the band it falls in, never leaving it blank', () => {
+ // a half-step belongs to the harder band below it — the band ceilings are inclusive, so
+ // 1.5 (between "one left" and "two left") reads as the tougher of the two, its band 1 colour
+ expect(effortColor(1.5)).toBe(effortColor(1)) // orange, not yellow
+ expect(effortColor(2.5)).toBe(effortColor(2)) // yellow, not green
+ // 0.25 sits between failure (0) and the half-rep band (0.5); by the same inclusive-ceiling
+ // rule it reads as the harder one — the failure colour, never uncoloured
+ expect(effortColor(0.25)).toBe(effortColor(0))
+ })
+
+ it('collapses everything past the top bucket into one colour', () => {
+ // nobody reliably tells 5 from 7 reps in reserve — they are all "easy"
+ expect(effortColor(4)).toBe(effortColor(7))
+ expect(effortColor(4)).toBe(effortColor(10))
+ })
+
+ it('is null for an unrated set — colour means a rating, empty has none', () => {
+ expect(effortColor(null)).toBe(null)
+ expect(effortColor(undefined)).toBe(null)
+ })
+
+ it('reads the same colour whether the set was logged as RIR or RPE', () => {
+ // the picker colours by internal RIR (via rirOf), so 0 RIR and 10 RPE match, 2 and 8 match
+ expect(effortColor(rirOf({ rir: 0 }))).toBe(effortColor(rirOf({ rpe: 10 })))
+ expect(effortColor(rirOf({ rir: 2 }))).toBe(effortColor(rirOf({ rpe: 8 })))
+ expect(effortColor(rirOf({ rir: 0.5 }))).toBe(effortColor(rirOf({ rpe: 9.5 })))
+ })
+})
+
+describe('picker preset labels', () => {
+ // The picker labels each preset with its value on the active scale — the RIR presets shown
+ // to an RPE profile read as 10, 9.5, 9, 8, 7, 6. This is what toScale computes per button.
+ it('labels presets on the RIR scale unchanged', () => {
+ expect(EFFORT_PRESETS.map(p => toScale('rir', p.rir))).toEqual([0, 0.5, 1, 2, 3, 4])
+ })
+
+ it('labels the same presets as their RPE mirror for an RPE profile', () => {
+ expect(EFFORT_PRESETS.map(p => toScale('rpe', p.rir))).toEqual([10, 9.5, 9, 8, 7, 6])
+ })
+})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 6298de3ab..d5f48e0c0 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -27,11 +27,11 @@ describe('Brazilian Portuguese locale', () => {
.sort(byCodeUnit)
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
- expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(342)
- expect(inherited).toHaveLength(463)
+ expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(343)
+ expect(inherited).toHaveLength(467)
// If this fails, review the changed keys and wording before accepting a new hash. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('cafd0b6fde9f8261563b5040aa6e1278f5b469dc2d6b9c81d7d5554bb6825a05')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('091fdc0f54dd211f04986afd906513a906989cbc241f0aafca6fc69570f3c70b')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 0059d3758..c91d3a8ae 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -622,6 +622,11 @@ export default {
'Two more reps': 'Zwei Wiederholungen übrig',
'Three more reps': 'Drei Wiederholungen übrig',
'Easy — warm-up territory': 'Locker — Aufwärmbereich',
+ 'Maybe half a rep left': 'Vielleicht noch eine halbe Wiederholung',
+ 'How hard was that set?': 'Wie schwer war der Satz?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Tippe, wie viele Wiederholungen du übrig hattest, oder gib einen genauen {0}-Wert ein.',
+ 'Exact {0}': 'Genauer {0}-Wert',
+ 'Clear rating': 'Bewertung löschen',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 116779290..800ec19f5 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'Dos repeticiones más',
'Three more reps': 'Tres repeticiones más',
'Easy — warm-up territory': 'Fácil — zona de calentamiento',
+ 'Maybe half a rep left': 'Quizá media repetición más',
+ 'How hard was that set?': '¿Qué tan dura fue la serie?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Toca cuántas repeticiones te quedaban, o escribe un {0} exacto.',
+ 'Exact {0}': '{0} exacto',
+ 'Clear rating': 'Borrar valoración',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 7765ede5a..93b42e87f 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'Encore deux répétitions',
'Three more reps': 'Encore trois répétitions',
'Easy — warm-up territory': 'Facile — zone d’échauffement',
+ 'Maybe half a rep left': 'Peut-être une demi-répétition en réserve',
+ 'How hard was that set?': 'Cette série, c’était dur comment ?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Touche combien de répétitions il te restait, ou saisis un {0} précis.',
+ 'Exact {0}': '{0} précis',
+ 'Clear rating': 'Effacer l’évaluation',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 4096f21c4..229751815 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'दो रेप और बाकी',
'Three more reps': 'तीन रेप और बाकी',
'Easy — warm-up territory': 'आसान — वॉर्म-अप का दायरा',
+ 'Maybe half a rep left': 'शायद आधा रेप और बाकी',
+ 'How hard was that set?': 'वह सेट कितना मुश्किल था?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'टैप करें कि कितने रेप्स बाकी थे, या सटीक {0} दर्ज करें।',
+ 'Exact {0}': 'सटीक {0}',
+ 'Clear rating': 'रेटिंग साफ़ करें',
'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 अछूते रहते हैं।',
// --- effort in the stats ---
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index fd2b7600d..b19e3d959 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -579,6 +579,11 @@ export default {
'Two more reps': 'Két ismétlés még belefért volna',
'Three more reps': 'Három ismétlés még belefért volna',
'Easy — warm-up territory': 'Könnyű — bemelegítő szint',
+ 'Maybe half a rep left': 'Talán még fél ismétlés belefért volna',
+ 'How hard was that set?': 'Mennyire volt nehéz ez a sorozat?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Koppints rá, hány ismétlés maradt még, vagy adj meg pontos {0} értéket.',
+ 'Exact {0}': 'Pontos {0}',
+ 'Clear rating': 'Értékelés törlése',
'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.': 'A RIR a megmaradt ismétléseket számolja; az RPE ugyanazt a megerőltetést egy 10 pontos skálán olvassa le — tehát RPE ≈ 10 − RIR. Válaszd azt, amelyikben amúgy is gondolkodsz.',
'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 kiemelt sor az, ahova a legtöbb munkasorozat esik. A már rögzített sorozatok megtartják a saját skálájukat, és semmi más nem olvassa ki az értéket — a progressziót és a becsült 1RM-et nem érinti.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 8f80be252..ec6cd7941 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'Altre due ripetizioni',
'Three more reps': 'Altre tre ripetizioni',
'Easy — warm-up territory': 'Facile — zona riscaldamento',
+ 'Maybe half a rep left': 'Forse mezza ripetizione in riserva',
+ 'How hard was that set?': 'Quanto è stata dura la serie?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Tocca quante ripetizioni ti restavano, oppure inserisci un {0} preciso.',
+ 'Exact {0}': '{0} preciso',
+ 'Clear rating': 'Cancella valutazione',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index d341d8afa..957ced0e5 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': '두 개 더 남았음',
'Three more reps': '세 개 더 남았음',
'Easy — warm-up territory': '가벼움 — 웜업 구간',
+ 'Maybe half a rep left': '반 개 정도 더 남았을지도',
+ 'How hard was that set?': '이 세트는 얼마나 힘들었나요?',
+ 'Tap how many reps you had left, or type an exact {0}.': '몇 개 더 할 수 있었는지 탭하거나 정확한 {0} 값을 입력하세요.',
+ 'Exact {0}': '정확한 {0}',
+ 'Clear rating': '평가 지우기',
'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은 영향을 받지 않습니다.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index d3668cd19..17f4593af 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'Jeszcze dwa powtórzenia',
'Three more reps': 'Jeszcze trzy powtórzenia',
'Easy — warm-up territory': 'Lekko — poziom rozgrzewki',
+ 'Maybe half a rep left': 'Może pół powtórzenia w zapasie',
+ 'How hard was that set?': 'Jak ciężka była ta seria?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Dotknij, ile powtórzeń zostało w zapasie, lub wpisz dokładną wartość {0}.',
+ 'Exact {0}': 'Dokładne {0}',
+ 'Clear rating': 'Wyczyść ocenę',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index f57f794a0..e88661a0b 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -357,7 +357,9 @@ export const PT_BR_OVERRIDES = {
'Default for this bar type.': 'Padrão para este tipo de barra.',
'Set to 0 to go back to the default ({0}).': 'Defina 0 para voltar ao padrão ({0}).',
'Applies to this exercise everywhere, not just this plan.': 'Vale para este exercício em todos os lugares, não só neste plano.',
- 'You still log the total weight — the bar only feeds the per-side plate math.': 'Você continua registrando o peso total — a barra só entra no cálculo das anilhas por lado.'
+ 'You still log the total weight — the bar only feeds the per-side plate math.': 'Você continua registrando o peso total — a barra só entra no cálculo das anilhas por lado.',
+ // effort quick picker — pt-PT uses "toca"/"escreve"; Brazilian uses "toque"/"digite"
+ 'Tap how many reps you had left, or type an exact {0}.': 'Toque em quantas repetições você ainda tinha, ou digite um {0} exato.'
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 67c2ef230..1a4b30f83 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'Mais duas repetições',
'Three more reps': 'Mais três repetições',
'Easy — warm-up territory': 'Fácil — zona de aquecimento',
+ 'Maybe half a rep left': 'Talvez meia repetição em reserva',
+ 'How hard was that set?': 'Quão dura foi a série?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Toca em quantas repetições te restavam, ou escreve um {0} exato.',
+ 'Exact {0}': '{0} exato',
+ 'Clear rating': 'Limpar avaliação',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 93dd64629..05745db1b 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'Ещё два повторения',
'Three more reps': 'Ещё три повторения',
'Easy — warm-up territory': 'Легко — разминочная зона',
+ 'Maybe half a rep left': 'Может, ещё пол-повторения в запасе',
+ 'How hard was that set?': 'Насколько тяжёлым был подход?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Нажмите, сколько повторений оставалось в запасе, или введите точное значение {0}.',
+ 'Exact {0}': 'Точный {0}',
+ 'Clear rating': 'Сбросить оценку',
'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ПМ не меняются.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index e7c940685..1157054c1 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -579,6 +579,11 @@ export default {
'Two more reps': 'ยังเหลืออีกสองครั้ง',
'Three more reps': 'ยังเหลืออีกสามครั้ง',
'Easy — warm-up territory': 'ง่าย — ระดับวอร์มอัป',
+ 'Maybe half a rep left': 'อาจเหลืออีกครึ่งครั้ง',
+ 'How hard was that set?': 'เซ็ตนั้นหนักแค่ไหน?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'แตะเลือกว่าเหลืออีกกี่ครั้ง หรือพิมพ์ค่า {0} ที่แน่นอน',
+ 'Exact {0}': '{0} ที่แน่นอน',
+ 'Clear rating': 'ล้างการประเมิน',
'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 โดยประมาณจะไม่ได้รับผลกระทบ',
// --- effort in the stats ---
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 0ccd514e5..6c2ebeb8d 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': 'İki tekrar daha vardı',
'Three more reps': 'Üç tekrar daha vardı',
'Easy — warm-up territory': 'Kolay — ısınma bölgesi',
+ 'Maybe half a rep left': 'Belki yarım tekrar kalmıştı',
+ 'How hard was that set?': 'O set ne kadar zordu?',
+ 'Tap how many reps you had left, or type an exact {0}.': 'Kaç tekrar kaldığına dokun ya da tam bir {0} değeri gir.',
+ 'Exact {0}': 'Tam {0}',
+ 'Clear rating': 'Değerlendirmeyi temizle',
'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.',
// --- effort in the stats ---
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 2580efbf5..a2d175e56 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -604,6 +604,11 @@ export default {
'Two more reps': '还能再做两次',
'Three more reps': '还能再做三次',
'Easy — warm-up territory': '轻松——热身区间',
+ 'Maybe half a rep left': '也许还能再做半次',
+ 'How hard was that set?': '这组有多吃力?',
+ 'Tap how many reps you had left, or type an exact {0}.': '点选你还能再做几次,或直接输入准确的 {0}。',
+ 'Exact {0}': '准确的 {0}',
+ 'Clear rating': '清除评分',
'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 都不受影响。',
// --- effort in the stats ---
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 8ccba30f9..e47d2147f 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -4,8 +4,9 @@ import { useUI } from './store/useUI.js'
import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf, matchExercise, exOr } from './lib/exercises.js'
import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'
import { fmtDate, fmtNum, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'
-import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
+import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'
import { usesBar, barWeightFor, defaultBarWeight, hasBarOverride } from './lib/bar.js'
+import { toScale, rirOf, EFFORT_PRESETS, effortColor } from './lib/effort.js'
import { beep, vibrate } from './lib/sound.js'
import { t, instrFor, exerciseNameFor, getLang, INSTR_LANGS } from './lib/i18n.js'
import { nav } from './lib/nav.js'
@@ -13,7 +14,7 @@ import { starterRoutines } from './lib/starter.js'
import Media, { Thumb } from './components/Media.jsx'
import Stepper from './components/Stepper.jsx'
import Icon from './components/Icon.jsx'
-import { Button, Slider, Switch, Segmented, SelectRow, Row, TextField, MultiSelectRow } from './components/ui.jsx'
+import { Button, Slider, Switch, Segmented, SelectRow, Row, TextField, NumberField, MultiSelectRow } from './components/ui.jsx'
import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js'
import BodyMap from './components/BodyMap.jsx'
import { exerciseMuscleSnapshot, loadOfWorkouts, MUSCLES, MUSCLE_NAME, normalizeMuscleGroups, hasExplicitMuscleMetadata } from './lib/muscles.js'
@@ -1189,6 +1190,58 @@ export const glyphPicker = (current, onPick) => {
</>)
}
+/* ============================ effort quick picker (RIR / RPE) ============================ */
+// Rating a set used to mean walking a +/- stepper up the scale — eleven taps to log "5 reps
+// left". This is the one-tap replacement: a colour-coded button per preset, plus a free field
+// for the value between two presets. Presets are stored in RIR internally; a profile that logs
+// RPE sees the same buttons labelled on its own scale (toScale), coloured identically — the
+// colour is the effort, not the number, so 0 RIR and 10 RPE are both the "went to failure" end.
+function EffortPicker({ kind, value, onPick, close }) {
+ // Local mirror so the highlighted preset and the free field track typing live; the store is
+ // written on every change through onPick, the same as the stepper did.
+ const [v, setV] = useState(value ?? null)
+ const set = nv => { setV(nv); onPick(nv) }
+ // `v` is in the profile's own scale (whatever sits on the set: s.rir or s.rpe). Compare in
+ // RIR so the highlighted preset is right on either scale, and so a typed RPE colours the
+ // same as the RIR it equals.
+ const curRir = rirOf(kind === 'rpe' ? { rpe: v } : { rir: v })
+ const commit = nv => { close(); onPick(nv) }
+ const pick = rir => commit(toScale(kind, rir))
+ return <>
+ <h3>{t('How hard was that set?')}</h3>
+ <div className="muted small" style={{ marginBottom: 14, lineHeight: 1.45 }}>
+ {t('Tap how many reps you had left, or type an exact {0}.', EFFORT[kind].hd)}
+ </div>
+ <div className="effpick">
+ {EFFORT_PRESETS.map(p => {
+ const label = fmtNum(toScale(kind, p.rir)) + (p.tail ? '+' : '')
+ const on = curRir != null && curRir === p.rir
+ return <button key={p.rir} className={'effpick-b' + (on ? ' on' : '')}
+ style={{ '--bc': p.color }} onClick={() => pick(p.rir)}>
+ <span className="effpick-n">{label}</span>
+ <span className="effpick-f">{t(p.feel)}</span>
+ </button>
+ })}
+ </div>
+ {/* The free field keeps the flexibility the stepper had: a value between two presets, in
+ the profile's own scale, capped to the top of it (there is no RPE 12). Sized like a
+ preset so it reads as the seventh option — "or type your own" — not an afterthought. */}
+ <label className="effpick-free">
+ <span className="effpick-free-l">{t('Exact {0}', EFFORT[kind].hd)}</span>
+ <NumberField className="effpick-free-in" decimal nullable value={v ?? ''}
+ placeholder={EFFORT[kind].hd} onChange={nv => set(capEffort(kind, nv))} />
+ </label>
+ <div style={{ height: 10 }} />
+ {v != null && <Button variant="ghost" className="dim" icon="xmark" onClick={() => commit(null)}>{t('Clear rating')}</Button>}
+ <div style={{ height: 4 }} />
+ </>
+}
+// kind is 'rir' | 'rpe'; value is the set's current rating on that scale (or null); onPick
+// receives the new value on that same scale (null to clear). The caller stores it exactly as
+// weight/reps are stored — a null drops the key rather than writing a zero.
+export const effortPickerSheet = (kind, value, onPick) =>
+ ui().openSheet(close => <EffortPicker kind={kind} value={value} onPick={onPick} close={close} />)
+
/* ============================ share / print / import a plan ============================ */
export const planToolsSheet = () => ui().openSheet(close => <PlanTools close={close} />)
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index a71bfc005..15159f0ae 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -4,14 +4,15 @@ import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { exOr } from '../lib/exercises.js'
import { usesBar, barWeightFor, plateSplit } from '../lib/bar.js'
-import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, freestyleConfig, defaultConfig, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from '../lib/history.js'
+import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, freestyleConfig, defaultConfig, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from '../lib/history.js'
import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
import { beep, vibrate } from '../lib/sound.js'
import { t, exerciseNameFor } from '../lib/i18n.js'
import { api } from '../lib/api.js'
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
-import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet } from '../sheets.jsx'
+import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet, effortPickerSheet } from '../sheets.jsx'
+import { effortColor } from '../lib/effort.js'
import Icon from '../components/Icon.jsx'
import { Button, Check, NumberField } from '../components/ui.jsx'
import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'
@@ -135,24 +136,37 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
// 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))
+ // The effort column carries the scale key (`eff`) and its field name; unlike weight/reps it
+ // is not a stepper — it opens a colour-coded picker (see effortCell). `f` is s.rir or s.rpe.
+ const col3 = mode === 'reps' && eff ? { f: eff.f, eff: kind, hd: t(eff.hd) } : null
+ // Weight and reps step up from 0 with no ceiling, as they always did.
+ const bump = (s, i, col, 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={() => 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>
+ onChange={v => onField(i, col.f, v)} /></span>
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
</div>
)
+ // The effort cell is a single button, not a stepper: it shows the rating in the profile's
+ // scale, tinted by how close to failure it was, and opens the picker on tap — to set a
+ // rating or change one. Empty reads as a neutral dash; rirOf-via-effortColor keeps the
+ // colour identical whether the value is logged as RIR or RPE.
+ const effortCell = (s, i, col) => {
+ const v = s[col.f] ?? null
+ const rir = col.eff === 'rpe' ? (v == null ? null : 10 - v) : v
+ const color = effortColor(rir)
+ return <button className={'effcell' + (v == null ? ' is-empty' : '')}
+ style={color ? { color, borderColor: color } : undefined}
+ aria-label={col.hd}
+ onClick={() => effortPickerSheet(col.eff, v, nv => onField(i, col.f, nv))}>
+ {v == null ? col.hd : fmtNum(v)}
+ </button>
+ }
// A smaller stepper for a drop's weight/reps or a burst's reps — editing what the plan (or a
// live "+ Drop"/"+ Burst" tap) already put on the row, not typing into a fresh field.
const miniStepper = (value, step, dec, onChange) => (
@@ -236,7 +250,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
<div className="n">{phaseNum}</div>
{cell(s, i, col1, 'w')}
{col2 && cell(s, i, col2, 'r')}
- {col3 && cell(s, i, col3, 'eff')}
+ {col3 && effortCell(s, i, col3)}
{/* 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}
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index 72c008299..02e2e6298 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -20,6 +20,7 @@ const mocks = vi.hoisted(() => {
toast: vi.fn(),
scrollCalls: [],
swapActiveWorkoutExercise: vi.fn(),
+ effortPickerSheet: vi.fn(),
}
state.stopRest = vi.fn(() => { state.timer = null })
state.stopWork = vi.fn(() => { state.work = null })
@@ -66,10 +67,12 @@ vi.mock('../sheets.jsx', () => ({
workoutCompleteSheet: mocks.workoutCompleteSheet,
confirmSheet: mocks.confirmSheet,
swapActiveWorkoutExercise: mocks.swapActiveWorkoutExercise,
+ barWeightSheet: vi.fn(),
// Both note sheets belong here even though the tests never open one: Workout.jsx reads
// sessionNoteSheet during render, so a missing export is a render crash, not a no-op.
exerciseNoteSheet: vi.fn(),
sessionNoteSheet: vi.fn(),
+ effortPickerSheet: mocks.effortPickerSheet,
}))
vi.mock('../components/Media.jsx', () => ({ default: () => null }))
// api.js reads navigator.userAgent at module scope. This file installs its own DOM inside the
@@ -535,6 +538,90 @@ describe('progression guidance', () => {
})
})
+describe('effort cell (colour-coded RIR/RPE quick picker)', () => {
+ // A rep exercise whose sets can carry an effort rating. `rir` per set is optional — an
+ // unrated set simply omits the key, which is what the empty cell has to represent.
+ const effExercise = (rirs) => ({
+ id: 'plain-bench',
+ target: { mode: 'reps', reps: 5, weight: 60, bodyweight: false },
+ sets: rirs.map(rir => ({ w: 60, r: 5, done: false, ...(rir == null ? {} : { rir }) })),
+ })
+ const effCells = () => [...container.querySelectorAll('.effcell')]
+
+ async function mountEffort(rirs, scale = 'rir') {
+ mocks.S = workout([effExercise(rirs)])
+ mocks.S.effort = scale
+ installDom()
+ await act(async () => { root.render(React.createElement(Workout)) })
+ }
+
+ it('shows the effort column only when the profile logs a scale', async () => {
+ await mount([exercise('plain-bench', [false])]) // effort: 'none' from workout()
+ expect(effCells()).toHaveLength(0)
+ await unmount()
+ await mountEffort([null])
+ expect(effCells()).toHaveLength(1)
+ })
+
+ it('labels an unrated cell with the scale name, not a value or a colour', async () => {
+ await mountEffort([null], 'rir')
+ const cell = effCells()[0]
+ expect(cell.textContent).toBe('RIR')
+ expect(cell.className).toContain('is-empty')
+ // no rating means no inline colour on the button
+ expect(cell.getAttribute('style') || '').not.toMatch(/color/)
+ })
+
+ it('uses the profile scale for the empty label — RPE profile reads "RPE"', async () => {
+ await mountEffort([null], 'rpe')
+ expect(effCells()[0].textContent).toBe('RPE')
+ })
+
+ it('shows a logged rating as its number, tinted by the band it falls in', async () => {
+ await mountEffort([0, 2, null])
+ const cells = effCells()
+ expect(cells[0].textContent).toBe('0')
+ expect(cells[0].className).not.toContain('is-empty')
+ // 0 RIR = to failure = purple; 2 RIR = yellow (the colours effortColor assigns)
+ expect(cells[0].getAttribute('style')).toContain('--purple')
+ expect(cells[1].textContent).toBe('2')
+ expect(cells[1].getAttribute('style')).toContain('--yellow')
+ expect(cells[2].textContent).toBe('RIR') // the unrated one stays a label
+ })
+
+ it('displays a logged value on the profile scale — RIR 2 reads as RPE 8', async () => {
+ // the set is stored on whatever scale the profile logs; an RPE profile stores s.rpe
+ mocks.S = workout([{
+ id: 'plain-bench',
+ target: { mode: 'reps', reps: 5, weight: 60, bodyweight: false },
+ sets: [{ w: 60, r: 5, done: false, rpe: 8 }],
+ }])
+ mocks.S.effort = 'rpe'
+ installDom()
+ await act(async () => { root.render(React.createElement(Workout)) })
+ const cell = effCells()[0]
+ expect(cell.textContent).toBe('8')
+ // RPE 8 == RIR 2 == yellow: the colour is the effort, independent of the scale shown
+ expect(cell.getAttribute('style')).toContain('--yellow')
+ })
+
+ it('opens the picker for the set on tap, passing scale, current value and a writer', async () => {
+ await mountEffort([2])
+ await act(async () => {
+ effCells()[0].dispatchEvent(new dom.Event('click', { bubbles: true }))
+ })
+ expect(mocks.effortPickerSheet).toHaveBeenCalledOnce()
+ const [scale, value, onPick] = mocks.effortPickerSheet.mock.calls[0]
+ expect(scale).toBe('rir')
+ expect(value).toBe(2)
+ // the writer stores the chosen value back on the set, and null clears the key
+ onPick(1)
+ expect(mocks.S.active.entries[0].sets[0].rir).toBe(1)
+ onPick(null)
+ expect('rir' in mocks.S.active.entries[0].sets[0]).toBe(false)
+ })
+})
+
describe('superset flow survives an exercise being removed mid-session', () => {
// removeActiveExercise splices A.entries, shifting every index above the removal down.
// The high-water marks are index-keyed, so without re-baselining the shifted exercise