Merge fix/layout-misc: QA round 2026-09-19 (dev team)
This commit is contained in:
commit
0fa35030ee
5 files changed
+90
-6
No files matched your search
+30
-3
@@ -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
|
||||
@@ -955,6 +973,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{
|
||||
|
||||
@@ -1113,7 +1113,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)
|
||||
})
|
||||
})
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user