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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Workout view: add a "compact" layout and a per-session ⋮ switcher
Henry64563c257b16
diff --git a/docs/LIST_VIEW.md b/docs/LIST_VIEW.mdnew file mode 100644index 000000000..339867cc4--- /dev/null+++ b/docs/LIST_VIEW.md@@ -0,0 +1,36 @@+# Workout view — cards / list / compact++The active workout screen (`frontend/src/views/Workout.jsx`) has three layouts, chosen by+`S.workoutView` (`'cards' | 'list' | 'compact'`, default `'cards'`). It is purely+presentational — the same `s.active` session, entries and finish path in every layout, and+every set handler is already entry-index parameterised, so the layouts only change what is+rendered.++| Value | What you see |+|---|---|+| `cards` | One unit at a time, `Prev` / `Next` + swipe. The original flow. |+| `list` | Every unit stacked and scrollable. Each unit has a header (`Exercise n / m`) with a **Set current** chip; the footer's Move / Swap / Remove act on the current unit; completion still auto-advances the marker, starts rest and can open the top-weight sheet. |+| `compact` | `list`, with each `ExerciseBlock` rendered `dense`: no media, no tag chips (Cardio / per-side / target / equipment / **Best:**), no note lines, no "Last time …" recap, no bar-and-plates chip, no progression-guidance line. Just the name, the ⋯ menu and the set rows. Everything stripped is still on the ⋯ menu (note, details, history, bar weight, progression settings) or is display-only. |++Unknown / absent values read as `cards`, so a profile written before the setting existed is+unchanged.++## Where it is set++- **Saved default:** Settings → During a workout → **Workout view** (a 3-way `Segmented`).+- **Per session:** the workout header's **⋮** button opens a `menuSheet` with the three+ layouts; picking one writes `s.active.workoutView`.++`beginWorkout` / `beginBackfill` (`frontend/src/sheets.jsx`) snapshot `S.workoutView` onto+`s.active.workoutView` when the session is created, and the render prefers+`A.workoutView || S.workoutView`. So the ⋮ menu re-lays-out the running session only, and+changing the saved default never disturbs a workout already in progress.++## Tests++Component-level, no new `lib/` helper:++- `frontend/src/views/Workout.test.jsx` — `workout list view`, `workout compact view`,+ `workout view header menu` describe blocks.+- `frontend/src/views/Settings.workoutview.test.jsx` — the 3-way Segmented.+- `frontend/src/sheets.workoutview.test.jsx` — `beginWorkout` / backfill snapshot behaviour.diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex 1e6dc9b19..fa35e2e54 100644--- a/frontend/src/lib/pt-br-locale.test.js+++ b/frontend/src/lib/pt-br-locale.test.js@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(626)- expect(inherited).toHaveLength(613)+ expect(inherited).toHaveLength(614)// If this fails, review the changed keys and wording before accepting a new hash. From// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('81d277306b3029090b7a2ba6cc19108ca207ea65d738487155123260b6e9525d')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('b7e4e1f39100061735da0725188e593ce56ac080696eb32a71a38b03223a2fd6')})test('does not leak European Portuguese UI terms', () => {diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 5b0e2ff54..63c1f0617 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -441,6 +441,7 @@ export default {'Workout view': 'Trainingsansicht','Cards': 'Karten','List': 'Liste',+ 'Compact': 'Kompakt','Current': 'Aktuell','Set current': 'Als aktuell markieren','Move, swap and remove below act on the exercise marked {0}.': 'Verschieben, Tauschen und Entfernen unten wirken auf die als {0} markierte Übung.',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex b933ef8a7..197874cfb 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Vista del entrenamiento','Cards': 'Tarjetas','List': 'Lista',+ 'Compact': 'Compacta','Current': 'Actual','Set current': 'Marcar actual','Move, swap and remove below act on the exercise marked {0}.': 'Mover, cambiar y eliminar actúan sobre el ejercicio marcado como {0}.',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 4437662b9..ef60edb99 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Vue de l’entraînement','Cards': 'Cartes','List': 'Liste',+ 'Compact': 'Compacte','Current': 'En cours','Set current': 'Marquer comme en cours','Move, swap and remove below act on the exercise marked {0}.': 'Déplacer, échanger et supprimer ci-dessous s’appliquent à l’exercice marqué {0}.',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 7b5bb0d56..b1c11ae86 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -423,6 +423,7 @@ export default {'Workout view': 'वर्कआउट दृश्य','Cards': 'कार्ड','List': 'सूची',+ 'Compact': 'संक्षिप्त','Current': 'वर्तमान','Set current': 'वर्तमान के रूप में चिह्नित करें','Move, swap and remove below act on the exercise marked {0}.': 'नीचे दिए गए मूव, स्वैप और रिमूव {0} के रूप में चिह्नित व्यायाम पर लागू होते हैं।',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex b8a3d4672..047d8bff4 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -433,6 +433,7 @@ export default {'Workout view': 'Edzésnézet','Cards': 'Kártyák','List': 'Lista',+ 'Compact': 'Tömör','Current': 'Aktuális','Set current': 'Megjelölés aktuálisként','Move, swap and remove below act on the exercise marked {0}.': 'Az alábbi áthelyezés, csere és törlés a {0} jelölésű gyakorlatra vonatkozik.',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex bbd905719..6481b259e 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Vista allenamento','Cards': 'Schede','List': 'Elenco',+ 'Compact': 'Compatta','Current': 'Corrente','Set current': 'Imposta come corrente','Move, swap and remove below act on the exercise marked {0}.': 'Spostamento, scambio e rimozione qui sotto agiscono sull’esercizio contrassegnato come {0}.',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex aba5bf209..4637db1ab 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -423,6 +423,7 @@ export default {'Workout view': '운동 보기','Cards': '카드','List': '목록',+ 'Compact': '간략','Current': '현재','Set current': '현재 운동으로 설정','Move, swap and remove below act on the exercise marked {0}.': '아래의 이동, 교체, 삭제는 {0} 표시된 운동에 적용됩니다.',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 544b6c4e8..45a0875d6 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Widok treningu','Cards': 'Karty','List': 'Lista',+ 'Compact': 'Kompaktowy','Current': 'Bieżące','Set current': 'Ustaw jako bieżące','Move, swap and remove below act on the exercise marked {0}.': 'Przenoszenie, zamiana i usuwanie poniżej dotyczą ćwiczenia oznaczonego {0}.',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex f06f98666..791ce699e 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Vista do treino','Cards': 'Cartões','List': 'Lista',+ 'Compact': 'Compacta','Current': 'Atual','Set current': 'Marcar como atual','Move, swap and remove below act on the exercise marked {0}.': 'Mover, trocar e remover abaixo atuam sobre o exercício marcado como {0}.',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex adcc62980..5e083de06 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Вид тренировки','Cards': 'Карточки','List': 'Список',+ 'Compact': 'Компактный','Current': 'Текущее','Set current': 'Сделать текущим','Move, swap and remove below act on the exercise marked {0}.': 'Кнопки перемещения, замены и удаления ниже действуют на упражнение с пометкой {0}.',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 229a0241d..6f5399a56 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -433,6 +433,7 @@ export default {'Workout view': 'มุมมองการฝึก','Cards': 'การ์ด','List': 'รายการ',+ 'Compact': 'แบบย่อ','Current': 'ปัจจุบัน','Set current': 'ตั้งเป็นปัจจุบัน','Move, swap and remove below act on the exercise marked {0}.': 'การย้าย สลับ และลบด้านล่างจะมีผลกับท่าที่ทำเครื่องหมาย {0} ไว้',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex d4d554b6d..4e1a40ef5 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -423,6 +423,7 @@ export default {'Workout view': 'Antrenman görünümü','Cards': 'Kartlar','List': 'Liste',+ 'Compact': 'Kompakt','Current': 'Aktif','Set current': 'Aktif olarak işaretle','Move, swap and remove below act on the exercise marked {0}.': 'Aşağıdaki taşıma, değiştirme ve kaldırma işlemleri {0} olarak işaretli egzersiz için geçerlidir.',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 05108b7bb..6b932a6f0 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -423,6 +423,7 @@ export default {'Workout view': '训练视图','Cards': '卡片','List': '列表',+ 'Compact': '紧凑','Current': '当前','Set current': '设为当前','Move, swap and remove below act on the exercise marked {0}.': '下方的移动、替换和删除将作用于标记为{0}的动作。',diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 29a38ff5e..f239a0d5e 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -1668,6 +1668,9 @@ export function beginWorkout(routineId, bw) {s.active = {id: uid(), d: todayISO(), start: Date.now(), routineId,name: r ? r.name : t('Freestyle'), bw: bw || null, cur: 0, entries,+ // Snapshot the layout at start so the header ⋮ can change it for this session only —+ // changing the saved default (Settings → Workout view) mid-session leaves it alone.+ workoutView: st.workoutView || 'cards',...(excluded ? { excludeFromProgression: true } : {})}})@@ -1742,6 +1745,8 @@ function beginBackfill({ iso, time, durationMin, routineId, replaceId }) {id: uid(), d: iso, start: backfillStart(iso, time), routineId,name: r ? r.name : t('Freestyle'), bw: null, cur: 0, entries,backfill: { durationMin, replaceId: replaceId || null },+ // Same layout snapshot as a live session (see beginWorkout).+ workoutView: st.workoutView || 'cards',...(excluded ? { excludeFromProgression: true } : {})}})diff --git a/frontend/src/sheets.workoutview.test.jsx b/frontend/src/sheets.workoutview.test.jsxnew file mode 100644index 000000000..ceec22883--- /dev/null+++ b/frontend/src/sheets.workoutview.test.jsx@@ -0,0 +1,65 @@+// @vitest-environment happy-dom+import React, { act } from 'react'+import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { createRoot } from 'react-dom/client'+import { useStore } from './store/useStore.js'+import { useUI } from './store/useUI.js'+import { beginWorkout, logPastWorkoutSheet } from './sheets.jsx'+import { todayISO } from './lib/format.js'++// beginWorkout / beginBackfill snapshot S.workoutView onto s.active so the header ⋮ can+// re-lay-out the running session without touching the saved default.++const mounted = []+function type(el, value) {+ Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value)+ el.dispatchEvent(new Event('input', { bubbles: true }))+}+function mountTopSheet() {+ 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))))+ return host+}+const button = (host, text) => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === text)++describe('workout view is snapshot onto the active session', () => {+ beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ useUI.setState({ sheets: [], toasts: [] })+ useStore.setState(s => ({ S: { ...s.S, active: null, routines: [], workouts: [], workoutView: 'cards' } }))+ document.body.innerHTML = ''+ })+ afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })++ it('beginWorkout copies the current default onto s.active', () => {+ useStore.setState(s => ({ S: { ...s.S, workoutView: 'compact' } }))+ act(() => beginWorkout(null, null))+ expect(useStore.getState().S.active.workoutView).toBe('compact')+ })++ it('beginWorkout falls back to cards when the default is unset', () => {+ useStore.setState(s => { const S = { ...s.S }; delete S.workoutView; return { S } })+ act(() => beginWorkout(null, null))+ expect(useStore.getState().S.active.workoutView).toBe('cards')+ })++ it('later changes to the default leave the running session alone', () => {+ act(() => beginWorkout(null, null))+ expect(useStore.getState().S.active.workoutView).toBe('cards')+ useStore.setState(s => ({ S: { ...s.S, workoutView: 'list' } }))+ expect(useStore.getState().S.active.workoutView).toBe('cards')+ })++ it('a backfilled session snapshots it too', () => {+ useStore.setState(s => ({ S: { ...s.S, workoutView: 'list' } }))+ logPastWorkoutSheet()+ const host = mountTopSheet()+ act(() => { type(host.querySelector('input[type=date]'), '2020-01-02') })+ act(() => { button(host, 'Continue').click() })+ expect(useStore.getState().S.active.workoutView).toBe('list')+ })+})diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.jsindex 33dd4a7ee..2a0cdce50 100644--- a/frontend/src/store/useStore.js+++ b/frontend/src/store/useStore.js@@ -16,9 +16,12 @@ export const DEF = {theme: 'dark', accent: 'lime', body: 'male', targetW: null,bodyweight: [], routines: [], week: {}, dayPlan: {},exWeights: {}, workouts: [], active: null, customEx: [], gifSize: 'full',- // How the active workout is laid out — 'cards' (one exercise at a time with Prev/Next)- // or 'list' (every exercise stacked and scrollable). Purely presentational: profiles- // written before this setting existed overlay onto DEF and keep the 'cards' behaviour.+ // How the active workout is laid out — 'cards' (one exercise at a time with Prev/Next),+ // 'list' (every exercise stacked and scrollable) or 'compact' (that stack stripped to just+ // names and set rows — no media, tags, notes, last-time or progression line). Purely+ // presentational: profiles written before this setting existed overlay onto DEF and keep the+ // 'cards' behaviour. beginWorkout copies the value onto s.active, so the header ⋮ menu can+ // override it for the running session without touching this saved default.workoutView: 'cards',// Which controls the workout screen shows besides the sets themselves. The default is the// lean layout: one "more" button per exercise and a menu on each set number. Every switchdiff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex f9e0bad84..854c7ccf0 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -223,12 +223,14 @@ export default function Settings() {{/* ---------- during a workout ---------- */}<Section title={t('During a workout')} footer={wakeOK ? t('The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.') : null}>- {/* One exercise at a time (cards with Prev/Next) or the whole session stacked as a- scrollable list. Legacy/unknown values read as cards. */}+ {/* One exercise at a time (cards with Prev/Next), the whole session stacked as a+ scrollable list, or that list stripped to just names and set rows (compact).+ Legacy/unknown values read as cards. The running session can override this from+ the workout header's ⋮ menu without changing this default. */}<Row icon="list" iconTint="var(--blue)" title={t('Workout view')}><Segmented className="seg-inline"- options={[{ value: 'cards', label: t('Cards') }, { value: 'list', label: t('List') }]}- value={S.workoutView === 'list' ? 'list' : 'cards'}+ options={[{ value: 'cards', label: t('Cards') }, { value: 'list', label: t('List') }, { value: 'compact', label: t('Compact') }]}+ value={['list', 'compact'].includes(S.workoutView) ? S.workoutView : 'cards'}onChange={v => update(s => { s.workoutView = v })} /></Row>{/* The lean workout screen keeps the sets and one "more" button per exercise; each switchdiff --git a/frontend/src/views/Settings.workoutview.test.jsx b/frontend/src/views/Settings.workoutview.test.jsxindex 2bd990b9f..a58b2d59d 100644--- a/frontend/src/views/Settings.workoutview.test.jsx+++ b/frontend/src/views/Settings.workoutview.test.jsx@@ -67,15 +67,20 @@ const mount = () => act(() => root.render(<Settings />))const segButton = label => [...host.querySelectorAll('.seg button')].find(b => b.textContent === label)describe('Settings — workout view', () => {- it('offers Cards / List and writes workoutView to the store', () => {+ it('offers Cards / List / Compact and writes workoutView to the store', () => {mount()expect(segButton('Cards')).toBeTruthy()expect(segButton('List')).toBeTruthy()+ expect(segButton('Compact')).toBeTruthy()expect(segButton('Cards').getAttribute('aria-pressed')).toBe('true')act(() => { segButton('List').click() })expect(mocks.S.workoutView).toBe('list')mount()expect(segButton('List').getAttribute('aria-pressed')).toBe('true')+ act(() => { segButton('Compact').click() })+ expect(mocks.S.workoutView).toBe('compact')+ mount()+ expect(segButton('Compact').getAttribute('aria-pressed')).toBe('true')act(() => { segButton('Cards').click() })expect(mocks.S.workoutView).toBe('cards')})@@ -85,5 +90,6 @@ describe('Settings — workout view', () => {mount()expect(segButton('Cards').getAttribute('aria-pressed')).toBe('true')expect(segButton('List').getAttribute('aria-pressed')).toBe('false')+ expect(segButton('Compact').getAttribute('aria-pressed')).toBe('false')})})diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex a9f8a09b9..dcae25aa9 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -65,7 +65,11 @@ function Elapsed({ start }) {}/* ---------- one exercise block (reps: weight×reps · time: a held duration · cardio: duration+speed) ---------- */-function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef, onProgressionSettings, onSwap, onMoveUp, onMoveDown, canMoveUp, canMoveDown, onRemoveExercise, busy }) {+// `compact` shrinks the block for a superset member; `dense` (compact view) goes further and+// drops everything that is not a set you are logging — media, tag chips, the note lines, the+// "last time" recap and the progression line — leaving the name, the ⋯ menu and the sets.+// Nothing dropped is lost: it is all still on the ⋯ menu, or one ⋮ switch back to list/cards.+function ExerciseBlock({ entryIdx, compact, dense, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef, onProgressionSettings, onSwap, onMoveUp, onMoveDown, canMoveUp, canMoveDown, onRemoveExercise, busy }) {const S = useStore(s => s.S)const update = useStore(s => s.update)const working = useUI(s => s.work)@@ -242,19 +246,22 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov</div>)return <>- <Media ex={ex} key={entry.id} compact={compact} minimizable />+ {!dense && <Media ex={ex} key={entry.id} compact={compact} minimizable />}<div className="row between" style={{ marginBottom: 6 }}>- <div style={{ fontSize: compact ? 17 : 20, fontWeight: 600, letterSpacing: '-.02em', textTransform: 'capitalize', lineHeight: 1.2 }}>{exerciseNameFor(ex)}</div>+ <div style={{ fontSize: (compact || dense) ? 17 : 20, fontWeight: 600, letterSpacing: '-.02em', textTransform: 'capitalize', lineHeight: 1.2 }}>{exerciseNameFor(ex)}</div><div className="row" style={{ gap: 2, flex: 'none' }}>{entry.note && <button className="iconbtn" aria-label={t('Note')} title={t('Note')} style={{ color: 'var(--acc)' }}onClick={() => exerciseNoteSheet(entryIdx)}><Icon name="pencil" /></button>}<button className="iconbtn" aria-label={t('More')} title={t('More')} onClick={openMore}><Icon name="more" /></button></div></div>- {wc.pairButtons && !compact && (onPairPrev || onPairNext) && <div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>+ {wc.pairButtons && !compact && !dense && (onPairPrev || onPairNext) && <div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>{onPairPrev && <Button size="xs" variant="tinted" icon="link" title={t('Make superset with previous')} onClick={onPairPrev}>{t('Make superset with previous')}</Button>}{onPairNext && <Button size="xs" variant="tinted" icon="link" title={t('Make superset with next')} onClick={onPairNext}>{t('Make superset with next')}</Button>}</div>}+ {/* compact view drops everything from here to the sets card — it is all still on the ⋯ menu+ (note, details, history, bar weight, progression) or is display-only (tags, "last time"). */}+ {!dense && <><div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>{cardio && <span className="tag acc"><Icon name="figureRun" />{t('Cardio')}</span>}{/* You log the total; this is the split, so the set in front of you is unambiguous@@ -288,6 +295,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov<Icon name={plan.kind === 'up' ? 'arrowUp' : plan.kind === 'deload' ? 'arrowDown' : 'lightbulb'} /><span><strong>{t(guidance.policyLabel)}</strong> · {t(...guidance.why)}</span></button>}+ </>}<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}<div className={'sethead' + (col3 ? ' eff3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span>{col2 && <span className="r-sp">{col2.hd}</span>}{col3 && <span className="eff-sp">{col3.hd}</span>}{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>@@ -386,12 +394,17 @@ function ActiveWorkout() {const unit = A.entries.length ? unitOf(units, cur) : []const unitIdx = units.findIndex(u => u === unit)const isSuperset = unit.length > 1- // Cards show one unit at a time with Prev/Next + swipe; list stacks every unit so the- // whole session is visible and scrollable (Settings → During a workout → Workout view).- // Every set handler below is already entry-index parameterised, so list mode only changes- // what is rendered — completion, rest, top-weight and auto-advance share one path.- // Unknown/absent values read as cards, keeping every pre-existing profile as it was.- const listMode = S.workoutView === 'list'+ // Cards show one unit at a time with Prev/Next + swipe; list and compact stack every unit so+ // the whole session is visible and scrollable (Settings → During a workout → Workout view,+ // seeded onto s.active and overridable for this session from the header ⋮). compact is list+ // with the per-exercise media, tag chips, note lines, "last time" and progression line+ // stripped — just names and set rows. Every set handler below is already entry-index+ // parameterised, so these only change what is rendered — completion, rest, top-weight and+ // auto-advance share one path. Unknown/absent values read as cards, keeping every+ // pre-existing profile (and a session started before this field) as it was.+ const workoutView = A.workoutView || S.workoutView+ const listMode = workoutView === 'list' || workoutView === 'compact'+ const dense = workoutView === 'compact'const wc = workoutControls(S)// Superset flow: center the actionable row when completing a set moves to the partner or// back to the first exercise of the next round. Entry-bound maps keep repeated exercise IDs@@ -536,6 +549,18 @@ function ActiveWorkout() {// "Set current" on its header instead of Prev/Next. The bottom Move/Swap/Remove actions// keep operating on it, and completing sets still advances it on its own.const focusUnit = firstIdx => update(s => { if (s.active) s.active.cur = firstIdx })+ // The header ⋮ re-lays-out the running session without touching the saved default+ // (Settings → During a workout → Workout view). It writes s.active.workoutView, which the+ // render above prefers over S.workoutView.+ const setWorkoutView = v => update(s => { if (s.active) s.active.workoutView = v })+ const openViewMenu = () => menuSheet({+ title: t('Workout view'),+ items: [+ { icon: 'clipboard', label: t('Cards'), on: workoutView === 'cards', onClick: () => setWorkoutView('cards') },+ { icon: 'list', label: t('List'), on: workoutView === 'list', onClick: () => setWorkoutView('list') },+ { icon: 'minimize', label: t('Compact'), on: workoutView === 'compact', onClick: () => setWorkoutView('compact') },+ ],+ })const onSwipePointerDown = event => {if (swipe.current || (event.pointerType && event.pointerType !== 'touch' && event.pointerType !== 'pen')) returnif (event.target.closest?.(SWIPE_IGNORED_TARGETS)) return@@ -751,7 +776,10 @@ function ActiveWorkout() {<div className="hdr"><button className="iconbtn" aria-label={t('Discard')} onClick={() => confirmSheet({ title: t('Discard workout?'), message: t('The sets you logged in this session will be lost.'), confirmText: t('Discard'), danger: true, onConfirm: () => { update(s => { s.active = null }); stopRest(); stopWork(); nav('/home') } })}><Icon name="xmark" /></button><div style={{ textAlign: 'center' }}><div style={{ fontWeight: 600 }}>{A.name}</div><div className="sub">{A.backfill ? fmtDate(A.d, true) : <Elapsed start={A.start} />} · {t('{0} sets', done + '/' + total)}</div></div>- <button className="iconbtn" style={{ color: 'var(--acc)' }} aria-label={t('Finish')} onClick={finishWorkout}><Icon name="check" /></button>+ <div className="row" style={{ gap: 4, flex: 'none' }}>+ <button className="iconbtn" aria-label={t('Workout view')} title={t('Workout view')} onClick={openViewMenu}><Icon name="more" /></button>+ <button className="iconbtn" style={{ color: 'var(--acc)' }} aria-label={t('Finish')} onClick={finishWorkout}><Icon name="check" /></button>+ </div></div><div className="wprog"><i style={{ width: (total ? done / total * 100 : 0) + '%' }} /></div></div>@@ -779,13 +807,13 @@ function ActiveWorkout() {const entry = A.entries[idx]return <div key={idx} ref={el => bindExRef(entry, el)} className="ss-ex" data-exidx={idx}>{k > 0 && <div className="ss-amp">+</div>}- <ExerciseBlock entryIdx={idx} compact onSetRowRef={(setIdx, el) => bindSetRef(entry, setIdx, el)}+ <ExerciseBlock entryIdx={idx} compact dense={dense} onSetRowRef={(setIdx, el) => bindSetRef(entry, setIdx, el)}{...blockProps(idx)} /></div>})}</div>) : (- <ExerciseBlock entryIdx={u[0]}+ <ExerciseBlock entryIdx={u[0]} dense={dense}onPairPrev={u[0] > 0 ? () => pairAt(u[0] - 1, u[0]) : null}onPairNext={u[0] < A.entries.length - 1 ? () => pairAt(u[0], u[0] + 1) : null}{...blockProps(u[0])} />diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsxindex 140d4ca18..fbd3bc6c5 100644--- a/frontend/src/views/Workout.test.jsx+++ b/frontend/src/views/Workout.test.jsx@@ -1075,6 +1075,107 @@ describe('workout list view', () => {// Only the current exercise's sets are on screen.expect(container.querySelectorAll('[role="checkbox"]').length).toBe(1)})++ it('reads the layout from s.active first, then the global default', async () => {+ // Global says list, the session was started as cards — the session wins.+ await mount([exercise('plain-bench', [false])], 0, {+ workoutView: 'list', active: { workoutView: 'cards' },+ })+ expect(container.querySelector('[data-testid="workout-swipe-surface"]')).toBeTruthy()+ expect(container.querySelector('[data-testid="workout-list"]')).toBeNull()+ })+})++describe('workout compact view', () => {+ const units = () => [...container.querySelectorAll('.wl-unit')]+ const withExtras = done => exercise('plain-bench', done, {+ plan: {+ policy: 'linear', kind: 'up', weight: 62.5,+ why: ['Every rep last time — {0} {1} more.', 2.5, 'kg'],+ },+ })++ it('stacks every exercise like list mode does', async () => {+ await mount([withExtras([false, false]), exercise('plain-row', [false])], 0, { workoutView: 'compact' })++ expect(container.querySelector('[data-testid="workout-list"]')).toBeTruthy()+ expect(container.querySelector('[data-testid="workout-swipe-surface"]')).toBeNull()+ expect(units().length).toBe(2)+ expect(container.querySelectorAll('[role="checkbox"]').length).toBe(3)+ // The unit header and its "Set current" chip are part of list mode, kept in compact.+ expect(units()[0].textContent).toContain('Current')+ })++ it('strips the progression line, tags and last-time recap that list mode shows', async () => {+ const state = {+ workoutView: 'compact',+ exWeights: { 'plain-bench': { w: 80 } },+ workouts: [{ d: '2026-08-27', entries: [{ id: 'plain-bench', target: { reps: 5, weight: 60 }, sets: [{ w: 60, r: 5, done: true }] }] }],+ }+ await mount([withExtras([false])], 0, state)++ expect(container.querySelector('.progline')).toBeNull()+ expect(container.textContent).not.toContain('Best:')+ expect(container.textContent).not.toContain('Last time')+ // The sets card and the ⋯ menu button survive — nothing is truly unreachable.+ expect(container.querySelector('.setrow')).toBeTruthy()+ expect(container.querySelector('button[aria-label="More"]')).toBeTruthy()+ })++ it('keeps those same elements in list mode (the strip is compact-only)', async () => {+ const state = {+ workoutView: 'list',+ exWeights: { 'plain-bench': { w: 80 } },+ workouts: [{ d: '2026-08-27', entries: [{ id: 'plain-bench', target: { reps: 5, weight: 60 }, sets: [{ w: 60, r: 5, done: true }] }] }],+ }+ await mount([withExtras([false])], 0, state)++ expect(container.querySelector('.progline')).toBeTruthy()+ expect(container.textContent).toContain('Best:')+ expect(container.textContent).toContain('Last time')+ })++ it('completing a set still starts the rest, like list and cards', async () => {+ await mount([+ exercise('plain-bench', [false], { asked: true }),+ exercise('plain-row', [false], { asked: true }),+ ], 0, { workoutView: 'compact' })++ await toggleSet(0)++ expect(mocks.S.active.entries[0].sets[0].done).toBe(true)+ expect(mocks.startRest).toHaveBeenCalledWith(90, expect.any(Number))+ })+})++describe('workout view header menu', () => {+ const openMenu = async () => {+ const btn = container.querySelector('button[aria-label="Workout view"]')+ expect(btn).toBeTruthy()+ await act(async () => { btn.dispatchEvent(new dom.Event('click', { bubbles: true })) })+ return mocks.menuSheet.mock.calls.at(-1)[0]+ }+ const item = (menu, label) => menu.items.filter(Boolean).find(it => it.label === label)++ it('offers the three layouts and marks the running session current', async () => {+ await mount([exercise('plain-bench', [false])], 0, { active: { workoutView: 'list' } })++ const menu = await openMenu()+ expect(menu.items.filter(Boolean).map(it => it.label)).toEqual(['Cards', 'List', 'Compact'])+ expect(item(menu, 'List').on).toBe(true)+ expect(item(menu, 'Cards').on).toBe(false)+ expect(item(menu, 'Compact').on).toBe(false)+ })++ it('writes the pick onto s.active without touching the global default', async () => {+ await mount([exercise('plain-bench', [false])], 0, { workoutView: 'cards', active: { workoutView: 'cards' } })++ const menu = await openMenu()+ await act(async () => { item(menu, 'Compact').onClick() })++ expect(mocks.S.active.workoutView).toBe('compact')+ expect(mocks.S.workoutView).toBe('cards')+ })})describe('workout controls: the more menu and the set menu', () => {