Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

fix: stack exercise progress selector value

Manuelbcbde6245c6c
diff --git a/frontend/src/components/ui.jsx b/frontend/src/components/ui.jsx
index 22d8166d4..8c9fd0cd5 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 (
- <Row icon={icon} iconTint={iconTint} title={title} value={cur ? cur.label : value} accessory="chevron" onClick={open} />
+ <Row icon={icon} iconTint={iconTint} title={title} value={cur ? cur.label : value} accessory="chevron" onClick={open}
+ className={stackedValue ? 'lrow-stack-value' : ''} />
)
}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 376bf10f7..c999cd434 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 0140e72c6..77b0c2a46 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -401,7 +401,7 @@ export default function Stats() {
<h2>{t('Exercise progress')}</h2>
{exHist.length ? <>
<div className="sect-b" style={{ marginBottom: 10 }}>
- <SelectRow title={t('Exercise')} sheetTitle={t('Exercise progress')} value={curEx} onChange={setExId}
+ <SelectRow title={t('Exercise')} sheetTitle={t('Exercise progress')} value={curEx} onChange={setExId} stackedValue
options={exHist.map(id => ({ value: id, label: nameOf(id) + (exCurrent[id].mx ? ' ' + '—' + ' ' + fmtNum(exCurrent[id].mx) + ' ' + exCurrent[id].unit : '') }))} />
</div>
{exOpts.length > 1 && <Segmented className="seg-range" value={onEff ? 'effort' : onE1 ? 'e1rm' : 'top'} onChange={setExMetric} options={exOpts} />}
diff --git a/frontend/src/views/Stats.test.js b/frontend/src/views/Stats.test.js
index 96ab4b553..40ee4aad0 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')
+ })
})