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.

Per-side holds: a 10 s Switch sides pause between left and right, equal Left/Right pills (#322)

Duarte Santos5fd7532a05fe
diff --git a/frontend/src/components/RestTimer.jsx b/frontend/src/components/RestTimer.jsx
index d218311e7..df700b29f 100644
--- a/frontend/src/components/RestTimer.jsx
+++ b/frontend/src/components/RestTimer.jsx
@@ -41,10 +41,14 @@ export default function RestTimer() {
// Pause sits between them as an icon (#193): it holds the time, it neither adds nor ends it.
// A rest that is over has nothing left to hold, so Ready offers no pause.
return (
- <div id="timer" className={'rest' + (timer.paused ? ' paused' : '')}>
+ <div id="timer" className={'rest' + (timer.paused ? ' paused' : '') + (timer.kind === 'switch' ? ' switch' : '')}>
<div className="head">
<div className="t" role={timer.ready ? 'status' : undefined}>{timer.ready ? t('Ready') : clock(timer.left)}</div>
- <div className="bar"><i style={{ width: pct + '%' }} /></div>
+ {/* The short pause between the two sides of a timed set says what it is for. */}
+ {timer.kind === 'switch' ? <div className="grow">
+ <div className="lbl">{t('Switch sides')}</div>
+ <div className="bar"><i style={{ width: pct + '%' }} /></div>
+ </div> : <div className="bar"><i style={{ width: pct + '%' }} /></div>}
</div>
<div className="acts">
<Button size="sm" icon="minus" onClick={() => addRest(-15)}>15s</Button>
diff --git a/frontend/src/components/RestTimer.ready.test.jsx b/frontend/src/components/RestTimer.ready.test.jsx
index 9af07ba35..c5f28cc7b 100644
--- a/frontend/src/components/RestTimer.ready.test.jsx
+++ b/frontend/src/components/RestTimer.ready.test.jsx
@@ -99,3 +99,17 @@ describe('RestTimer pause and resume', () => {
expect(pause()).toBeNull()
})
})
+
+describe('RestTimer switch-sides pause', () => {
+ it('names the pause, counts it down, and goes without a Ready or a toast', () => {
+ useUI.setState({ toastMsg: '' })
+ act(() => useUI.getState().startRest(10, 0, { kind: 'switch' }))
+ mount()
+ expect(host.querySelector('#timer.switch .lbl')?.textContent).toBe('Switch sides')
+ expect(host.querySelector('#timer .t').textContent).toBe('0:10')
+ act(() => vi.advanceTimersByTime(10_000))
+ expect(useUI.getState().timer).toBeNull()
+ expect(useUI.getState().toastMsg).toBe('')
+ expect(host.querySelector('#timer')).toBeNull()
+ })
+})
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 2e4710506..57441a956 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -523,6 +523,12 @@ h4.sec{
font-weight:500;text-transform:capitalize;
}
.tag.acc{background:var(--acc-soft);color:var(--acc)}
+/* Left / Right on a per-side row: one width for both (#322). The two hidden words share the
+ visible one's grid cell, so the pill is as wide as the longer word. */
+.tag.sidepill{display:inline-grid;justify-items:center;flex:none}
+.tag.sidepill>span,.tag.sidepill::before,.tag.sidepill::after{grid-area:1/1}
+.tag.sidepill::before{content:attr(data-l);visibility:hidden}
+.tag.sidepill::after{content:attr(data-r);visibility:hidden}
/* favourite marker (issue #6): a small yellow star glued to the exercise name — distinct from
the accent "chosen" tag at the row's end, which means "already in a routine or the log" */
.fav-star{color:var(--yellow);font-size:12px;display:inline-block;margin-inline-end:5px;vertical-align:-1px}
@@ -1262,6 +1268,9 @@ body.chips-dragging *{cursor:inherit}
#timer.rest .acts .skip{margin-inline-start:auto;min-width:84px}
/* A paused rest reads as held: the clock and the bar step back until it runs again. */
#timer.rest.paused .t,#timer.rest.paused .bar{opacity:.5}
+/* Switch sides: the short pause inside one timed per-side set, named above its bar. */
+#timer.rest.switch .grow{flex:1;min-width:0}
+#timer.rest.switch .lbl{font-size:12px;color:var(--label-2);margin-bottom:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* work timer (issue #16): the same bar doing the opposite job — outlined and tinted so a
glance tells "you are holding this" apart from "you are recovering". */
#timer.working{border:var(--hair) solid var(--acc)}
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 34d8d8e23..8963ce0ed 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1845,4 +1845,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'الأعذار لا ترفع الأوزان. احضر غدًا إلى {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': 'عضلاتك أبلغت عن فقدانك. احضر إلى {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'هذا العنوان يستجيب، لكنه ليس خادم openGym. تحقّق من الرابط.',
+ 'Switch sides': 'بدّل الجهة',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index dd6c8d4c7..69dd8b1c9 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1812,4 +1812,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Ausreden stemmen keine Gewichte. Morgen trittst du zu {0} an!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Deine Muskeln haben eine Vermisstenanzeige aufgegeben. Antreten zu {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Unter dieser Adresse antwortet etwas, aber kein openGym-Server. Prüf die URL.',
+ 'Switch sides': 'Seite wechseln',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 67ed26f5a..b7c0c6315 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Las excusas no levantan pesas. ¡Mañana te presentas a {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Tus músculos pusieron una denuncia por desaparición. ¡Preséntate a {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Esa dirección responde, pero no es un servidor de openGym. Revisa la URL.',
+ 'Switch sides': 'Cambia de lado',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 8f4a3bdc2..700e2e74d 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Les excuses ne soulèvent pas de poids. Présentez-vous demain pour {0} !',
'Your muscles filed a missing-person report. Show up for {0}!': 'Vos muscles ont signalé votre disparition. Présentez-vous pour {0} !',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Cette adresse répond, mais ce n’est pas un serveur openGym. Vérifie l’URL.',
+ 'Switch sides': 'Change de côté',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 6ecc13194..f57a8f31b 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'बहाने वज़न नहीं उठाते। कल {0} के लिए हाज़िर हो!',
'Your muscles filed a missing-person report. Show up for {0}!': 'आपकी मांसपेशियों ने गुमशुदगी की रिपोर्ट लिखाई है। {0} के लिए हाज़िर हो!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'यह पता जवाब देता है, लेकिन यह openGym सर्वर नहीं है। URL जाँचें।',
+ 'Switch sides': 'साइड बदलें',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 57ac01e87..fa54d75c3 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1795,4 +1795,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'A kifogások nem emelnek súlyt. Holnap jelentkezel: {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Az izmaid eltűntként jelentettek. Jelentkezz: {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Ez a cím válaszol, de nem openGym-szerver. Ellenőrizd az URL-t.',
+ 'Switch sides': 'Oldalcsere',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index a3e437fc9..2b7e3f4cc 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Le scuse non sollevano pesi. Domani ti presenti a {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': 'I tuoi muscoli hanno denunciato la tua scomparsa. Presentati a {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Quell’indirizzo risponde, ma non è un server openGym. Controlla l’URL.',
+ 'Switch sides': 'Cambia lato',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 74483df5c..cea165f2a 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': '핑계는 무게를 들지 않는다. 내일 {0}에 집합!',
'Your muscles filed a missing-person report. Show up for {0}!': '근육들이 실종 신고를 냈다. {0}에 출석하라!',
'That address answers, but it isn’t an openGym server. Check the URL.': '이 주소는 응답하지만 openGym 서버가 아닙니다. URL을 확인하세요.',
+ 'Switch sides': '방향 바꾸기',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index fc4f91240..0ef55d851 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Wymówki nie podnoszą ciężarów. Jutro meldujesz się na „{0}”!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Twoje mięśnie zgłosiły twoje zaginięcie. Stawić się na „{0}”!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Ten adres odpowiada, ale to nie jest serwer openGym. Sprawdź URL.',
+ 'Switch sides': 'Zmień stronę',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 0c9cd2f68..2c64f6d35 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1113,6 +1113,7 @@ export const PT_BR_OVERRIDES = {
'{1} animated exercises + 1 of your own': '{1} exercícios animados + 1 seu',
'{1} animated exercises + {0} of your own': '{1} exercícios animados + {0} seus',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Esse endereço responde, mas não é um servidor openGym. Verifique a URL.',
+ 'Switch sides': 'Troque de lado',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 35d7d9fe7..9684a4136 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Desculpas não levantam pesos. Amanhã apresentas-te para {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Os teus músculos deram-te como desaparecido. Apresenta-te para {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Esse endereço responde, mas não é um servidor openGym. Verifica o URL.',
+ 'Switch sides': 'Troca de lado',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 954279df1..d58cbf485 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1796,4 +1796,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Отговорки не поднимают веса. Завтра явиться на «{0}»!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Ваши мышцы подали заявление о пропаже. Явиться на «{0}»!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'По этому адресу что-то отвечает, но это не сервер openGym. Проверьте URL.',
+ 'Switch sides': 'Смените сторону',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 269dc95df..cb23c921c 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1803,4 +1803,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'ข้ออ้างยกน้ำหนักไม่ได้ พรุ่งนี้มารายงานตัวที่ {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': 'กล้ามเนื้อของคุณแจ้งคนหายแล้ว มารายงานตัวที่ {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'ที่อยู่นี้ตอบกลับ แต่ไม่ใช่เซิร์ฟเวอร์ openGym ตรวจสอบ URL อีกครั้ง',
+ 'Switch sides': 'สลับข้าง',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 67cc2b646..65742c1e6 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Bahaneler ağırlık kaldırmaz. Yarın {0} için hazır ol!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Kasların kayıp ilanı verdi. {0} için içtimaya gel!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Bu adres yanıt veriyor ama bir openGym sunucusu değil. URL’yi kontrol et.',
+ 'Switch sides': 'Taraf değiştir',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 36dfac22d..5a1971fd1 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1789,4 +1789,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': 'Відмовки не піднімають ваги. Завтра з’явитися на «{0}»!',
'Your muscles filed a missing-person report. Show up for {0}!': 'Твої м’язи заявили про твоє зникнення. З’явитися на «{0}»!',
'That address answers, but it isn’t an openGym server. Check the URL.': 'Ця адреса відповідає, але це не сервер openGym. Перевір URL.',
+ 'Switch sides': 'Зміни сторону',
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index d75de756e..fba63b373 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -1785,4 +1785,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': '藉口舉不起重量。明天準時報到練 {0}!',
'Your muscles filed a missing-person report. Show up for {0}!': '你的肌肉已經報案協尋你了。馬上來練 {0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': '這個位址有回應,但不是 openGym 伺服器。請檢查網址。',
+ 'Switch sides': '換邊',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 6e5a43e56..370bfef62 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1792,4 +1792,5 @@ export default {
'Excuses don’t lift weights. Report for {0} tomorrow!': '借口举不起重量。明天准时报到练{0}!',
'Your muscles filed a missing-person report. Show up for {0}!': '你的肌肉已经报了失踪。马上来练{0}!',
'That address answers, but it isn’t an openGym server. Check the URL.': '该地址有响应,但不是 openGym 服务器。请检查网址。',
+ 'Switch sides': '换边',
}
diff --git a/frontend/src/store/useUI.js b/frontend/src/store/useUI.js
index d7ff54fc0..a244fc913 100644
--- a/frontend/src/store/useUI.js
+++ b/frontend/src/store/useUI.js
@@ -18,14 +18,17 @@ const cancelPushRestTimer = () => { if (useStore.getState().user) api('/api/push
// Books the end of a rest with whatever can announce it while the app is not looking: in the
// Android app a native alarm and the countdown notification, everywhere else (and wherever that
// alarm could not be set) the server's push. The web build books the push at once, as before.
-const bookRestEnd = (endsAt, totalSec) => {
- if (!MOBILE) { pushRestTimer(Math.max(1, Math.round((endsAt - Date.now()) / 1000))); return }
+// A switch-sides pause (Workout.jsx SWITCH_SIDES_SEC) books no server push, whose words are "rest over":
+// it is ten seconds between the two sides of a hold, and the app is in your hand.
+const bookRestEnd = (endsAt, totalSec, kind) => {
+ const switching = kind === 'switch'
+ if (!MOBILE) { if (!switching) pushRestTimer(Math.max(1, Math.round((endsAt - Date.now()) / 1000))); return }
const { S } = useStore.getState()
- armRestAlert(endsAt, { title: t('Rest’s over. Next set!'), countdownTitle: t('Rest'), totalSec, accent: S.accent, sound: !!S.sound, vibrate: S.vibrate !== false, alarmBuzz: S.vibrate !== false && !!S.vibrateOnSilent })
+ armRestAlert(endsAt, { title: switching ? t('Switch sides') : t('Rest’s over. Next set!'), countdownTitle: switching ? t('Switch sides') : t('Rest'), totalSec, accent: S.accent, sound: !!S.sound, vibrate: S.vibrate !== false, alarmBuzz: S.vibrate !== false && !!S.vibrateOnSilent })
.then(ok => {
// Only for the rest that asked: one skipped or moved since then has booked its own end.
const tm = useUI.getState().timer
- if (!ok && tm && !tm.paused && !tm.ready && tm.endsAt === endsAt) pushRestTimer(Math.max(1, Math.round((endsAt - Date.now()) / 1000)))
+ if (!ok && !switching && tm && !tm.paused && !tm.ready && tm.endsAt === endsAt) pushRestTimer(Math.max(1, Math.round((endsAt - Date.now()) / 1000)))
})
}
@@ -94,6 +97,14 @@ const runRest = (set, get) => {
if (!document.hidden) pageHiddenAt = null
if (left === tm.left) return
const { sound: snd, classicChime } = useStore.getState().S
+ if (left <= 0 && tm.kind === 'switch') {
+ // Over like a hold is: the chime and its buzz, then the bar goes. No "Ready", no toast:
+ // the other side is the next thing, one tap away.
+ if (seenLive) { chime(snd, classicChime); alertBuzz([200, 100, 200]); get().flashTimer() }
+ stopRestTicking()
+ set({ timer: null })
+ return
+ }
if (left <= 0) {
if (seenLive) {
// The Android alarm for this end stays quiet while the app is on screen, so this chime is
@@ -123,7 +134,8 @@ const runRest = (set, get) => {
export const useUI = create((set, get) => ({
sheets: [], // { id, render:(close)=>JSX, kind:'sheet'|'center', locked }
toastMsg: '',
- timer: null, // rest countdown between sets — { left, total, endsAt, forIdx, ready?, paused? }
+ timer: null, // rest countdown between sets — { left, total, endsAt, forIdx, ready?, paused?, kind? }
+ // kind: 'switch' for the short pause between the two sides of a timed set
// forIdx: index of the active entry whose set started the rest (undefined when unknown)
// paused: held at `left`; `endsAt` means nothing until resumeRest sets it again
work: null, // work countdown DURING a timed set (issue #16) — { left, total, endsAt, label, overtime? }
@@ -149,7 +161,7 @@ export const useUI = create((set, get) => ({
toastTm = setTimeout(() => set({ toastMsg: '' }), 2200)
},
- startRest(sec, forIdx) {
+ startRest(sec, forIdx, { kind } = {}) {
get().stopRest()
// Rest timer set to Off. Stopping and returning rather than starting a zero-length timer
// keeps every caller honest: the four places that start a rest do not each need to know.
@@ -169,8 +181,8 @@ export const useUI = create((set, get) => ({
// with no beep, no vibration and no flash. Each timer starts from where the page is now.
pageHiddenAt = document.hidden ? Date.now() : null
const endsAt = Date.now() + sec * 1000
- set({ timer: { left: sec, total: sec, endsAt, forIdx } })
- bookRestEnd(endsAt, sec)
+ set({ timer: { left: sec, total: sec, endsAt, forIdx, ...(kind === 'switch' ? { kind } : {}) } })
+ bookRestEnd(endsAt, sec, kind)
runRest(set, get)
},
// Holding the rest where it is — a longer break than planned, a machine to wait for, a phone
@@ -198,7 +210,7 @@ export const useUI = create((set, get) => ({
pageHiddenAt = document.hidden ? Date.now() : null
const endsAt = Date.now() + tm.left * 1000
set({ timer: { ...rest, endsAt } })
- bookRestEnd(endsAt, tm.total)
+ bookRestEnd(endsAt, tm.total, tm.kind)
runRest(set, get)
},
addRest(sec) {
@@ -214,7 +226,7 @@ export const useUI = create((set, get) => ({
if (tm.paused) { set({ timer: { ...tm, left, total: tm.total + sec } }); holdRestAlert(left, tm.total + sec); return }
const endsAt = tm.endsAt + sec * 1000
set({ timer: { ...tm, left, total: tm.total + sec, endsAt } })
- bookRestEnd(endsAt, tm.total + sec)
+ bookRestEnd(endsAt, tm.total + sec, tm.kind)
},
// The active list changed shape (an exercise removed or inserted at `at`): keep the rest
// pointing at the same exercise. Returns nothing; the caller decides whether to stop instead.
@@ -230,13 +242,14 @@ export const useUI = create((set, get) => ({
followNativeRest({ endsAt, left, total, paused }) {
const tm = get().timer
const forIdx = tm?.forIdx
+ const kind = tm?.kind === 'switch' ? { kind: 'switch' } : {}
if (paused) {
stopRestTicking()
- set({ timer: { left, total, endsAt, forIdx, paused: true } })
+ set({ timer: { left, total, endsAt, forIdx, ...kind, paused: true } })
return
}
const ticking = !!timerInt && !!tm && !tm.paused && !tm.ready
- set({ timer: { left, total, endsAt, forIdx } })
+ set({ timer: { left, total, endsAt, forIdx, ...kind } })
if (ticking) return
// As in resumeRest: a hide from while it was held or over is no catch-up of this countdown.
pageHiddenAt = document.hidden ? Date.now() : null
diff --git a/frontend/src/views/Workout.hold.test.jsx b/frontend/src/views/Workout.hold.test.jsx
index 93de2d7df..52b4841a3 100644
--- a/frontend/src/views/Workout.hold.test.jsx
+++ b/frontend/src/views/Workout.hold.test.jsx
@@ -83,3 +83,47 @@ describe('the end of a hold', () => {
expect(vibrate).toHaveBeenLastCalledWith(30)
})
})
+
+// Owner's call: a timed per-side set pauses ten seconds to switch sides between its left and
+// right hold, and rests in full only once both are held.
+describe('a per-side hold', () => {
+ const sidePlank = () => ({ id: '1001', target: { mode: 'time', sets: 2, sec: 10, side: true }, sets: [
+ { sec: 10, w: 0, done: false, side: 'L' }, { sec: 10, w: 0, done: false, side: 'R' },
+ { sec: 10, w: 0, done: false, side: 'L' }, { sec: 10, w: 0, done: false, side: 'R' },
+ ] })
+ const holdRow = n => {
+ const go = container.querySelectorAll('button[aria-label="Start set"]')[n]
+ act(() => go.click())
+ act(() => { vi.advanceTimersByTime(11_000) })
+ }
+
+ it('left held: a 10 s "Switch sides" countdown, which ends with the chime and goes', () => {
+ renderWorkout([sidePlank()])
+ holdRow(0)
+ expect(doneOf()).toEqual([true, false, false, false])
+ const tm = useUI.getState().timer
+ expect(tm).toMatchObject({ kind: 'switch', total: 10 })
+ expect(chime).toHaveBeenCalledTimes(1)
+ act(() => { vi.advanceTimersByTime(10_000) })
+ expect(useUI.getState().timer).toBeNull()
+ expect(chime).toHaveBeenCalledTimes(2)
+ expect(alertBuzz).toHaveBeenCalledTimes(2)
+ })
+
+ it('right held too: the set\'s full rest, not another switch', () => {
+ renderWorkout([sidePlank()])
+ holdRow(0)
+ holdRow(1)
+ expect(doneOf()).toEqual([true, true, false, false])
+ const tm = useUI.getState().timer
+ expect(tm.kind).toBeUndefined()
+ expect(tm.total).toBe(useStore.getState().S.restSec)
+ })
+
+ it('Left and Right pills carry both words, so they are one width (#322)', () => {
+ renderWorkout([sidePlank()])
+ const pills = [...container.querySelectorAll('.sidepill')]
+ expect(pills.map(p => p.textContent)).toEqual(['Left', 'Right', 'Left', 'Right'])
+ for (const p of pills) expect([p.dataset.l, p.dataset.r]).toEqual(['Left', 'Right'])
+ })
+})
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 23538c31a..5bb682997 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -96,6 +96,10 @@ const RTL_LETTER = /[֐-ࣿיִ-﷿ﹰ-]/
// "last time" recap and the progression line — leaving the name, the ⋯ menu, the one-line plan
// the rows are measured against, and the sets.
// Nothing dropped is lost: it is all still on the ⋯ menu, or one ⋮ switch back to list/cards.
+// The pause between the left and the right side of one timed per-side set (owner's call): long
+// enough to turn over, far shorter than the rest the set earns once both sides are held.
+const SWITCH_SIDES_SEC = 10
+
function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSide, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef, onProgressionSettings, onNoProg, routineUpdate, onSwap, onMoveUp, onMoveDown, canMoveUp, canMoveDown, onRemoveExercise, busy }) {
const S = useStore(s => s.S)
const update = useStore(s => s.update)
@@ -608,7 +612,10 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
) : (
<div ref={el => onSetRowRef?.(i, el)} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' eff3' : '') + (timed ? ' timed' : '')}>
<button type="button" className="n" aria-label={sideTagOf(s) ? t('Set {0} ({1})', setNumOf(s, i), sideTagOf(s)) : t('Set {0}', setNumOf(s, i))} title={t('More')} onClick={() => openSetMenu(s, i)}>{setNumOf(s, i)}</button>
- {sideTagOf(s) && <span className="tag acc nocap">{sideTagOf(s)}</span>}
+ {/* Both words sit in the pill's one grid cell (::before/::after, hidden), so Left and
+ Right are as wide as the longer of the two in every language and the inputs
+ after them line up (#322). */}
+ {sideTagOf(s) && <span className="tag acc nocap sidepill" data-l={t('Left')} data-r={t('Right')}><span>{sideTagOf(s)}</span></span>}
{cell(s, i, col1, 'w')}
{col2 && cell(s, i, col2, 'r')}
{col3 && effortCell(s, i, col3)}
@@ -1278,6 +1285,18 @@ function ActiveWorkout() {
return
}
+ // Between the two sides of one timed per-side set (a side plank's left, then its right):
+ // a short "Switch sides" pause instead of the set's whole rest, which comes once both
+ // sides are held (owner's call). A rest switched Off stays off.
+ const rows = fresh.entries[idx].sets
+ const sideOf = r => r && !isWarmupRow(r) ? r.side : null
+ const partner = sideOf(rows[i]) === 'L' && sideOf(rows[i + 1]) === 'R' ? rows[i + 1]
+ : sideOf(rows[i]) === 'R' && sideOf(rows[i - 1]) === 'L' ? rows[i - 1] : null
+ if (m === 'time' && partner && !partner.done && restAfter > 0) {
+ startRest(Math.min(SWITCH_SIDES_SEC, restAfter), idx, { kind: 'switch' })
+ return
+ }
+
// Singleton units are ordinary exercises: they rest between sets and after the closing
// one unless the next unit has an unfinished warm-up, and never enter superset navigation.
// stopRest() first so a rest that belongs after this set replaces the one that was running.