diff --git a/frontend/src/index.css b/frontend/src/index.css index 10936fd..fd372f7 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -701,7 +701,32 @@ body.chips-dragging *{cursor:inherit} } .setrow .stp.w{flex:1.4;min-width:0} .setrow .stp.r{flex:1;min-width:0} +/* The number outranks the buttons in every set row, not only the ones with an effort column + that #235 covered: a 320 px phone left 0–6 px for the reps number and showed 102.5 as "102", + and the cardio row's 10.5 km/h read "10" at 368 px (QA C2, C21, C24). The field reserves the + widest value it shows at its font — "227.5" kg, "100" reps or "10.5" km/h (`--num`, incl. + the field's 4 px padding and 2 px against font rounding) — and the two buttons give up width + first, down to an 18 px floor, before anything is clipped. The cell itself is never narrower + than number + two floors, so the row's flex hands a starving cell width from the others + instead of clipping its buttons. */ .setrow .stp button{width:32px;height:40px} +/* Only the weight/reps buttons: `.effcell-stp` is a `.stp` too, and its value is a `} }
- {/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */} -
{col1.hd}{col2 && {col2.hd}}{col3 && {col3.hd}}{timed && }
+ {/* the header carries the same eff3/timed sizing as the rows, or the labels drift off their + columns; over L/R rows it also has to skip the side badge that sits in front of the weight cell */} +
{col1.hd}{col2 && {col2.hd}}{col3 && {col3.hd}}{timed && }
{entry.sets.map((s, i) => { const warm = isWarmupRow(s) const warmBefore = i > 0 && isWarmupRow(entry.sets[i - 1]) @@ -433,7 +434,7 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie
) : ( -
onSetRowRef?.(i, el)} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' eff3' : '')}> +
onSetRowRef?.(i, el)} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' eff3' : '') + (timed ? ' timed' : '')}> {cell(s, i, col1, 'w')} {col2 && cell(s, i, col2, 'r')} diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx index e3b669d..9b8d337 100644 --- a/frontend/src/views/Workout.test.jsx +++ b/frontend/src/views/Workout.test.jsx @@ -1437,3 +1437,48 @@ describe('Workout exercise tags', () => { } finally { _setLangState('en', null, null, null) } }) }) + +describe('set-row column header', () => { + // The L/R rows carry a badge in front of the weight cell that a straight row does not have, so + // the shared header needs to know it is sitting over per-side rows to offset its columns (QA C5). + it('marks the header of a per-side exercise so the CSS can offset it by the L/R badge', async () => { + const side = () => ({ w: 20, r: 8, done: false }) + await mount([ + exercise('plain-bench', [false]), + exercise('side-curl', [false], { + target: { mode: 'reps', side: true, reps: 16, weight: 20, bodyweight: false }, + sets: [{ w: 20, r: 16, done: false, sides: { L: side(), R: side() } }], + }), + ], 0, { active: { workoutView: 'list' } }) + const heads = container.querySelectorAll('.sethead') + expect(heads.length).toBe(2) + expect(heads[0].classList.contains('per-side')).toBe(false) + expect(heads[1].classList.contains('per-side')).toBe(true) + expect(container.querySelector('.setrow-side .sidetag')).toBeTruthy() + }) + + // A weighted hold's row has the play button in front of the tick, so its cells get less room than + // a straight row's and the CSS sizes them (and the header over them) by the `timed` marker. + it('marks a timed hold\'s rows and header, and neither on a rep set', async () => { + await mount([ + exercise('timed-plank', [false], { + target: { mode: 'time', sec: 30, weight: 60, bodyweight: false }, + sets: [{ sec: 30, w: 60, done: false }], + }), + exercise('plain-bench', [false]), + ], 0, { active: { workoutView: 'list' } }) + const heads = container.querySelectorAll('.sethead') + expect(heads[0].classList.contains('timed')).toBe(true) + expect(container.querySelector('.setrow.timed .setgo')).toBeTruthy() + expect(heads[1].classList.contains('timed')).toBe(false) + expect(container.querySelectorAll('.setrow.timed').length).toBe(1) + }) + + // With the +/- buttons switched off the cells' floors are the bare numbers; the header must + // freeze its columns the same way or the labels drift, so it carries the cells' `plain`. + it('carries `plain` on the header when the steppers are off', async () => { + await mount([exercise('plain-bench', [false])], 0, { wc: { steppers: false } }) + expect(container.querySelector('.sethead').classList.contains('plain')).toBe(true) + expect(container.querySelector('.setrow .stp.w').classList.contains('plain')).toBe(true) + }) +})