Phone-width layout: the double-progression row wraps into pairs, the Progression title keeps its width, page headers give way before their button, the body-weight buttons drop a line (QA C6, C8/C23, C25)

Four fixes to layouts that only fall apart on narrow phones, all pre-existing:

Exercise config sheet (C6). Double progression on a weighted exercise puts four
steppers in one .cfgrow (Step, Reps from, Reps up to, Deload 1RM). Each spends 64 px
on its buttons, so four abreast left the input 1 px at 320 and 13 px at 368 — "1.25"
read "1.2", "90" read "9(". The row now carries `cfgrow-4` when it holds the four,
and below 480 px it wraps into two pairs (basis half the row minus half the gap).
From 480 up four abreast still leaves 41 px, enough for "1.25".

Routine editor, "Progression" row (C8, same as C23). .lrow-m had a basis of 0 and got
only what the capped value left over: a 37 px box for a 96 px title at 320, so
"Progression" was painted over by "Linear progression". The title column now keeps
104 px, the width of one long word; the value shrinks and ellipsises as before. This
is the same floor the segmented-control rows already use (150 px), which the more
specific rule keeps. All 60 title+value rows in the 15 packs fit at 320 px.

Page header (.hdr) (C25 plus the two reported header cases). The title block could
not shrink below its longest word, so "Упражнения" at 34 px, "Izom szerint" next to
it, or a profile name like "Hi Bartholomew_Jones" pushed the Settings gear or the
"By muscle" button off the right edge, and before that the button's own label wrapped
into two lines. The title block gets min-width:0, a word that does not fit is
hyphenated (hyphens:auto — <html lang> follows the app language) and broken anywhere
only as a last resort, and the header button is flex:none so it keeps its width.

Body-weight card header, Home and Stats. In German the title plus "Ziel" and
"+ Eintragen" outgrow a 320 px card by ~55 px and the last button poked past the
card; the header (`bw-head`) may now wrap the button pair onto a second line, still
flush right.

Measured on the QA rig (scripts/opengym-qa/run/fix-layout-misc/measure.mjs, en/de/ru;
after in DejaVu and with Roboto injected, before in DejaVu):
  C6  input clientWidth for "1.25" (needs 37): before 1 / 13 / 24 at 320 / 368 / 412
      → 74 / 98 / 120, two lines; 480: 41, 600: 71, one line (c6-wide.mjs)
  C8  title box / paint-over onto the value, 320 en: before 37 px / 47 px over
      → 104 / −20 (Roboto −27); 368 de before 65 / 19 → 104 / −20; 412 ru before 80 / 10
      → 104 / −14; no title clipped in any of the 9 cases
  C25 Library button right edge, viewport 320 / 368: ru before 388 / 388 → 304 / 352;
      Roboto 304 / 352 / 396 (412), title hyphenated "Упраж-нения" at 320 and 368
  hdr Home gear right edge with "Hi Bartholomew_Jones": before 423 at every width
      → 304 / 352 / 396
  bw  last button past the card's padding, 320 de: before 53 px → 0 (second line);
      368 de before 5 → 0
Regression sweep (sweep.mjs: /home /settings /plan /plan/r /stats /library /muscles
/history at 320 and 368 in en/de/ru/hu): no page overflow, nothing off-screen, no row
wider than its card. Vitest: 115 files, 1520 tests green; locales in sync; the
source-string baseline stays at 33.
This commit is contained in:
Duarte Santos committed 2026-09-20 02:36:03 +02:00
1 parent fcb2fc576a
commit d7bb67a1c0
5 files changed
+90 -6

No files matched your search

