diff --git a/frontend/src/index.css b/frontend/src/index.css index 92a2df2..e684a11 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -659,20 +659,101 @@ 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} +/* a logged rating becomes a −/value/+ stepper, tinted by its effort band: the band colour + fills the cell at low opacity (set inline via color-mix), borders it, and colours the value. + the +/− buttons step 0.5 on the profile's scale; the value opens the picker. it carries the + same column flex as the plain .effcell so the row does not jump when a rating is added. */ +.setrow .effcell-stp,.setrow.eff3 .effcell-stp{ + height:44px;border-radius:10px;border:1.5px solid transparent; + transition:background var(--fast),border-color var(--fast); +} +.effcell-stp button{color:inherit} +.effcell-stp>button[aria-label="Decrease"], +.effcell-stp>button[aria-label="Increase"]{width:26px;height:44px;font-size:15px;opacity:.85} +.effcell-stp .val{ + flex:1;min-width:0;display:flex;align-items:center;justify-content:center; + font-size:15px;font-weight:600;letter-spacing:-.01em; + font-variant-numeric:tabular-nums;line-height:1;align-self:stretch;color:inherit; +} +.effcell-stp .val:active{background:var(--surface-3)} +/* 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 .effcell-stp,.setrow.eff3 .effcell-stp{flex:.8 1 0;min-width:0} +.setrow.eff3 .effcell-stp{flex:.7 1 0} .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} +.setrow.eff3 .effcell-stp>button[aria-label="Decrease"], +.setrow.eff3 .effcell-stp>button[aria-label="Increase"]{width:22px} +.setrow.eff3 .effcell-stp .val{font-size:14px} +/* 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 "Exact RIR" + label on the left, a −/value/+ group in the middle, and the scale name on the right, same + padding and radius as .effpick-b. the whole row borders in the current band colour. */ +.effpick-free{ + display:flex;align-items:center;justify-content:space-between;gap:10px; + padding:10px 14px;border-radius:13px;margin-top:2px; + background:var(--surface);border:1.5px solid var(--sep-op); + transition:border-color var(--fast); +} +.effpick-free-l{font-size:14px;color:var(--label-2);flex:none} +.effpick-free-unit{font-size:13px;font-weight:600;color:var(--label-3);flex:none} +/* the −/value/+ group: a rounded surface holding a big tappable number between two step + buttons. tinted (color:inherit) to the band colour when a value is set. */ +.effpick-step{ + display:flex;align-items:center;gap:2px;flex:none; + background:var(--surface-2);border-radius:10px;overflow:hidden; +} +.effpick-step button{ + width:38px;height:40px;flex:none;color:currentColor;font-size:16px;--icon-stroke:2.2; + display:flex;align-items:center;justify-content:center;transition:background var(--fast); +} +.effpick-step button:active{background:var(--surface-3)} +/* the `.num` base styling (transparent bg, no border) is scoped to `.stp .num`; this input is + not in a `.stp`, so it must set its own or the browser paints a native white field. */ +.effpick-free-in.num{ + flex:none;width:64px;text-align:center;padding:0;height:40px; + background:none;border:none;outline:none;color:currentColor; + font-size:20px;font-weight:700;font-variant-numeric:tabular-nums; + -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 e6448da..9649f35 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 8a5de70..c21b166 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 d84f00d..bd9f689 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(617) - expect(inherited).toHaveLength(592) + expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(618) + expect(inherited).toHaveLength(596) // 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('088bb72a6ce33793bcc81215c2e7fc036226d8f144c53a633982e5b336226293') + expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1f6ae623aa2a6234b7454b5b6b59512e66a03b39dda46b1b0f359942b970907d') }) test('does not leak European Portuguese UI terms', () => { diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index c7d9f05..1dd82aa 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -644,6 +644,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 fe27196..de8a89f 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -626,6 +626,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 e24fe32..cd6539d 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -626,6 +626,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 0e87eb2..01ab8d7 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -626,6 +626,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 d798393..7dfaba5 100644 --- a/frontend/src/locales/hu.js +++ b/frontend/src/locales/hu.js @@ -606,6 +606,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 52978fc..0f622e6 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -626,6 +626,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 1f62ce2..55e6276 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -626,6 +626,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 f6d8f9b..1e97736 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -626,6 +626,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 7bb2752..e26afa5 100644 --- a/frontend/src/locales/pt-BR.js +++ b/frontend/src/locales/pt-BR.js @@ -643,6 +643,8 @@ export const PT_BR_OVERRIDES = { 'Off: tap the number and type it': 'Desligado: toque no número e digite', 'Move, swap and remove buttons below the exercise': 'Botões mover, trocar e remover abaixo do exercício', 'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Tudo o que você esconde aqui fica a um toque: o botão ⋯ de um exercício e o número de uma série.', + // 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 91531ec..99ca4df 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -626,6 +626,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 bb31317..d07463e 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -626,6 +626,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 a904903..6fd61ff 100644 --- a/frontend/src/locales/th.js +++ b/frontend/src/locales/th.js @@ -606,6 +606,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 407ada7..a1d5dbd 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -626,6 +626,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 3254ff1..07ef3c3 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -626,6 +626,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 c16534c..3929401 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, bestWeightForEntry, 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, bestWeightForEntry, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, stepEffort, 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, dateLocale, instrFor, exerciseNameFor, getLang, INSTR_LANGS } from './lib/i18n.js' import { nav } from './lib/nav.js' @@ -13,7 +14,7 @@ import { buildStarterPlan, starterPlanDays, starterPlanOptions } from './lib/sta 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 MuscleExplorer from './components/MuscleExplorer.jsx' @@ -1282,6 +1283,69 @@ 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 }) + // The band colour for the value currently on the field, so the exact-value row is tinted the + // same way the presets and the workout row cell are — null (nothing typed) stays neutral. + const curColor = effortColor(curRir) + const commit = nv => { close(); onPick(nv) } + const pick = rir => commit(toScale(kind, rir)) + return <> +

{t('How hard was that set?')}

+
+ {t('Tap how many reps you had left, or type an exact {0}.', EFFORT[kind].hd)} +
+
+ {EFFORT_PRESETS.map(p => { + const label = fmtNum(toScale(kind, p.rir)) + (p.tail ? '+' : '') + const on = curRir != null && curRir === p.rir + return + })} +
+ {/* 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. + A −/+ pair flanks the number for 0.5-step nudging without leaving the sheet, coloured + by the band the current value falls in (the same colour the presets and the row cell + use); tapping the number itself still types an exact value. */} +
+ {t('Exact {0}', EFFORT[kind].hd)} +
+ + set(capEffort(kind, nv))} /> + +
+ {EFFORT[kind].hd} +
+
+ {v != null && } +
+ +} +// 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 => ) + /* ============================ share / print / import a plan ============================ */ export const planToolsSheet = () => ui().openSheet(close => ) diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index c16255e..69b91e1 100644 --- a/frontend/src/views/Workout.jsx +++ b/frontend/src/views/Workout.jsx @@ -12,7 +12,8 @@ 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, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet } from '../sheets.jsx' +import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, 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, weightIncrement, stepWeight } from '../lib/progression.js' @@ -136,7 +137,9 @@ 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 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 // 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) => { @@ -147,7 +150,6 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov // closure problem entirely and keeps every tap operating on the real current value. const fresh = useStore.getState().S.active?.entries[entryIdx]?.sets[i] const cur = fresh ? fresh[col.f] : s[col.f] - if (col.eff) return onField(i, col.f, stepEffort(col.eff, cur, dir)) if (mode === 'reps' && col.f === 'w') return onField(i, col.f, stepWeight(cur, col.step, dir)) onField(i, col.f, Math.max(0, Math.round(((cur || 0) + dir * col.step) * 100) / 100)) } @@ -160,9 +162,8 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov const cell = (s, i, col, cls) => (
{wc.steppers && } - {/* a typed effort is capped — there is no RPE 12, and 12 reps in reserve is a warm-up */} onField(i, col.f, col.eff ? capEffort(col.eff, v) : v)} /> + onChange={v => onField(i, col.f, v)} /> {wc.steppers && }
) @@ -207,6 +208,29 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov ], }) } + // 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. rirOf-via-effortColor keeps the colour identical whether the value + // is logged as RIR or RPE. With the +/- buttons switched off (Workout controls) a logged + // rating is just the tinted value, which still opens the picker. + 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) + const open = () => effortPickerSheet(col.eff, v, nv => onField(i, col.f, nv)) + if (v == null) return ( + + ) + const step = dir => onField(i, col.f, stepEffort(col.eff, v, dir)) + return ( +
+ {wc.steppers && } + + {wc.steppers && } +
+ ) + } // 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, snapWeightStep = false) => ( @@ -279,7 +303,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov {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 &&