diff --git a/frontend/src/components/ui.jsx b/frontend/src/components/ui.jsx index 22d8166..8c9fd0c 100644 --- a/frontend/src/components/ui.jsx +++ b/frontend/src/components/ui.jsx @@ -248,7 +248,7 @@ export function Row({ icon, iconTint, title, subtitle, value, accessory = 'none' // theme entirely — on dark mode it flashes a white sheet — and can't show more // than a bare label per option. This opens our own sheet with a checkmark on the // current value, which is also how iOS itself handles a long option list. -export function SelectRow({ icon, iconTint, title, value, options, onChange, sheetTitle }) { +export function SelectRow({ icon, iconTint, title, value, options, onChange, sheetTitle, stackedValue = false }) { const cur = options.find(o => o.value === value) const open = () => { const { openSheet } = require_ui() @@ -270,7 +270,8 @@ export function SelectRow({ icon, iconTint, title, value, options, onChange, she return h } return ( - + ) } diff --git a/frontend/src/index.css b/frontend/src/index.css index 376bf10..c999cd4 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -241,6 +241,13 @@ h4.sec{ .lrow-c{color:var(--label);font-size:15px;flex:none;--icon-stroke:2.4} .lrow-k{color:var(--acc);font-size:17px;flex:none;--icon-stroke:2.4} .lrow.danger,.lrow.danger .lrow-t{color:var(--red)} +/* The Stats exercise name gets its own line so long names cannot run into the title. */ +.lrow.lrow-stack-value{ + display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto; +} +.lrow.lrow-stack-value .lrow-m{grid-column:1;grid-row:1} +.lrow.lrow-stack-value .lrow-v{grid-column:1;grid-row:2;text-align:left} +.lrow.lrow-stack-value .lrow-c{grid-column:2;grid-row:1 / span 2;align-self:center} /* an (i) before a row's control: painted small and dim so the control stays the loud thing, but with a finger-sized target like everything else — the padding is the hit area and the vertical negative margin keeps it from making the row taller. The horizontal ones pull the diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx index 0140e72..77b0c2a 100644 --- a/frontend/src/views/Stats.jsx +++ b/frontend/src/views/Stats.jsx @@ -401,7 +401,7 @@ export default function Stats() {

{t('Exercise progress')}

{exHist.length ? <>
- ({ value: id, label: nameOf(id) + (exCurrent[id].mx ? ' ' + '—' + ' ' + fmtNum(exCurrent[id].mx) + ' ' + exCurrent[id].unit : '') }))} />
{exOpts.length > 1 && } diff --git a/frontend/src/views/Stats.test.js b/frontend/src/views/Stats.test.js index 96ab4b5..40ee4aa 100644 --- a/frontend/src/views/Stats.test.js +++ b/frontend/src/views/Stats.test.js @@ -3,6 +3,8 @@ import { readFileSync } from 'node:fs' import { bestWeightForEntry, metricModeForEntry, metricRowsForEntry } from '../lib/history.js' const source = readFileSync(new URL('./Stats.jsx', import.meta.url), 'utf8') +const uiSource = readFileSync(new URL('../components/ui.jsx', import.meta.url), 'utf8') +const cssSource = readFileSync(new URL('../index.css', import.meta.url), 'utf8') describe('Stats mixed-entry metric contract', () => { it('selects authoritative reps rows before timed rows without stale topW', () => { @@ -27,4 +29,13 @@ describe('Stats mixed-entry metric contract', () => { expect(source).not.toContain('const loggedMode = entryMode(en)') expect(source).not.toContain('(en.topW || 0)') }) + + it('stacks the Stats exercise selector value without changing shared SelectRow defaults', () => { + expect(source).toContain("onChange={setExId} stackedValue") + expect(uiSource).toContain('sheetTitle, stackedValue = false') + expect(uiSource).toContain("className={stackedValue ? 'lrow-stack-value' : ''}") + expect(cssSource).toContain('.lrow.lrow-stack-value .lrow-m{grid-column:1;grid-row:1}') + expect(cssSource).toContain('.lrow.lrow-stack-value .lrow-v{grid-column:1;grid-row:2;text-align:left}') + expect(cssSource).toContain('overflow:hidden;text-overflow:ellipsis;white-space:nowrap') + }) })