+30 -3
View File
@@ -182,7 +182,15 @@ body.resting #app{padding-bottom:calc(206px + var(--sab))}
.sync-banner .icn,.sync-banner svg{flex:none;font-size:16px;color:var(--label-2)}
/* large title, the way a nav bar does it */
.hdr{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:8px 0 18px}
.hdr h1{font-size:34px;line-height:1.06;font-weight:700;letter-spacing:-.028em}
/* The title block gives way, the button on the right never does: a flex item will not shrink
below its longest word, so "Упражнения" at 34px or "Hi Bartholomew_Jones" used to push the
gear / "By muscle" past the screen edge. A word that does not fit is hyphenated ("Упраж-
нения"; <html lang> follows the app language, so the right dictionary applies) and, for one
no dictionary knows, broken anywhere as the last resort. Ordinary titles still wrap at
spaces, and the button keeps its width instead of squeezing. */
.hdr>div{min-width:0}
.hdr>.btn{flex:none}
.hdr h1{font-size:34px;line-height:1.06;font-weight:700;letter-spacing:-.028em;hyphens:auto;overflow-wrap:anywhere}
.hdr .sub{color:var(--label-2);font-size:15px;letter-spacing:-.006em;margin-top:4px}
.iconbtn{
@@ -214,6 +222,11 @@ h4.sec{
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.row{display:flex;align-items:center;gap:12px}
.row.between{justify-content:space-between}
/* The body-weight card header (Home and Stats): title on the left, Goal + Log on the right. In
German the title and the two buttons ("Ziel", "+ Eintragen") outgrow a 320px card by about
55px, so the button pair may drop to a second line — still flush right, hence the auto margin. */
.bw-head{flex-wrap:wrap;row-gap:8px}
.bw-head>.row{margin-left:auto}
/* ----------------------------------------------------------------- card -- */
.card{
@@ -247,11 +260,16 @@ h4.sec{
display:flex;align-items:center;justify-content:center;
background:var(--tint,var(--acc));color:#fff;
}
.lrow-m{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
/* The title column keeps at least 104px: with a basis of 0 it only got what a capped value left
over, and on a 320px phone "Progression" (96px) was painted over by "Linear progression" in a
37px box. .lrow-t does not ellipsise on purpose — long settings titles wrap onto a second line,
and a floor the width of one long word is what keeps a single word from spilling. The value
next to it shrinks and ellipsises instead (below). */
.lrow-m{flex:1;min-width:104px;display:flex;flex-direction:column;gap:1px}
.lrow-t{font-size:17px;letter-spacing:-.012em;line-height:1.25}
.lrow-s{font-size:13px;color:var(--label-2);line-height:1.3}
/* flex:none would let a long value ("Follow the routine (Linear progression)") run straight
through the title next to it, since the title's column is already free to shrink to nothing.
through the title next to it, since the title's column is free to shrink down to its floor.
Letting the value shrink and ellipsise instead keeps the two out of each other's way.
The cap is max-width, not flex-basis: .lrow-m is flex:1, so its basis is 0 and it absorbs
none of the shrink — a long value would otherwise take the whole row and squeeze the title
@@ -849,6 +867,15 @@ body.chips-dragging *{cursor:inherit}
.cfgrow>div{flex:1;min-width:0}
.cfgrow .stp button{width:30px}
.cfgrow .stp-l{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* The double-progression row holds four (Step / Reps from / Reps up to / Deload 1RM). Each stepper
already spends 64px on its two buttons, so four abreast left the input 1px at 320 and 13px at
368 — "1.25" showed as "1.2", "90" as "9(". Below 480px the row wraps into two pairs instead;
from there up four abreast still leaves the input 40px or more. The basis is half the row minus
half the gap, so each line takes exactly two. */
@media (max-width:479px){
.cfgrow.cfgrow-4{flex-wrap:wrap}
.cfgrow.cfgrow-4>div{flex-basis:calc(50% - 4px)}
}
/* --- rest timer --- */
#timer{
+3 -1
View File
@@ -1109,7 +1109,9 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit, perSide }) {
...options.map(p => ({ value: p, label: t(POLICY_NAME[p]) }))]} />
</div>
<div className="small dim" style={{ marginBottom: active === 'off' ? 18 : 10 }}>{t(POLICY_DESC[active])}</div>
{active !== 'off' && <div className="row cfgrow" style={{ marginBottom: 18 }}>
{/* Double progression on a weighted exercise fills this row with four steppers; `cfgrow-4`
lets it wrap into two pairs on phones, where four abreast left the inputs a few px wide. */}
{active !== 'off' && <div className={'row cfgrow' + (active === 'double' && epleyEligible ? ' cfgrow-4' : '')} style={{ marginBottom: 18 }}>
<Stepper label={mode === 'time' ? t('Step (seconds)') : t('Step ({0})', unit)} value={inc}
step={mode === 'time' ? 5 : 1.25} decimal={mode !== 'time'} invalid={invalid} className={invalid ? 'invalid' : ''}
onChange={v => setC(x => ({ ...x, inc: v }))} />
@@ -0,0 +1,55 @@
// @vitest-environment happy-dom
import React, { act } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { createRoot } from 'react-dom/client'
import { EXDB } from './lib/exercises.js'
import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { exConfigSheet } from './sheets.jsx'
// A weighted machine exercise: double progression adds the two rep steppers and the
// Epley deload stepper, four in one row (QA C6).
const ex = EXDB.find(e => e.id === '0009')
const mounted = []
function renderConfig(cfg) {
exConfigSheet(ex, { sets: 3, reps: 10, weight: 40, mode: 'reps', ...cfg }, vi.fn())
const sheet = useUI.getState().sheets.at(-1)
const host = document.createElement('div')
document.body.appendChild(host)
const root = createRoot(host)
mounted.push(root)
act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
const row = [...host.querySelectorAll('.cfgrow')].find(r => r.querySelector('.stp-l')?.textContent.startsWith('Step'))
return { host, row }
}
describe('exercise configuration progression row', () => {
beforeEach(() => {
globalThis.IS_REACT_ACT_ENVIRONMENT = true
useUI.setState({ sheets: [] })
useStore.setState(s => ({ S: { ...s.S, unit: 'kg' } }))
document.body.innerHTML = ''
})
afterEach(() => {
act(() => { mounted.splice(0).forEach(root => root.unmount()) })
})
it('marks the four-stepper double-progression row so it can wrap into pairs on phones', () => {
const { row } = renderConfig({ prog: 'double' })
expect(row.querySelectorAll('.stp-w')).toHaveLength(4)
expect(row.classList.contains('cfgrow-4')).toBe(true)
})
it('leaves the shorter rows alone', () => {
// linear on a weighted exercise: Step + Deload, two steppers
const linear = renderConfig({ prog: 'linear' })
expect(linear.row.querySelectorAll('.stp-w')).toHaveLength(2)
expect(linear.row.classList.contains('cfgrow-4')).toBe(false)
// double on a body-weight exercise: no Epley deload, three steppers
const bw = renderConfig({ prog: 'double', weight: 0, bodyweight: true })
expect(bw.row.querySelectorAll('.stp-w')).toHaveLength(3)
expect(bw.row.classList.contains('cfgrow-4')).toBe(false)
})
})
+1 -1
View File
@@ -129,7 +129,7 @@ export default function Home() {
)}
<div className="card">
<div className="row between" style={{ marginBottom: 6 }}>
<div className="row between bw-head" style={{ marginBottom: 6 }}>
<h2 style={{ margin: 0 }}>{t('Body weight')}</h2>
<div className="row" style={{ gap: 8 }}>
<Button size="sm" icon="target" style={S.targetW ? { color: 'var(--yellow)' } : undefined} onClick={goalSheet}>{S.targetW ? fmtNum(S.targetW) : t('Goal')}</Button>
+1 -1
View File
@@ -452,7 +452,7 @@ export default function Stats() {
<div className="cols">
<div className="card">
<div className="row between" style={{ marginBottom: 8 }}>
<div className="row between bw-head" style={{ marginBottom: 8 }}>
<h2 style={{ margin: 0 }}>{t('Body weight')}</h2>
<div className="row" style={{ gap: 8 }}>
<Button size="sm" icon="target" style={S.targetW ? { color: 'var(--yellow)' } : undefined} onClick={goalSheet}>{S.targetW ? fmtNum(S.targetW) : t('Goal')}</Button>