From 0b1072dbf889d189947806dd4a019d8e20d9af40 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sun, 20 Sep 2026 03:16:17 +0200 Subject: [PATCH] =?UTF-8?q?Set=20rows:=20the=20number=20outranks=20the=20b?= =?UTF-8?q?uttons=20in=20every=20row=20=E2=80=94=20102.5=20kg,=20100=20rep?= =?UTF-8?q?s,=2010.5=20km/h,=20RPE=208.5=20and=20a=20drop's=20weight=20sta?= =?UTF-8?q?y=20readable=20at=20320/368/412=20px,=20and=20the=20header=20si?= =?UTF-8?q?ts=20over=20the=20L/R=20cells=20(QA=20C2=20C3=20C4=20C21=20C22?= =?UTF-8?q?=20C24=20C5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The weight/reps steppers gave their two 32 px buttons priority over the number between them, so on narrow phones the field shrank to nothing: at 320 px a fresh profile (no effort column, buttons on) showed an empty reps field and "102" for 102.5; per-side rows lost the reps number at 368 px, and inside a superset at 412; the cardio row's 10.5 km/h read "10"; a per-side drop set's two fields collapsed to 0 px; with an effort column the decimal weights lost their last digit at 320 px; a weighted timed hold showed "102.!" for its load at every phone width; the logged effort's value shrank to 4 px under its own digits so a tap on it stepped the rating instead of opening the picker; and the column header over per-side rows stood 17-23 px left of the cells because it never accounted for the L/R badge. Only the #235 mitigations existed, scoped to rows with an effort column. Every number field now reserves the widest value it shows at its own font (`--num`, plus the field's padding and 2 px against font rounding), the cell is never narrower than that plus two button floors (18 px, 16 px on the tightest rows), and the buttons shrink first. The weight and reps buttons, that is: the effort cell 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]) @@ -432,7 +433,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 d7f06ab..af9ecc6 100644 --- a/frontend/src/views/Workout.test.jsx +++ b/frontend/src/views/Workout.test.jsx @@ -1408,3 +1408,48 @@ describe('per-side effort completion', () => { expect(mocks.startRest).toHaveBeenCalledTimes(calls) }) }) + +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) + }) +})