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 muscle map rides at the end of the exercise chips, worked muscles stand out (#670)

Duarte Santosf4270c9dce0c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f96e2d9b7..c78f4fbee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,9 +20,10 @@ 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.
+And it keeps going once you start: the exercise chips at the top of a workout end in the same
+tiny body, faint where the session is headed and lit up where you've already ticked sets, in every
+layout and without moving a single set row (#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/SessionMuscles.jsx b/frontend/src/components/SessionMuscles.jsx
index d26e9229b..29b13220f 100644
--- a/frontend/src/components/SessionMuscles.jsx
+++ b/frontend/src/components/SessionMuscles.jsx
@@ -30,7 +30,7 @@ export function SessionMapButton({ entries, body }) {
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} />
+ <BodyMap className="bm-mini bm-session" levels={levels} body={body} />
</button>
}
@@ -53,9 +53,9 @@ export function SessionMuscles({ close }) {
<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} />
+ <BodyMap className="bm-session" 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')}
+ <span className="hm-c l4" />{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)
@@ -63,7 +63,7 @@ export function SessionMuscles({ close }) {
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))}`}>
+ <span className="v sess" aria-label={`${t('Completed')} ${t('{0} sets', fmtNum(d))} · ${t('Planned')} ${t('{0} sets', fmtNum(p))}`}>
{fmtNum(d)}/{fmtNum(p)}
</span>
</div>
diff --git a/frontend/src/index.css b/frontend/src/index.css
index c8aef2178..5039e9d3e 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -1689,11 +1689,18 @@ 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}
+/* The live session's body (#670, components/SessionMuscles.jsx): at the end of the exercise
+ chips, and no taller than their 37px row, so it moves nothing in any layout. */
+.iconbtn.whdr-map{width:auto;height:32px;padding:0 2px;border-radius:10px}
+.wchips-row{display:flex;align-items:center;gap:4px}
+.wchips-row>.wchips{flex:1;min-width:0}
+.whdr-map .bodymap.bm-mini{gap:1px}
.whdr-map .bodymap.bm-mini .bm-v{height:30px}
.whdr-map .bodymap.bm-mini .bm-ph{height:30px;width:29px}
+/* Still to come is a whisper of the accent, so the worked muscles (l3, l4) stand out from it. */
+.bm-session .bm-m.l1{fill:color-mix(in srgb,var(--acc) 20%,var(--bm-base))}
+.sm-legend .hm-c.l1{background:color-mix(in srgb,var(--acc) 20%,var(--surface-2))}
+.mrow .v.sess{min-width:64px;font-variant-numeric:tabular-nums;white-space:nowrap}
.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))}
diff --git a/frontend/src/lib/muscles.js b/frontend/src/lib/muscles.js
index 56f7b8d7a..13a2d0e1a 100644
--- a/frontend/src/lib/muscles.js
+++ b/frontend/src/lib/muscles.js
@@ -306,15 +306,15 @@ export function sessionLoad(entries) {
/**
* 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.
+ * already worked jumps to l3, so the first set reads as "done" even on a 30px body, and to the
+ * full accent (l4) once it has half as many sets as the session's busiest muscle will.
*/
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
+ lv[m] = d > 0 ? (d * 2 >= max ? 4 : 3) : (planned[m] || 0) > 0 ? 1 : 0
})
return lv
}
diff --git a/frontend/src/lib/muscles.session.test.js b/frontend/src/lib/muscles.session.test.js
index 8205ecf1a..26c30aa58 100644
--- a/frontend/src/lib/muscles.session.test.js
+++ b/frontend/src/lib/muscles.session.test.js
@@ -45,12 +45,13 @@ describe('sessionLevels', () => {
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)
+ // one set of four: worked, but not yet the full accent
+ const oneSet = sessionLevels(sessionLoad([{ id: BENCH, sets: [set(true), set(false), set(false), set(false)] }, { id: SQUAT, sets: [set(false), set(false)] }]))
+ expect(oneSet[chest]).toBe(3)
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)
+ const finished = sessionLevels(sessionLoad([{ id: BENCH, sets: [set(true), set(true), set(true), set(true)] }, { id: SQUAT, sets: [set(false), set(false)] }]))
+ expect(finished[chest]).toBe(4)
+ expect(finished[quads]).toBe(1)
})
})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 0838ba41e..6126fef59 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('8cad3cf8af151c1cc3468d9461deb63d2d91cdc2e0d32cd94a0934664c9d1a12')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('f777373f78708f7a1f91571d27da9e7d1b9c09ca7deed8f0b4f821c55d414228')
})
// pt-PT labelled Unpair 'Desfazer': Undo, in Portuguese (it is pt-BR's Undo), on the button that
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index e55494475..d2e1d8939 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -494,7 +494,7 @@ export default {
'What this session hits': 'ما الذي تستهدفه هذه الجلسة',
'Already worked': 'تم تمرينها',
'Still to come': 'لم تأتِ بعد',
- 'Muscle map in the header': 'خريطة العضلات في الأعلى',
+ 'Muscle map at the top': 'خريطة العضلات في الأعلى',
'A tiny body that lights up as you tick sets. Tap it for the details.': 'جسم صغير يضيء مع كل مجموعة تنهيها. اضغط عليه للتفاصيل.',
'What you just trained': 'العضلات التي درّبتها',
'Body diagram': 'خريطة الجسم',
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 456fc1f8d..3fd5f7cb0 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -687,7 +687,7 @@ export default {
'What this session hits': 'এই সেশন যেসব পেশিতে কাজ করে',
'Already worked': 'ইতিমধ্যে কাজ হয়েছে',
'Still to come': 'এখনও বাকি',
- 'Muscle map in the header': 'উপরে পেশি ম্যাপ',
+ 'Muscle map at the top': 'উপরে পেশি ম্যাপ',
'A tiny body that lights up as you tick sets. Tap it for the details.': 'একটা ছোট্ট শরীর যা প্রতিটি সেট শেষ করলে জ্বলে ওঠে। বিস্তারিত দেখতে ট্যাপ করুন।',
'What you just trained': 'এইমাত্র যা ট্রেন করলেন',
'Body diagram': 'শরীরের ডায়াগ্রাম',
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index cf0927035..b2ba2f5fb 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -623,7 +623,7 @@ export default {
'What this session hits': 'Was dieses Training trifft',
'Already worked': 'Schon trainiert',
'Still to come': 'Kommt noch',
- 'Muscle map in the header': 'Muskelkarte oben',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 45791158e..0c5cb0289 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -604,7 +604,7 @@ export default {
'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',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 76ccf7e90..4f4d8dde2 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -604,7 +604,7 @@ export default {
'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',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 0f2973ca5..d33dfaeda 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -604,7 +604,7 @@ export default {
'What this session hits': 'यह सत्र क्या ट्रेन करता है',
'Already worked': 'पहले ही ट्रेन किया',
'Still to come': 'अभी बाकी है',
- 'Muscle map in the header': 'ऊपर मांसपेशी मैप',
+ 'Muscle map at the top': 'ऊपर मांसपेशी मैप',
'A tiny body that lights up as you tick sets. Tap it for the details.': 'एक छोटा शरीर जो हर पूरे सेट के साथ चमकता है। विवरण के लिए टैप करें।',
'What you just trained': 'आपने अभी क्या ट्रेन किया',
'Body diagram': 'शरीर आरेख',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 5f850c5e5..6f64dc200 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -605,7 +605,7 @@ export default {
'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',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 0554bc16d..dcd98f124 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -604,7 +604,7 @@ export default {
'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',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index e4462ef9e..a0165e4f3 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -604,7 +604,7 @@ export default {
'What this session hits': '이 세션이 자극하는 부위',
'Already worked': '이미 운동함',
'Still to come': '아직 남음',
- 'Muscle map in the header': '상단 근육 지도',
+ 'Muscle map at the top': '상단 근육 지도',
'A tiny body that lights up as you tick sets. Tap it for the details.': '세트를 완료할 때마다 밝아지는 작은 몸. 탭하면 자세히 볼 수 있어요.',
'What you just trained': '방금 훈련한 부위',
'Body diagram': '신체 도해',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index f71c06513..fd4be8897 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -604,7 +604,7 @@ export default {
'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',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 8c45ce295..c5dc10bdb 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -604,7 +604,7 @@ export default {
'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',
+ 'Muscle map at the top': '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',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 0709be40b..7c744ab8c 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -594,7 +594,7 @@ export default {
'What this session hits': 'Что задействует эта тренировка',
'Already worked': 'Уже проработано',
'Still to come': 'Ещё впереди',
- 'Muscle map in the header': 'Карта мышц вверху',
+ 'Muscle map at the top': 'Карта мышц вверху',
'A tiny body that lights up as you tick sets. Tap it for the details.': 'Маленькое тело, которое светлеет с каждым отмеченным подходом. Нажмите, чтобы увидеть детали.',
'What you just trained': 'Что вы только что тренировали',
'Body diagram': 'Схема тела',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index e8612a4c0..0d3872847 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -605,7 +605,7 @@ export default {
'What this session hits': 'ท่านี้ฝึกกล้ามเนื้อส่วนไหนบ้าง',
'Already worked': 'ฝึกไปแล้ว',
'Still to come': 'ยังเหลืออยู่',
- 'Muscle map in the header': 'แผนที่กล้ามเนื้อด้านบน',
+ 'Muscle map at the top': 'แผนที่กล้ามเนื้อด้านบน',
'A tiny body that lights up as you tick sets. Tap it for the details.': 'ร่างเล็ก ๆ ที่สว่างขึ้นทุกครั้งที่ติ๊กเซ็ต แตะเพื่อดูรายละเอียด',
'What you just trained': 'สิ่งที่เพิ่งฝึกไป',
'Body diagram': 'แผนภาพร่างกาย',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 1918c17b1..a69304806 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -604,7 +604,7 @@ export default {
'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ı',
+ 'Muscle map at the top': 'Ü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ı',
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 4e6e55039..4cd5a9c2d 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -430,7 +430,7 @@ export default {
'What this session hits': 'Що задіює це тренування',
'Already worked': 'Вже пропрацьовано',
'Still to come': 'Ще попереду',
- 'Muscle map in the header': 'Мапа м’язів угорі',
+ 'Muscle map at the top': 'Мапа м’язів угорі',
'A tiny body that lights up as you tick sets. Tap it for the details.': 'Маленьке тіло, що світлішає з кожним відміченим підходом. Торкніться, щоб побачити деталі.',
'What you just trained': 'Що ти щойно тренував',
'Body diagram': 'Схема тіла',
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 24680693a..fd1210dd8 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -593,7 +593,7 @@ export default {
'What this session hits': '本次訓練主要刺激肌群',
'Already worked': '已練到',
'Still to come': '還沒練',
- 'Muscle map in the header': '頂部肌肉圖',
+ 'Muscle map at the top': '頂部肌肉圖',
'A tiny body that lights up as you tick sets. Tap it for the details.': '一個小人,每完成一組就亮一點。點一下看詳情。',
'What you just trained': '剛才完成的鍛鍊肌群',
'Body diagram': '身體肌群分佈圖',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 887cd5a6f..5ae1a235c 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -604,7 +604,7 @@ export default {
'What this session hits': '这次训练练到哪里',
'Already worked': '已练到',
'Still to come': '还没练',
- 'Muscle map in the header': '顶部肌肉图',
+ 'Muscle map at the top': '顶部肌肉图',
'A tiny body that lights up as you tick sets. Tap it for the details.': '一个小人,每完成一组就亮一点。点一下看详情。',
'What you just trained': '你刚刚练了什么',
'Body diagram': '身体图示',
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index 2dd16e65e..3f5ac6246 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -617,9 +617,9 @@ 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)} />
+ {/* The live session's body (#670): at the end of the chip row, or in the header without it. */}
+ <Row icon="figureStrength" iconTint="var(--orange)" title={t('Muscle map at the top')} subtitle={t('A tiny body that lights up as you tick sets. Tap it for the details.')}>
+ <Switch aria-label={t('Muscle map at the top')} 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)} />
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 1966c5375..a65e19ff5 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -1934,8 +1934,12 @@ function ActiveWorkout() {
if (chip.unit.includes(cur)) return
update(s => { if (s.active) s.active.cur = chip.unit[0] })
}
+ // What the session hits so far (#670). It rides at the end of the chip row, which is taller
+ // than it and scrolls sideways anyway, so it costs no height; the header bar has no width to
+ // spare on a phone (a second line under the name). With the chips off it sits in the header.
+ const sessionMap = wc.muscleMap ? <SessionMapButton entries={A.entries} body={S.body} /> : null
const chipRow = wc.exerciseChips && A.entries.length > 0
- ? <WorkoutChips entries={A.entries} cur={listMode ? visibleExercise : cur} onPick={pickChip} />
+ ? <div className="wchips-row"><WorkoutChips entries={A.entries} cur={listMode ? visibleExercise : cur} onPick={pickChip} />{sessionMap}</div>
: null
// Hardware keys (issue #133, lib/workout-keys.js): Space or Enter ticks the next set, ← and →
@@ -2067,7 +2071,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} />}
+ {!chipRow && sessionMap}
<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
index 91ef7de1d..59f9c1a1a 100644
--- a/frontend/src/views/Workout.muscle-map.test.jsx
+++ b/frontend/src/views/Workout.muscle-map.test.jsx
@@ -44,8 +44,8 @@ function render(node = <MemoryRouter><Workout /></MemoryRouter>) {
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 headerMap = () => container.querySelector('[data-session-map]')
+const lastHeaderLevels = () => maps.filter(p => /bm-mini/.test(p.className)).at(-1)?.levels
const edit = fn => act(() => useStore.getState().update(fn))
afterEach(() => {
@@ -54,23 +54,32 @@ afterEach(() => {
useUI.setState({ sheets: [] })
})
-describe('Workout header muscle map (#670)', () => {
+describe('Workout 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 rides at the end of the exercise chips, not in the crowded header bar
+ expect(headerMap().closest('.wchips-row')).toBeTruthy()
+ expect(container.querySelector('.whdr-bar [data-session-map]')).toBeNull()
})
}
+ it('moves into the header bar when the exercise chips are off', () => {
+ setActive([entry(BENCH, [row(), row()])], { wc: { exerciseChips: false } })
+ render()
+ expect(container.querySelector('.whdr-bar [data-session-map]')).toBeTruthy()
+ })
+
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()[CHEST]).toBeGreaterThanOrEqual(3)
expect(lastHeaderLevels()[QUADS]).toBe(1)
})
diff --git a/frontend/src/views/settings-pages.test.jsx b/frontend/src/views/settings-pages.test.jsx
index 804cef53b..b258fd4d8 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', 'Muscle map in the header', '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 at the top', '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', () => {
@@ -306,7 +306,7 @@ describe('the pages', () => {
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"]')
+ const map = rowTitled('Muscle map at the top').querySelector('[role="switch"]')
expect(map.getAttribute('aria-checked')).toBe('true')
act(() => map.click())
expect(mocks.S.wc.muscleMap).toBe(false)