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.

Workout: a tiny body in the header lights up as sets are ticked, with a sheet behind it (#670)

Duarte Santose88a79e771b6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a659c4361..f96e2d9b7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,9 @@ seconds at most) instead of nagging you anyway.
**See what a session hits before you start it.** Every routine on the Plan page (the week, the
rotation and the routine list) and today's session on Home now carry a tiny body, front and back,
with the muscles it works lit up. No more opening Leg Day to remember it is, in fact, legs.
+And it keeps going once you start: the workout header has the same tiny body, faint where the
+session is headed and lit up where you've already ticked sets, in every layout (#670). Tap it for
+the big map and done/planned sets per muscle. Settings → Workout → Fine-tuning turns it off.
- **Muscle balance**: tap a muscle you haven't trained right on the map and its row offers the
exercises for it, the same way the "Not trained" chips do (#553).
diff --git a/frontend/src/components/BodyMap.jsx b/frontend/src/components/BodyMap.jsx
index 46d3f83f3..77768b034 100644
--- a/frontend/src/components/BodyMap.jsx
+++ b/frontend/src/components/BodyMap.jsx
@@ -59,11 +59,12 @@ function View({ view, levels, onMuscle, selected }) {
* `load` is effective sets per muscle (see lib/muscles.js); shading is relative to
* the hardest-worked muscle in that same load, so it always reads as a balance. Pass ordered
* `{ at, level, exclusive? }` `thresholds` for a fixed absolute scale (recovery views use this
- * to keep their semantic bands stable); omitting it preserves the balance behavior.
+ * to keep their semantic bands stable); omitting it preserves the balance behavior. `levels`
+ * hands over ready-made steps instead (the live session map, lib/muscles.js sessionLevels).
*/
-export default function BodyMap({ load = {}, thresholds, body = 'male', onMuscle, selected, className = '' }) {
+export default function BodyMap({ load = {}, thresholds, levels: given, body = 'male', onMuscle, selected, className = '' }) {
const paths = useBodyPaths()
- const levels = levelsOf(load, thresholds)
+ const levels = given || levelsOf(load, thresholds)
const g = paths && (paths[body] || paths.male)
return (
<div className={'bodymap ' + className}>
diff --git a/frontend/src/components/SessionMuscles.jsx b/frontend/src/components/SessionMuscles.jsx
new file mode 100644
index 000000000..d26e9229b
--- /dev/null
+++ b/frontend/src/components/SessionMuscles.jsx
@@ -0,0 +1,83 @@
+import { useMemo, useState } from 'react'
+import { useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { t } from '../lib/i18n.js'
+import { fmtNum } from '../lib/format.js'
+import { isWarmupRow } from '../lib/workout-model.js'
+import { sessionLoad, sessionLevels, MUSCLES, MUSCLE_NAME } from '../lib/muscles.js'
+import BodyMap from './BodyMap.jsx'
+import { Button } from './ui.jsx'
+
+// What the running session hits (#670): a tiny body in the workout header that lights up as sets
+// are ticked, and a sheet behind it with the full map and done/planned sets per muscle. The
+// header re-renders on every keystroke in a set row, so the load is worked out again only when
+// the exercises or their ticks change, not when a weight is typed.
+const tickKey = entries => (entries || []).map(e =>
+ e.id + ':' + (e.sets || []).map(s => (isWarmupRow(s) ? 'w' : s.done ? '1' : '0')).join('')).join('|')
+
+export function useSessionLoad(entries) {
+ const key = tickKey(entries)
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ return useMemo(() => sessionLoad(entries), [key])
+}
+
+const any = load => MUSCLES.some(m => (load[m] || 0) > 0)
+
+/** The header button. Nothing at all until the session has a working set to show. */
+export function SessionMapButton({ entries, body }) {
+ const load = useSessionLoad(entries)
+ const levels = useMemo(() => sessionLevels(load), [load])
+ if (!any(load.planned)) return null
+ return <button type="button" className="iconbtn whdr-map" data-session-map aria-label={t('What this session hits')}
+ title={t('What this session hits')} onClick={sessionMusclesSheet}>
+ <BodyMap className="bm-mini" levels={levels} body={body} />
+ </button>
+}
+
+const r1 = v => Math.round(v * 10) / 10
+const ROWS = 6
+
+// The sheet reads the live session itself, so a set ticked behind it (the watch, another tab)
+// shows up while it is open.
+export function SessionMuscles({ close }) {
+ const entries = useStore(s => s.S.active?.entries)
+ const body = useStore(s => s.S.body)
+ const load = useSessionLoad(entries)
+ const levels = useMemo(() => sessionLevels(load), [load])
+ const [all, setAll] = useState(false)
+ const { done, planned } = load
+ const muscles = MUSCLES.filter(m => (planned[m] || 0) > 0)
+ .sort((a, b) => (done[b] || 0) - (done[a] || 0) || planned[b] - planned[a] || MUSCLES.indexOf(a) - MUSCLES.indexOf(b))
+ return <div className="sm-sheet">
+ <div className="row between" style={{ marginBottom: 8 }}>
+ <h3 style={{ margin: 0 }}>{t('What this session hits')}</h3>
+ <Button size="sm" variant="ghost" onClick={close}>{t('Done')}</Button>
+ </div>
+ <BodyMap levels={levels} body={body} />
+ <div className="hm-legend sm-legend">
+ <span className="hm-c l3" />{t('Already worked')}<span className="hm-c l1" />{t('Still to come')}
+ </div>
+ {(all ? muscles : muscles.slice(0, ROWS)).map(m => {
+ const d = r1(done[m] || 0)
+ const p = r1(planned[m])
+ return <div className="mrow" key={m} data-muscle-session={m}>
+ <span className="nm">{t(MUSCLE_NAME[m])}</span>
+ <span className="bar"><i style={{ width: Math.round(Math.min(d / p, 1) * 100) + '%' }} /></span>
+ <span className="v cmp" aria-label={`${t('Completed')} ${t('{0} sets', fmtNum(d))} · ${t('Planned')} ${t('{0} sets', fmtNum(p))}`}>
+ {fmtNum(d)}/{fmtNum(p)}
+ </span>
+ </div>
+ })}
+ {muscles.length > ROWS && <>
+ <div style={{ height: 8 }} />
+ <Button trailingIcon={all ? 'chevronUp' : 'chevronDown'} aria-expanded={all} onClick={() => setAll(v => !v)}>
+ {t(all ? 'Show less' : 'Show more')}
+ </Button>
+ </>}
+ </div>
+}
+
+/** Opens the session's muscle sheet from the workout header. */
+export function sessionMusclesSheet() {
+ return useUI.getState().openSheet(close => <SessionMuscles close={close} />)
+}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index ad8c61507..c8aef2178 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1689,6 +1689,13 @@ body.no-tabbar #timer.working{box-shadow:inset 0 var(--hair) 0 var(--acc),0 -10p
.bodymap.bm-mini .bm-ph{height:46px;width:44px}
.bodymap.bm-mini .bm-sil{fill:color-mix(in srgb,var(--label) 34%,var(--surface))}
.bodymap.bm-mini .bm-v path{stroke-width:3}
+/* The live session's body in the workout header (#670, components/SessionMuscles.jsx): no
+ taller than the icon buttons beside it, so the header keeps its height in every layout. */
+.iconbtn.whdr-map{width:auto;padding:0 4px;border-radius:10px}
+.whdr-map .bodymap.bm-mini .bm-v{height:30px}
+.whdr-map .bodymap.bm-mini .bm-ph{height:30px;width:29px}
+.sm-legend{justify-content:center;gap:6px;margin:10px 0 6px}
+.sm-legend .hm-c:not(:first-child){margin-inline-start:8px}
.bm-sil{fill:color-mix(in srgb,var(--label) 18%,var(--surface))}
.bm-m{fill:var(--bm-base);transition:fill var(--med) var(--ease)}
.bm-m.l1{fill:color-mix(in srgb,var(--acc) 32%,var(--bm-base))}
diff --git a/frontend/src/lib/muscles.js b/frontend/src/lib/muscles.js
index a3df5109e..56f7b8d7a 100644
--- a/frontend/src/lib/muscles.js
+++ b/frontend/src/lib/muscles.js
@@ -292,6 +292,33 @@ export function muscleBalanceWindow(workouts, win, now = Date.now(), today = tod
export const loadOfRoutine = (routine, exercises = {}) =>
loadOf((routine?.ex || []).map(c => ({ id: c.id, ex: exercises[c.id] || c, sets: c.sets || 1 })))
+/**
+ * A running session's muscles (#670): `done` from the sets ticked so far, `planned` from every
+ * working set on the screen, done or not. Warm-ups count for neither, as in the finished
+ * workout's map, so a session that is all ticked shades exactly like its summary.
+ */
+export function sessionLoad(entries) {
+ const of = pick => loadOf((entries || []).map(e => ({
+ id: e.id, ex: e.exercise || e, sets: (e.sets || []).filter(s => !isWarmupRow(s) && pick(s)).length,
+ })))
+ return { done: of(s => s.done), planned: of(() => true) }
+}
+
+/**
+ * Shade steps for the live session map. A muscle still to come gets the faintest step (l1); one
+ * already worked starts a step above and climbs with its share of the session's busiest muscle,
+ * so the first set already reads as "done" and the map brightens as the session goes.
+ */
+export function sessionLevels({ done, planned }) {
+ const max = Math.max(0, ...MUSCLES.map(m => planned[m] || 0), ...MUSCLES.map(m => done[m] || 0))
+ const lv = {}
+ MUSCLES.forEach(m => {
+ const d = done[m] || 0
+ lv[m] = d > 0 && max > 0 ? Math.max(2, Math.min(4, 1 + Math.ceil(d / max * 3))) : (planned[m] || 0) > 0 ? 1 : 0
+ })
+ return lv
+}
+
/**
* Effective sets programmed by the live recurring week; overrides and history are not plans.
* A floating week or rotation (S.queue, lib/queue.js) is the plan too: each of its sessions once,
diff --git a/frontend/src/lib/muscles.session.test.js b/frontend/src/lib/muscles.session.test.js
new file mode 100644
index 000000000..8205ecf1a
--- /dev/null
+++ b/frontend/src/lib/muscles.session.test.js
@@ -0,0 +1,56 @@
+import { describe, it, expect } from 'vitest'
+import { EXIDX } from './exercises.js'
+import { MUSCLES, musclesOf, sessionLoad, sessionLevels, loadOfWorkouts } from './muscles.js'
+
+// #670: the live workout's map. `done` is what the ticked sets hit, `planned` the whole session.
+const SQUAT = '0043'
+const BENCH = '0289'
+const top = id => Object.entries(musclesOf(EXIDX[id])).sort((a, b) => b[1] - a[1])[0][0]
+const set = (done, extra = {}) => ({ w: 20, r: 8, done, ...extra })
+
+describe('sessionLoad', () => {
+ it('counts ticked working sets as done and every working set as planned, never warm-ups', () => {
+ const entries = [
+ { id: BENCH, sets: [set(true, { warmup: true }), set(true), set(false), set(false)] },
+ { id: SQUAT, sets: [set(false), set(false)] },
+ ]
+ const { done, planned } = sessionLoad(entries)
+ const chest = top(BENCH)
+ const quads = top(SQUAT)
+ expect(done[chest]).toBeCloseTo(musclesOf(EXIDX[BENCH])[chest] * 1)
+ expect(planned[chest]).toBeCloseTo(musclesOf(EXIDX[BENCH])[chest] * 3)
+ expect(done[quads] || 0).toBe(0)
+ expect(planned[quads]).toBeGreaterThan(0)
+ })
+
+ it('a session with every set ticked matches its finished workout map', () => {
+ const entries = [{ id: BENCH, sets: [set(true, { warmup: true }), set(true), set(true)] }, { id: SQUAT, sets: [set(true)] }]
+ const { done, planned } = sessionLoad(entries)
+ expect(done).toEqual(loadOfWorkouts([{ entries }]))
+ expect(planned).toEqual(done)
+ })
+
+ it('copes with no session at all', () => {
+ expect(sessionLoad(undefined)).toEqual({ done: {}, planned: {} })
+ })
+})
+
+describe('sessionLevels', () => {
+ it('shows what is still to come faintly and what is done brighter', () => {
+ const chest = top(BENCH)
+ const quads = top(SQUAT)
+ const fresh = sessionLevels(sessionLoad([{ id: BENCH, sets: [set(false), set(false)] }, { id: SQUAT, sets: [set(false), set(false)] }]))
+ expect(fresh[chest]).toBe(1)
+ expect(fresh[quads]).toBe(1)
+ const unplanned = MUSCLES.find(m => !musclesOf(EXIDX[BENCH])[m] && !musclesOf(EXIDX[SQUAT])[m])
+ expect(fresh[unplanned]).toBe(0)
+
+ const oneSet = sessionLevels(sessionLoad([{ id: BENCH, sets: [set(true), set(false)] }, { id: SQUAT, sets: [set(false), set(false)] }]))
+ expect(oneSet[chest]).toBeGreaterThanOrEqual(2)
+ expect(oneSet[quads]).toBe(1)
+
+ const finished = sessionLevels(sessionLoad([{ id: BENCH, sets: [set(true), set(true)] }, { id: SQUAT, sets: [set(false), set(false)] }]))
+ expect(finished[chest]).toBeGreaterThan(oneSet[chest])
+ expect(finished[chest]).toBeLessThanOrEqual(4)
+ })
+})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 343be9e4e..0838ba41e 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('62149eb641636b04aa53b57e5f7dc00f11f58d3ff66f504a640476687ff19ca9')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('8cad3cf8af151c1cc3468d9461deb63d2d91cdc2e0d32cd94a0934664c9d1a12')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/lib/workout-controls.js b/frontend/src/lib/workout-controls.js
index 86f5a3416..4442f13a9 100644
--- a/frontend/src/lib/workout-controls.js
+++ b/frontend/src/lib/workout-controls.js
@@ -10,6 +10,8 @@ export const WC_DEFAULT = Object.freeze({
exerciseButtons: false, // Move up/down, Swap, Remove exercise below the exercise
exerciseChips: true, // the numbered chip per exercise at the top of the workout (#323); one row
// of fixed height that replaces the "Exercise 2 / 5" line in Cards and Focus
+ muscleMap: true, // the tiny body in the workout header that fills in as sets are ticked (#670);
+ // no taller than the header's buttons, so it costs no height
swipeSets: true, // swipe actions: a set row (start deletes with Undo, end copies) and, despite the
// name, Plan's routines, loop and routine exercises too (Settings: "Swipe actions")
})
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 09f4c5122..e55494475 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -492,6 +492,10 @@ export default {
'No workouts in this period yet.': 'لا توجد تمارين في هذه الفترة بعد.',
'Fewer than two workouts in this period. Pick a longer one.': 'أقل من تمرينين في هذه الفترة. اختر فترة أطول.',
'What this session hits': 'ما الذي تستهدفه هذه الجلسة',
+ 'Already worked': 'تم تمرينها',
+ 'Still to come': 'لم تأتِ بعد',
+ 'Muscle map in the header': 'خريطة العضلات في الأعلى',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'جسم صغير يضيء مع كل مجموعة تنهيها. اضغط عليه للتفاصيل.',
'What you just trained': 'العضلات التي درّبتها',
'Body diagram': 'خريطة الجسم',
'Male': 'ذكر',
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index bf4c37916..456fc1f8d 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -685,6 +685,10 @@ export default {
'No workouts in this period yet.': 'এই সময়ে এখনও কোনো ওয়ার্কআউট নেই।',
'Fewer than two workouts in this period. Pick a longer one.': 'এই সময়ে দুটির কম ওয়ার্কআউট। আরও লম্বা সময় বেছে নিন।',
'What this session hits': 'এই সেশন যেসব পেশিতে কাজ করে',
+ 'Already worked': 'ইতিমধ্যে কাজ হয়েছে',
+ 'Still to come': 'এখনও বাকি',
+ 'Muscle map in the header': 'উপরে পেশি ম্যাপ',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'একটা ছোট্ট শরীর যা প্রতিটি সেট শেষ করলে জ্বলে ওঠে। বিস্তারিত দেখতে ট্যাপ করুন।',
'What you just trained': 'এইমাত্র যা ট্রেন করলেন',
'Body diagram': 'শরীরের ডায়াগ্রাম',
'Male': 'পুরুষ',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 8ecc563ad..cf0927035 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -621,6 +621,10 @@ export default {
'No workouts in this period yet.': 'Noch keine Trainings in diesem Zeitraum.',
'Fewer than two workouts in this period. Pick a longer one.': 'Weniger als zwei Trainings in diesem Zeitraum. Wähle einen längeren.',
'What this session hits': 'Was dieses Training trifft',
+ 'Already worked': 'Schon trainiert',
+ 'Still to come': 'Kommt noch',
+ 'Muscle map in the header': 'Muskelkarte oben',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Ein kleiner Körper, der mit jedem abgehakten Satz aufleuchtet. Tippen für Details.',
'What you just trained': 'Was du gerade trainiert hast',
'Body diagram': 'Körperdiagramm',
'Male': 'Männlich',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 02d826d01..45791158e 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'Aún no hay entrenamientos en este periodo.',
'Fewer than two workouts in this period. Pick a longer one.': 'Menos de dos entrenamientos en este periodo. Elige uno más largo.',
'What this session hits': 'Qué trabaja esta sesión',
+ 'Already worked': 'Ya trabajado',
+ 'Still to come': 'Aún por venir',
+ 'Muscle map in the header': 'Mapa muscular arriba',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Un cuerpecito que se ilumina con cada serie que marcas. Tócalo para ver el detalle.',
'What you just trained': 'Lo que acabas de entrenar',
'Body diagram': 'Diagrama corporal',
'Male': 'Masculino',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 8cde1033a..76ccf7e90 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'Pas encore d\'entraînement sur cette période.',
'Fewer than two workouts in this period. Pick a longer one.': 'Moins de deux entraînements sur cette période. Choisis-en une plus longue.',
'What this session hits': 'Ce que cette séance sollicite',
+ 'Already worked': 'Déjà travaillé',
+ 'Still to come': 'Encore à venir',
+ 'Muscle map in the header': 'Carte musculaire en haut',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Un petit corps qui s’allume à chaque série cochée. Touchez-le pour les détails.',
'What you just trained': 'Ce que tu viens de travailler',
'Body diagram': 'Schéma du corps',
'Male': 'Homme',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index b9470935a..0f2973ca5 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'इस अवधि में अभी कोई वर्कआउट नहीं।',
'Fewer than two workouts in this period. Pick a longer one.': 'इस अवधि में दो से कम वर्कआउट हैं। लंबी अवधि चुनें।',
'What this session hits': 'यह सत्र क्या ट्रेन करता है',
+ 'Already worked': 'पहले ही ट्रेन किया',
+ 'Still to come': 'अभी बाकी है',
+ 'Muscle map in the header': 'ऊपर मांसपेशी मैप',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'एक छोटा शरीर जो हर पूरे सेट के साथ चमकता है। विवरण के लिए टैप करें।',
'What you just trained': 'आपने अभी क्या ट्रेन किया',
'Body diagram': 'शरीर आरेख',
'Male': 'पुरुष',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 4c3417f0b..5f850c5e5 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -603,6 +603,10 @@ export default {
'No workouts in this period yet.': 'Ebben az időszakban még nincs edzés.',
'Fewer than two workouts in this period. Pick a longer one.': 'Ebben az időszakban kevesebb mint két edzés van. Válassz hosszabbat.',
'What this session hits': 'Mit érint ez az edzés',
+ 'Already worked': 'Már megdolgoztatva',
+ 'Still to come': 'Még hátravan',
+ 'Muscle map in the header': 'Izomtérkép fent',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Egy kis test, ami minden kipipált sorozattal jobban világít. Koppints rá a részletekért.',
'What you just trained': 'Mit edzettél az imént',
'Body diagram': 'Testábra',
'Male': 'Férfi',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index bff269ce6..0554bc16d 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'Ancora nessun allenamento in questo periodo.',
'Fewer than two workouts in this period. Pick a longer one.': 'Meno di due allenamenti in questo periodo. Scegline uno più lungo.',
'What this session hits': 'Cosa allena questa sessione',
+ 'Already worked': 'Già allenato',
+ 'Still to come': 'Ancora da fare',
+ 'Muscle map in the header': 'Mappa muscolare in alto',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Un corpicino che si accende a ogni serie spuntata. Toccalo per i dettagli.',
'What you just trained': 'Cosa hai appena allenato',
'Body diagram': 'Diagramma del corpo',
'Male': 'Uomo',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 371a2e2c7..e4462ef9e 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': '이 기간에 아직 운동이 없습니다.',
'Fewer than two workouts in this period. Pick a longer one.': '이 기간에는 운동이 두 번 미만입니다. 더 긴 기간을 선택하세요.',
'What this session hits': '이 세션이 자극하는 부위',
+ 'Already worked': '이미 운동함',
+ 'Still to come': '아직 남음',
+ 'Muscle map in the header': '상단 근육 지도',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': '세트를 완료할 때마다 밝아지는 작은 몸. 탭하면 자세히 볼 수 있어요.',
'What you just trained': '방금 훈련한 부위',
'Body diagram': '신체 도해',
'Male': '남성',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 660ae0a3b..f71c06513 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'Brak treningów w tym okresie.',
'Fewer than two workouts in this period. Pick a longer one.': 'Mniej niż dwa treningi w tym okresie. Wybierz dłuższy.',
'What this session hits': 'Co trenuje ta sesja',
+ 'Already worked': 'Już przepracowane',
+ 'Still to come': 'Jeszcze przed tobą',
+ 'Muscle map in the header': 'Mapa mięśni u góry',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Małe ciało, które rozświetla się z każdą odhaczoną serią. Dotknij, by zobaczyć szczegóły.',
'What you just trained': 'Co obejmował ten trening',
'Body diagram': 'Diagram ciała',
'Male': 'Mężczyzna',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index f409bfe00..afc59ff71 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1614,6 +1614,7 @@ export const PT_BR_OVERRIDES = {
'Already in the loop: adds it again': 'Já está no ciclo: adiciona de novo',
'openGym is free: no ads, no subscriptions, no tracking. A coffee keeps it that way.': 'O openGym é grátis: sem anúncios, sem assinaturas, sem rastreamento. Um café ajuda a manter assim.',
'Buy me a coffee': 'Me pague um café',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Um corpinho que acende a cada série marcada. Toque para ver os detalhes.',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 4b6417f58..8c45ce295 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'Ainda sem treinos neste período.',
'Fewer than two workouts in this period. Pick a longer one.': 'Menos de dois treinos neste período. Escolhe um mais longo.',
'What this session hits': 'O que esta sessão trabalha',
+ 'Already worked': 'Já trabalhado',
+ 'Still to come': 'Ainda por vir',
+ 'Muscle map in the header': 'Mapa muscular no topo',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Um corpinho que se acende a cada série marcada. Toca para ver os detalhes.',
'What you just trained': 'O que acabaste de treinar',
'Body diagram': 'Diagrama do corpo',
'Male': 'Masculino',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index bd169c4ec..0709be40b 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -592,6 +592,10 @@ export default {
'No workouts in this period yet.': 'В этом периоде ещё нет тренировок.',
'Fewer than two workouts in this period. Pick a longer one.': 'В этом периоде меньше двух тренировок. Выберите период подлиннее.',
'What this session hits': 'Что задействует эта тренировка',
+ 'Already worked': 'Уже проработано',
+ 'Still to come': 'Ещё впереди',
+ 'Muscle map in the header': 'Карта мышц вверху',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Маленькое тело, которое светлеет с каждым отмеченным подходом. Нажмите, чтобы увидеть детали.',
'What you just trained': 'Что вы только что тренировали',
'Body diagram': 'Схема тела',
'Male': 'Мужской',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 8b3d2dbe7..e8612a4c0 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -603,6 +603,10 @@ export default {
'No workouts in this period yet.': 'ยังไม่มีการออกกำลังกายในช่วงนี้',
'Fewer than two workouts in this period. Pick a longer one.': 'ช่วงนี้มีการออกกำลังกายน้อยกว่าสองครั้ง ลองเลือกช่วงที่ยาวขึ้น',
'What this session hits': 'ท่านี้ฝึกกล้ามเนื้อส่วนไหนบ้าง',
+ 'Already worked': 'ฝึกไปแล้ว',
+ 'Still to come': 'ยังเหลืออยู่',
+ 'Muscle map in the header': 'แผนที่กล้ามเนื้อด้านบน',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'ร่างเล็ก ๆ ที่สว่างขึ้นทุกครั้งที่ติ๊กเซ็ต แตะเพื่อดูรายละเอียด',
'What you just trained': 'สิ่งที่เพิ่งฝึกไป',
'Body diagram': 'แผนภาพร่างกาย',
'Male': 'ชาย',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 1fd107ea2..1918c17b1 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': 'Bu dönemde henüz antrenman yok.',
'Fewer than two workouts in this period. Pick a longer one.': 'Bu dönemde ikiden az antrenman var. Daha uzun bir dönem seç.',
'What this session hits': 'Bu antrenman neyi çalıştırıyor',
+ 'Already worked': 'Zaten çalıştı',
+ 'Still to come': 'Sırada',
+ 'Muscle map in the header': 'Üstte kas haritası',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Her işaretlediğin sette biraz daha parlayan minik bir vücut. Ayrıntılar için dokun.',
'What you just trained': 'Az önce ne çalıştın',
'Body diagram': 'Vücut diyagramı',
'Male': 'Erkek',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 0ed7fcaba..4e6e55039 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -428,6 +428,10 @@ export default {
'No workouts in this period yet.': 'У цьому періоді ще немає тренувань.',
'Fewer than two workouts in this period. Pick a longer one.': 'У цьому періоді менше двох тренувань. Обери довший.',
'What this session hits': 'Що задіює це тренування',
+ 'Already worked': 'Вже пропрацьовано',
+ 'Still to come': 'Ще попереду',
+ 'Muscle map in the header': 'Мапа м’язів угорі',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': 'Маленьке тіло, що світлішає з кожним відміченим підходом. Торкніться, щоб побачити деталі.',
'What you just trained': 'Що ти щойно тренував',
'Body diagram': 'Схема тіла',
'Male': 'Чоловіча',
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 0d2ff0d8b..24680693a 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -591,6 +591,10 @@ export default {
'No workouts in this period yet.': '此期間尚無任何訓練紀錄。',
'Fewer than two workouts in this period. Pick a longer one.': '此期間的訓練少於兩次,請選擇更長的期間。',
'What this session hits': '本次訓練主要刺激肌群',
+ 'Already worked': '已練到',
+ 'Still to come': '還沒練',
+ 'Muscle map in the header': '頂部肌肉圖',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': '一個小人,每完成一組就亮一點。點一下看詳情。',
'What you just trained': '剛才完成的鍛鍊肌群',
'Body diagram': '身體肌群分佈圖',
'Male': '男性',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 257822f2b..887cd5a6f 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -602,6 +602,10 @@ export default {
'No workouts in this period yet.': '此期间还没有训练。',
'Fewer than two workouts in this period. Pick a longer one.': '此期间的训练少于两次,请选择更长的期间。',
'What this session hits': '这次训练练到哪里',
+ 'Already worked': '已练到',
+ 'Still to come': '还没练',
+ 'Muscle map in the header': '顶部肌肉图',
+ 'A tiny body that lights up as you tick sets. Tap it for the details.': '一个小人,每完成一组就亮一点。点一下看详情。',
'What you just trained': '你刚刚练了什么',
'Body diagram': '身体图示',
'Male': '男性',
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index d4ee0e6bb..2dd16e65e 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -617,6 +617,10 @@ export default function Settings({ page = null, find = null, via = null, entryKe
<Row icon="more" iconTint="var(--mint)" title={t('Exercise chips at the top')} subtitle={t('A numbered dot per exercise, filled as you go. Tap one to jump there.')}>
<Switch aria-label={t('Exercise chips at the top')} checked={wc.exerciseChips} onChange={v => setWc('exerciseChips', v)} />
</Row>
+ {/* The live session's body in the header (#670): on by default, it fits beside the ⋯. */}
+ <Row icon="figureStrength" iconTint="var(--orange)" title={t('Muscle map in the header')} subtitle={t('A tiny body that lights up as you tick sets. Tap it for the details.')}>
+ <Switch aria-label={t('Muscle map in the header')} checked={wc.muscleMap} onChange={v => setWc('muscleMap', v)} />
+ </Row>
<Row icon="link" iconTint="var(--blue)" title={t('Superset buttons in the exercise header')}>
<Switch checked={wc.pairButtons} onChange={v => setWc('pairButtons', v)} />
</Row>
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 1457b2040..1966c5375 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -24,6 +24,7 @@ import WorkoutChips from '../components/WorkoutChips.jsx'
import { supersetMeta } from '../lib/superset-meta.js'
import WorkoutThumb, { hasWorkoutMedia } from '../components/WorkoutThumb.jsx'
import { workoutSettingsSheet } from '../components/WorkoutSettingsSheet.jsx'
+import { SessionMapButton } from '../components/SessionMuscles.jsx'
import { durationSheet } from '../components/DurationWheel.jsx'
import { REST_MAX, fmtRest } from '../lib/duration.js'
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, exitWorkoutEdit, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, renameWorkoutSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, effortPickerSheet, exerciseHistorySheet, addRoutineToSessionSheet, finishWorkoutSheet, finishWorkoutNow } from '../sheets.jsx'
@@ -2066,6 +2067,7 @@ function ActiveWorkout() {
? <button className="iconbtn" aria-label={t('Close editor')} title={t('Close editor')} onClick={() => exitWorkoutEdit()}><Icon name="xmark" /></button>
: <button className="iconbtn" aria-label={t('Minimize')} title={t('Minimize')} onClick={() => nav('/home')}><Icon name="chevronDown" /></button>}
<div className="whdr-mid"><div className="whdr-name">{A.name}</div><div className="sub">{(A.backfill || editing) ? fmtDate(A.d, true) : <Elapsed start={A.start} />} · {t('{0} sets', done + '/' + total)}</div></div>
+ {wc.muscleMap && <SessionMapButton entries={A.entries} body={S.body} />}
<button className="iconbtn" aria-label={t('Workout options')} title={t('Workout options')} onClick={openViewMenu}><Icon name="more" /></button>
<button className="btn primary pill whdr-finish" aria-label={editing ? t('Save changes') : undefined}
onClick={() => (editing ? finishWorkout() : finishWorkoutSheet({ onDiscard: discardWorkout }))}>{editing ? t('Save') : t('Finish')}</button>
diff --git a/frontend/src/views/Workout.muscle-map.test.jsx b/frontend/src/views/Workout.muscle-map.test.jsx
new file mode 100644
index 000000000..91ef7de1d
--- /dev/null
+++ b/frontend/src/views/Workout.muscle-map.test.jsx
@@ -0,0 +1,120 @@
+// @vitest-environment happy-dom
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { MemoryRouter } from 'react-router-dom'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import Workout from './Workout.jsx'
+import { SessionMuscles } from '../components/SessionMuscles.jsx'
+import { DEF, useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { EXIDX } from '../lib/exercises.js'
+import { musclesOf } from '../lib/muscles.js'
+
+// #670: the workout header carries a tiny body of what the session hits, brighter where sets are
+// already ticked, in every layout, behind a switch that is on by default.
+
+const maps = vi.hoisted(() => [])
+vi.mock('../components/BodyMap.jsx', () => ({
+ default: props => { maps.push(props); return React.createElement('div', { 'data-body-map': props.className || '' }) },
+ BodyMapLegend: () => null,
+}))
+vi.mock('../lib/sound.js', () => ({ beep: vi.fn(), chime: vi.fn(), vibrate: vi.fn(), alertBuzz: vi.fn(), unlock: vi.fn() }))
+vi.mock('../lib/api.js', () => ({ api: vi.fn(() => Promise.resolve({})), beacon: vi.fn(), appBase: () => '/' }))
+
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+const BENCH = '0289'
+const SQUAT = '0043'
+const top = id => Object.entries(musclesOf(EXIDX[id])).sort((a, b) => b[1] - a[1])[0][0]
+const CHEST = top(BENCH)
+const QUADS = top(SQUAT)
+const row = (done = false) => ({ w: 20, r: 8, done })
+const entry = (id, sets) => ({ id, target: { sets: sets.length, reps: 8 }, sets })
+
+let root, container
+function setActive(entries, { wc, workoutView } = {}) {
+ const S = JSON.parse(JSON.stringify(DEF))
+ if (wc) S.wc = { ...S.wc, ...wc }
+ S.hints = { swipeSets: true }
+ S.active = { id: 'mm', d: '2026-10-19', start: Date.now(), routineId: null, name: 'Push', bw: null, cur: 0, entries, ...(workoutView ? { workoutView } : {}) }
+ useStore.setState({ S, user: null })
+}
+function render(node = <MemoryRouter><Workout /></MemoryRouter>) {
+ container = document.createElement('div')
+ document.body.appendChild(container)
+ root = createRoot(container)
+ act(() => root.render(node))
+}
+const headerMap = () => container.querySelector('.whdr [data-session-map]')
+const lastHeaderLevels = () => maps.filter(p => p.className === 'bm-mini').at(-1)?.levels
+const edit = fn => act(() => useStore.getState().update(fn))
+
+afterEach(() => {
+ act(() => root?.unmount()); container?.remove(); root = null
+ maps.length = 0
+ useUI.setState({ sheets: [] })
+})
+
+describe('Workout header muscle map (#670)', () => {
+ for (const view of ['cards', 'list', 'compact', 'focus']) {
+ it(`is in the header in ${view}`, () => {
+ setActive([entry(BENCH, [row(), row()])], { workoutView: view })
+ render()
+ expect(headerMap()).toBeTruthy()
+ expect(headerMap().getAttribute('aria-label')).toBe('What this session hits')
+ })
+ }
+
+ it('lights a muscle up when its set is ticked, still-to-come ones stay faint', () => {
+ setActive([entry(BENCH, [row(), row()]), entry(SQUAT, [row(), row()])])
+ render()
+ expect(lastHeaderLevels()[CHEST]).toBe(1)
+ expect(lastHeaderLevels()[QUADS]).toBe(1)
+ edit(s => { s.active.entries[0].sets[0].done = true })
+ expect(lastHeaderLevels()[CHEST]).toBeGreaterThanOrEqual(2)
+ expect(lastHeaderLevels()[QUADS]).toBe(1)
+ })
+
+ it('typing a weight does not work the map out again', () => {
+ setActive([entry(BENCH, [row(), row()])])
+ render()
+ const before = lastHeaderLevels()
+ edit(s => { s.active.entries[0].sets[1].w = 25 })
+ expect(useStore.getState().S.active.entries[0].sets[1].w).toBe(25)
+ expect(lastHeaderLevels()).toBe(before)
+ })
+
+ it('is gone when switched off, and absent for an empty freestyle session', () => {
+ setActive([entry(BENCH, [row()])], { wc: { muscleMap: false } })
+ render()
+ expect(headerMap()).toBeNull()
+ act(() => root.unmount()); container.remove()
+ setActive([])
+ render()
+ expect(headerMap()).toBeNull()
+ })
+
+ it('opens the session sheet on a tap', () => {
+ setActive([entry(BENCH, [row()])])
+ render()
+ act(() => headerMap().click())
+ expect(useUI.getState().sheets).toHaveLength(1)
+ })
+})
+
+describe('Session muscles sheet (#670)', () => {
+ it('lists done/planned sets per muscle, busiest first, and follows new ticks', () => {
+ setActive([entry(BENCH, [row(true), row(), row()]), entry(SQUAT, [row(), row()])])
+ render(<SessionMuscles close={() => {}} />)
+ const rows = () => [...container.querySelectorAll('[data-muscle-session]')]
+ expect(rows()[0].dataset.muscleSession).toBe(CHEST)
+ const w = musclesOf(EXIDX[BENCH])[CHEST]
+ const r1 = v => String(Math.round(v * 10) / 10)
+ const value = m => container.querySelector(`[data-muscle-session="${m}"] .v`).textContent
+ expect(value(CHEST)).toBe(`${r1(w)}/${r1(w * 3)}`)
+ expect(value(QUADS)).toMatch(/^0\//)
+ edit(s => { s.active.entries[1].sets[0].done = true })
+ expect(value(QUADS)).not.toMatch(/^0\//)
+ expect(container.textContent).toContain('Already worked')
+ expect(container.textContent).toContain('Still to come')
+ })
+})
diff --git a/frontend/src/views/settings-pages.test.jsx b/frontend/src/views/settings-pages.test.jsx
index a1664ac94..804cef53b 100644
--- a/frontend/src/views/settings-pages.test.jsx
+++ b/frontend/src/views/settings-pages.test.jsx
@@ -283,7 +283,7 @@ describe('the pages', () => {
expect([...host.querySelectorAll('.sect-f')].some(f => /screen stays on/.test(f.textContent))).toBe(false)
mount('advanced')
expect(titles()).toEqual(['Planned sessions start from', 'Keep timing after target', 'Weight and reps buttons',
- 'Drop and burst shortcuts on every set', 'Swipe actions', 'Exercise chips at the top', 'Superset buttons in the exercise header', 'Move, swap and remove buttons below the exercise'])
+ 'Drop and burst shortcuts on every set', 'Swipe actions', 'Exercise chips at the top', 'Muscle map in the header', 'Superset buttons in the exercise header', 'Move, swap and remove buttons below the exercise'])
})
it('Collapse completed exercises is saved for every session and drops a running session\'s own choice', () => {
@@ -305,6 +305,11 @@ describe('the pages', () => {
expect(chips.getAttribute('aria-checked')).toBe('true')
act(() => chips.click())
expect(mocks.S.wc.exerciseChips).toBe(false)
+ // the header's muscle map (#670) is on by default too
+ const map = rowTitled('Muscle map in the header').querySelector('[role="switch"]')
+ expect(map.getAttribute('aria-checked')).toBe('true')
+ act(() => map.click())
+ expect(mocks.S.wc.muscleMap).toBe(false)
})
it('a sub-page names where back goes; Fine-tuning goes back to Workout', () => {