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
feat(live-activity): Next exercise and Skip rest events, units and unitStarts, Log set label (page side)
Duarte Santose05ac71dd98a
diff --git a/frontend/src/lib/live-activity.js b/frontend/src/lib/live-activity.jsindex c115e5fca..3ec221288 100644--- a/frontend/src/lib/live-activity.js+++ b/frontend/src/lib/live-activity.js@@ -14,6 +14,10 @@// a tap in the app runs (rest timer, the high-water mark, the end-of-workout sheet), never a second// copy of it. Each event is applied once, by its id, and only then acknowledged, which takes it out// of the native queue; until the workout screen is there to apply it, it waits there.+// Next to Done sits one smaller button: Skip rest while a rest runs ({ type: 'restSkip', wid, at }),+// otherwise Next exercise ({ type: 'next', wid, fromEntryIdx, at }), which moves on to the next+// exercise without ticking anything (Discord: Done read like "finish", and there was no way to+// leave a machine somebody else took). The native side moves the activity on by itself for both.//// Text only: no exercise animations or pictures (Gym visual licence). iPhone app only.import { MOBILE, nativePlatform } from './mobile.js'@@ -22,16 +26,21 @@ import { t } from './i18n.js'import { exerciseNameText } from './format.js'import { setLabel, supersetUnits } from './history.js'import { isWarmupRow } from './workout-model.js'-import { restSecFor } from './supersetFlow.js'+import { nextUnfinishedUnit, restSecFor } from './supersetFlow.js'import { speedUnitOf } from './speed.js'import { accentPair, accentValue } from './accent.js'-export const LIVE_VERSION = 1+export const LIVE_VERSION = 2const APPLIED_KEY = 'gym_live_applied'const APPLIED_MAX = 300const SEND_DEBOUNCE_MS = 300// The sets after the current one the activity carries, so its Done can move on without the page.export const LIVE_AHEAD = 8+// The first open set of this many later exercises, so Next exercise works without the page too.+export const LIVE_UNITS = 4+// ActivityKit drops an update over 4 KB. Long names in a script with 3-byte letters can get there,+// so the farthest sets go first until it fits (the page sends a fresh list after every tick anyway).+const LIVE_BUDGET = 3600const num = v => (typeof v === 'number' && Number.isFinite(v) ? v : null)@@ -56,13 +65,13 @@ export function upcomingSets (S) {try { rest = restSecFor(A.entries, unit, num(S.restSec) || 0) || 0 } catch { rest = num(S.restSec) || 0 }for (let r = 0; r < rounds; r++) {const inRound = unit.filter(i => { const s = A.entries[i]?.sets?.[r]; return s && !s.done })- inRound.forEach((i, k) => out.push({ entryIdx: i, setIdx: r, restAfter: k === inRound.length - 1 ? rest : 0 }))+ inRound.forEach((i, k) => out.push({ entryIdx: i, setIdx: r, restAfter: k === inRound.length - 1 ? rest : 0, unit: unit[0] }))}}return out}-function setView (S, A, { entryIdx, setIdx, restAfter }) {+function setView (S, A, { entryIdx, setIdx, restAfter, unit }) {const e = A.entries[entryIdx]const s = e.sets[setIdx]const target = e.target || {}@@ -81,9 +90,23 @@ function setView (S, A, { entryIdx, setIdx, restAfter }) {setLine: warmup ? t('Warm-up') + ' ' + n : t('Set {0} of {1}', n, work.length),target: label,restAfter: Math.max(0, Math.round(restAfter || 0)),+ // The superset unit's first entry: Next exercise moves on to the next set with another one.+ unit: Number.isInteger(unit) ? unit : entryIdx,}}+const bytes = o => new TextEncoder().encode(JSON.stringify(o)).length++/** Trims the farthest sets, then the farthest exercises, until the activity fits ActivityKit's 4 KB. */+function fitLive (live) {+ const st = live.state+ while (bytes(live) > LIVE_BUDGET && (st.ahead.length || st.unitStarts.length)) {+ if (st.ahead.length > st.unitStarts.length) st.ahead.pop()+ else st.unitStarts.pop()+ }+ return live+}+/*** The activity's fixed part (`attributes`: what stays the same for the workout) and its state, or* null when no workout is running here. `timer` is the rest as useUI holds it.@@ -96,7 +119,14 @@ export function buildLiveActivity (S, timer = null) {for (const e of A.entries) for (const s of e?.sets || []) { total++; if (s?.done) done++ }const rest = timer && !timer.ready && timer.kind !== 'switch' ? timer : nullconst pair = accentPair(accentValue(S))- return {+ // The first open set of each exercise after the current one, in the order the sets come.+ const starts = []+ for (const x of next) {+ if (x.unit === next[0].unit || starts.some(y => y.unit === x.unit)) continue+ if (starts.length >= LIVE_UNITS) break+ starts.push(x)+ }+ return fitLive({attributes: {v: LIVE_VERSION,wid: String(A.id || ''),@@ -104,32 +134,61 @@ export function buildLiveActivity (S, timer = null) {accent: pair.accent,ink: pair.ink,labels: {- done: t('Done'),+ // "Log set", not "Done": it ticks the set, and "Done" read like finishing the workout.+ done: t('Log set'),rest: t('Rest'),next: t('Up next'),allDone: t('All sets done'),restOver: t('Rest’s over. Next set!'),+ nextExercise: t('Next exercise'),+ skipRest: t('Skip rest'),+ // Sets are left, but the activity ran past the ones it carries (many taps, page asleep).+ openApp: t('Open openGym for the next set'),},},state: {name: A.name || '',cur: next.length ? setView(S, A, next[0]) : null,ahead: next.slice(1, 1 + LIVE_AHEAD).map(x => setView(S, A, x)),+ unitStarts: starts.map(x => setView(S, A, x)),restEndsAt: rest && !rest.paused ? num(rest.endsAt) : null,restLeft: rest && rest.paused ? num(rest.left) : null,restTotal: rest ? num(rest.total) : null,done,total,},- }+ })}/* ---------- applying the activity's events ---------- */-let handlers = null // the workout screen's: setDone+let handlers = null // the workout screen's: setDone, next, restSkip, timerconst readApplied = () => { try { return JSON.parse(localStorage.getItem(APPLIED_KEY)) || [] } catch { return [] } }const writeApplied = ids => { try { localStorage.setItem(APPLIED_KEY, JSON.stringify(ids.slice(-APPLIED_MAX))) } catch { /* the queue's ack is what counts */ } }+/**+ * Where Next exercise from `fromEntryIdx` goes: the first entry of the next unit with sets open, as+ * the workout screen's own Next would. null when the page already moved off that unit (an event+ * applied twice, or a tick that advanced by itself) or nothing else is open.+ */+export function nextExerciseTarget (A, fromEntryIdx) {+ if (!A || !Array.isArray(A.entries) || !Number.isInteger(fromEntryIdx)) return null+ const units = supersetUnits(A.entries)+ const from = units.find(u => u.includes(fromEntryIdx))+ if (!from || !from.includes(A.cur || 0)) return null+ const to = nextUnfinishedUnit(A.entries, units, fromEntryIdx)+ return to && to !== from ? to[0] : null+}++/** Whether Skip rest tapped at `at` is about this rest: one started after the tap is a new one. */+export function restSkipApplies (timer, at) {+ if (!timer || timer.kind === 'switch') return false+ if (timer.paused || timer.ready || !num(at)) return true+ const started = num(timer.endsAt) != null && num(timer.total) != null ? timer.endsAt - timer.total * 1000 : null+ // A second of slack: the page restarts a rest it hears of late from the tap's own time.+ return started == null || started <= at + 1000+}+function entryIndexOf (A, ev) {if (A.entries[ev.entryIdx] && String(A.entries[ev.entryIdx].id) === String(ev.exId)) return ev.entryIdxreturn A.entries.findIndex(e => String(e.id) === String(ev.exId))@@ -154,6 +213,13 @@ export function applyLiveEvents (events, getState) {const idx = entryIndexOf(A, ev)const set = idx >= 0 ? A.entries[idx].sets?.[ev.setIdx] : nullif (set && !set.done) handlers.setDone(idx, ev.setIdx, { at: num(ev.at) })+ } else if (ev.type === 'next' && ours) {+ if (!handlers) break+ const to = nextExerciseTarget(A, ev.fromEntryIdx)+ if (to != null) handlers.next?.(to)+ } else if (ev.type === 'restSkip' && ours) {+ if (!handlers) break+ if (restSkipApplies(handlers.timer?.(), num(ev.at))) handlers.restSkip?.()}// Applied, or meaningless now (another workout, a set that is gone or already ticked).applied.push(ev.id)@@ -199,7 +265,7 @@ export function drainLiveEvents () {return draining}-/** The workout screen hands over its own tick while it is mounted. Returns the unbind. */+/** The workout screen hands over its own tick (and Next, Skip rest) while it is mounted. Returns the unbind. */export function bindLiveActions (h) {handlers = hdrainLiveEvents()diff --git a/frontend/src/lib/live-activity.test.js b/frontend/src/lib/live-activity.test.jsindex fac40b6f1..589f056d7 100644--- a/frontend/src/lib/live-activity.test.js+++ b/frontend/src/lib/live-activity.test.js@@ -34,8 +34,8 @@ describe('buildLiveActivity', () => {it('shows the set to do now, the few after it, and how far along the session is', () => {const live = L.buildLiveActivity(S(A))- expect(live.attributes).toMatchObject({ v: 1, wid: 'w1', start: 1000, accent: '#30d158' })- for (const k of ['done', 'rest', 'next', 'allDone', 'restOver']) expect(typeof live.attributes.labels[k], k).toBe('string')+ expect(live.attributes).toMatchObject({ v: 2, wid: 'w1', start: 1000, accent: '#30d158' })+ for (const k of ['done', 'rest', 'next', 'allDone', 'restOver', 'nextExercise', 'skipRest', 'openApp']) expect(typeof live.attributes.labels[k], k).toBe('string')expect(live.state.name).toBe('Push')expect(live.state.cur).toMatchObject({ exId: '0025', entryIdx: 0, setIdx: 1, setLine: 'Set 2 of 3', restAfter: 120 })expect(live.state.cur.target).toMatch(/62[.,]5/)@@ -55,6 +55,38 @@ describe('buildLiveActivity', () => {const all = { ...A, entries: A.entries.map(e => ({ ...e, sets: e.sets.map(s => ({ ...s, done: true })) })) }expect(L.buildLiveActivity(S(all)).state).toMatchObject({ cur: null, ahead: [], done: 4, total: 4 })})+ it('says Log set, not Done, so it does not read like finishing the workout (Discord)', () => {+ expect(L.buildLiveActivity(S(A)).attributes.labels.done).toBe('Log set')+ })+ it('tags each set with its exercise unit and carries the first open set of the next exercises', () => {+ const W = { id: 'w2', cur: 1, entries: [+ entry('0025', [set({ done: true }), set()]),+ entry('0043', [set(), set()], { sg: 'g' }), entry('0001', [set(), set()], { sg: 'g' }),+ entry('0100', [set({ done: true })]),+ entry('0200', [set(), set()]),+ ] }+ const st = L.buildLiveActivity(S(W)).state+ // the superset (entries 1 and 2) is one unit, named by its first entry+ expect(st.cur).toMatchObject({ entryIdx: 1, setIdx: 0, unit: 1 })+ expect(st.ahead[0]).toMatchObject({ entryIdx: 2, setIdx: 0, unit: 1 })+ // entry 3 has nothing open; after the last one it wraps round to the first+ expect(st.unitStarts.map(x => [x.unit, x.entryIdx, x.setIdx])).toEqual([[4, 4, 0], [0, 0, 1]])+ })+ it('carries no next exercise when the current one is the only one with sets open', () => {+ const W = { id: 'w2', cur: 0, entries: [entry('0025', [set(), set()]), entry('0043', [set({ done: true })])] }+ expect(L.buildLiveActivity(S(W)).state.unitStarts).toEqual([])+ })+ it('stays inside ActivityKit\'s 4 KB with long names, dropping the farthest sets first', () => {+ const long = 'ท่าบริหารกล้ามเนื้อที่ยาวมากเป็นพิเศษ'.repeat(3)+ const W = { id: 'w3', cur: 0, entries: Array.from({ length: 10 }, (_, k) => entry('x' + k, [set(), set(), set()], { target: { name: long + k, mode: 'reps' } })) }+ const live = L.buildLiveActivity(S(W))+ expect(new TextEncoder().encode(JSON.stringify(live)).length).toBeLessThanOrEqual(3600)+ expect(live.state.cur).toBeTruthy()+ expect(live.state.unitStarts.length).toBeGreaterThan(0)+ const short = L.buildLiveActivity(S({ ...W, entries: W.entries.map(e => ({ ...e, target: { mode: 'reps' } })) }))+ expect(short.state.ahead).toHaveLength(L.LIVE_AHEAD)+ expect(short.state.unitStarts).toHaveLength(L.LIVE_UNITS)+ })it('is null without a running workout, and for a saved one being edited', () => {expect(L.buildLiveActivity(S(null))).toBeNull()expect(L.buildLiveActivity(S({ ...A, editingWorkoutId: 'w0' }))).toBeNull()@@ -123,6 +155,76 @@ describe('the Done taps', () => {})})+describe('Next exercise and Skip rest', () => {+ let state, calls, timer+ const A = () => ({ id: 'w1', cur: 0, entries: [entry('0025', [set(), set()]), entry('0043', [set({ done: true })]), entry('0001', [set()])] })+ const getState = () => ({ S: state })+ let unbind = null+ const bind = () => {+ unbind = L.bindLiveActions({+ setDone: (idx, i) => { calls.push(['setDone', idx, i]); state.active.entries[idx].sets[i].done = true },+ next: idx => { calls.push(['next', idx]); state.active.cur = idx },+ restSkip: () => { calls.push(['restSkip']); timer = null },+ timer: () => timer,+ })+ }+ beforeEach(() => { localStorage.clear(); L._resetLiveActivity(); state = S(A()); calls = []; timer = null })+ afterEach(() => { unbind?.(); unbind = null })++ it('moves on to the next exercise with sets open, without ticking, and only once', () => {+ bind()+ const ev = { id: 'n1', type: 'next', wid: 'w1', fromEntryIdx: 0, at: 1 }+ expect(L.applyLiveEvents([ev], getState)).toEqual(['n1'])+ expect(L.applyLiveEvents([{ ...ev, id: 'n2' }], getState)).toEqual(['n2'])+ // the second tap was from exercise 0, which the page already left: nothing happens+ expect(calls).toEqual([['next', 2]])+ expect(state.active.entries.flatMap(e => e.sets).filter(s => s.done)).toHaveLength(1)+ })+ it('ignores a Next for another workout, and one with nowhere to go', () => {+ bind()+ L.applyLiveEvents([{ id: 'n1', type: 'next', wid: 'old', fromEntryIdx: 0 }], getState)+ state.active.entries[2].sets[0].done = true+ L.applyLiveEvents([{ id: 'n2', type: 'next', wid: 'w1', fromEntryIdx: 0 }], getState)+ expect(calls).toEqual([])+ })+ it('applies a Next after the Done taps before it, in order', () => {+ bind()+ L.applyLiveEvents([+ { id: 'd1', type: 'setDone', wid: 'w1', exId: '0025', entryIdx: 0, setIdx: 0, at: 1 },+ { id: 'n1', type: 'next', wid: 'w1', fromEntryIdx: 0, at: 2 },+ ], getState)+ expect(calls).toEqual([['setDone', 0, 0], ['next', 2]])+ })+ it('skips the rest the tap was about, not one that started after it', () => {+ bind()+ const now = 1_000_000+ timer = { endsAt: now + 60_000, total: 90, left: 60 } // started 30 s before now+ L.applyLiveEvents([{ id: 's1', type: 'restSkip', wid: 'w1', at: now }], getState)+ expect(calls).toEqual([['restSkip']])+ timer = { endsAt: now + 90_000 + 20_000, total: 90, left: 90 } // started 20 s after the tap+ L.applyLiveEvents([{ id: 's2', type: 'restSkip', wid: 'w1', at: now }], getState)+ L.applyLiveEvents([{ id: 's1', type: 'restSkip', wid: 'w1', at: now + 30_000 }], getState)+ expect(calls).toHaveLength(1)+ expect(timer).not.toBeNull()+ })+ it('leaves a side switch and another workout\'s rest alone, and has nothing to skip without a rest', () => {+ bind()+ timer = { endsAt: 5000, total: 5, left: 5, kind: 'switch' }+ L.applyLiveEvents([{ id: 's1', type: 'restSkip', wid: 'w1', at: 9000 }], getState)+ timer = { endsAt: 5000, total: 5, left: 5 }+ L.applyLiveEvents([{ id: 's2', type: 'restSkip', wid: 'old', at: 9000 }], getState)+ expect(calls).toEqual([])+ expect(L.restSkipApplies(null, 1)).toBe(false)+ expect(L.restSkipApplies({ left: 30, total: 90, paused: true }, 1)).toBe(true)+ })+ it('keeps them queued until the workout screen is there', () => {+ const evs = [{ id: 'n1', type: 'next', wid: 'w1', fromEntryIdx: 0 }, { id: 's1', type: 'restSkip', wid: 'w1', at: 1 }]+ expect(L.applyLiveEvents(evs, getState)).toEqual([])+ bind()+ expect(L.applyLiveEvents(evs, getState)).toEqual(['n1', 's1'])+ })+})+describe('startLiveActivitySync', () => {let state, timer, storeSubs, uiSubs, callsconst useStore = { getState: () => ({ S: state }), subscribe: fn => { storeSubs.push(fn); return () => {} } }diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex e8121d0ce..cf8880c3a 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -2383,6 +2383,10 @@ export default {'Workout running': 'تمرين جارٍ','Set {0} of {1}': 'المجموعة {0} من {1}','All sets done': 'اكتملت كل المجموعات',+ 'Log set': 'سجّل المجموعة',+ 'Next exercise': 'التمرين التالي',+ 'Skip rest': 'تخطَّ الراحة',+ 'Open openGym for the next set': 'افتح openGym للمجموعة التالية','On the watch': 'على الساعة','Fewer things, bigger numbers. Pick what helps you mid-set.': 'أشياء أقل وأرقام أكبر. اختر ما يساعدك أثناء المجموعة.','Exercise animation': 'رسوم التمرين المتحركة',diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.jsindex d7da3e243..f35b0d4bc 100644--- a/frontend/src/locales/bn.js+++ b/frontend/src/locales/bn.js@@ -2407,6 +2407,10 @@ export default {'Workout running': 'ওয়ার্কআউট চলছে','Set {0} of {1}': 'সেট {0} / {1}','All sets done': 'সব সেট শেষ',+ 'Log set': 'সেট লগ করুন',+ 'Next exercise': 'পরের ব্যায়াম',+ 'Skip rest': 'বিশ্রাম বাদ দিন',+ 'Open openGym for the next set': 'পরের সেটের জন্য openGym খুলুন','On the watch': 'ঘড়িতে','Fewer things, bigger numbers. Pick what helps you mid-set.': 'কম জিনিস, বড় সংখ্যা। সেটের মাঝে যা কাজে লাগে তা বেছে নিন।','Exercise animation': 'ব্যায়ামের অ্যানিমেশন',diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex a3993669d..3d5b98d84 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -2348,6 +2348,10 @@ export default {'Workout running': 'Training läuft','Set {0} of {1}': 'Satz {0} von {1}','All sets done': 'Alle Sätze erledigt',+ 'Log set': 'Satz eintragen',+ 'Next exercise': 'Nächste Übung',+ 'Skip rest': 'Pause überspringen',+ 'Open openGym for the next set': 'Öffne openGym für den nächsten Satz','On the watch': 'Auf der Watch','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Weniger Kram, größere Zahlen. Nimm, was dir mitten im Satz hilft.','Exercise animation': 'Übungsanimation',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 9326bdf8e..ba241c1b8 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'Entreno en curso','Set {0} of {1}': 'Serie {0} de {1}','All sets done': 'Todas las series hechas',+ 'Log set': 'Registrar serie',+ 'Next exercise': 'Siguiente ejercicio',+ 'Skip rest': 'Saltar descanso',+ 'Open openGym for the next set': 'Abre openGym para la siguiente serie','On the watch': 'En el reloj','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Menos cosas, números más grandes. Elige lo que te ayuda a mitad de serie.','Exercise animation': 'Animación del ejercicio',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 274ddab33..9a599160a 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'Séance en cours','Set {0} of {1}': 'Série {0} sur {1}','All sets done': 'Toutes les séries faites',+ 'Log set': 'Noter la série',+ 'Next exercise': 'Exercice suivant',+ 'Skip rest': 'Passer le repos',+ 'Open openGym for the next set': 'Ouvre openGym pour la série suivante','On the watch': 'Sur la montre','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Moins de choses, de plus gros chiffres. Garde ce qui t’aide en pleine série.','Exercise animation': 'Animation de l’exercice',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex e0a0e7780..1d88592b1 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'वर्कआउट चल रहा है','Set {0} of {1}': 'सेट {0} / {1}','All sets done': 'सारे सेट पूरे',+ 'Log set': 'सेट दर्ज करें',+ 'Next exercise': 'अगली एक्सरसाइज़',+ 'Skip rest': 'आराम छोड़ें',+ 'Open openGym for the next set': 'अगले सेट के लिए openGym खोलें','On the watch': 'वॉच पर','Fewer things, bigger numbers. Pick what helps you mid-set.': 'कम चीज़ें, बड़े अंक। वही चुनें जो सेट के बीच मदद करे।','Exercise animation': 'व्यायाम एनिमेशन',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 2b15041f0..62369b1a9 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -2331,6 +2331,10 @@ export default {'Workout running': 'Edzés folyamatban','Set {0} of {1}': '{0}. sorozat / {1}','All sets done': 'Minden sorozat kész',+ 'Log set': 'Sorozat naplózása',+ 'Next exercise': 'Következő gyakorlat',+ 'Skip rest': 'Pihenő kihagyása',+ 'Open openGym for the next set': 'Nyisd meg az openGymet a következő sorozathoz','On the watch': 'Az órán','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Kevesebb dolog, nagyobb számok. Válaszd, ami sorozat közben segít.','Exercise animation': 'Gyakorlat animációja',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 3bb0e0d69..7418e9b21 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'Allenamento in corso','Set {0} of {1}': 'Serie {0} di {1}','All sets done': 'Tutte le serie fatte',+ 'Log set': 'Registra serie',+ 'Next exercise': 'Esercizio successivo',+ 'Skip rest': 'Salta il riposo',+ 'Open openGym for the next set': 'Apri openGym per la serie successiva','On the watch': 'Sull’orologio','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Meno cose, numeri più grandi. Tieni ciò che ti aiuta a metà serie.','Exercise animation': 'Animazione dell’esercizio',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex ff3d1eedc..c333166e8 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -2328,6 +2328,10 @@ export default {'Workout running': '운동 중','Set {0} of {1}': '{1}세트 중 {0}세트','All sets done': '모든 세트 완료',+ 'Log set': '세트 기록',+ 'Next exercise': '다음 운동',+ 'Skip rest': '휴식 건너뛰기',+ 'Open openGym for the next set': '다음 세트는 openGym을 열어 주세요','On the watch': '워치에서','Fewer things, bigger numbers. Pick what helps you mid-set.': '덜 보이고, 숫자는 크게. 세트 중에 도움이 되는 것만 고르세요.','Exercise animation': '운동 애니메이션',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 21b2e7f38..6a37ebf14 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'Trening trwa','Set {0} of {1}': 'Seria {0} z {1}','All sets done': 'Wszystkie serie zrobione',+ 'Log set': 'Zapisz serię',+ 'Next exercise': 'Następne ćwiczenie',+ 'Skip rest': 'Pomiń odpoczynek',+ 'Open openGym for the next set': 'Otwórz openGym, by zrobić następną serię','On the watch': 'Na zegarku','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Mniej rzeczy, większe liczby. Wybierz, co pomaga w trakcie serii.','Exercise animation': 'Animacja ćwiczenia',diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 95e26f808..7265c1ec0 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -263,6 +263,10 @@ export const PT_BR_OVERRIDES = {'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'As repetições aumentam até {0}; depois, uma série é adicionada e as repetições recomeçam. Ao chegar a {1} séries, o app sugere adicionar peso.',// Regional wording inherited from pt-PT would otherwise leak into pt-BR.+ 'Log set': 'Registrar série',+ 'Next exercise': 'Próximo exercício',+ 'Skip rest': 'Pular descanso',+ 'Open openGym for the next set': 'Abra o openGym para a próxima série','Next': 'Próximo','Move up': 'Mover para cima','Move down': 'Mover para baixo',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 4ea756306..a340f2759 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'Treino a decorrer','Set {0} of {1}': 'Série {0} de {1}','All sets done': 'Todas as séries feitas',+ 'Log set': 'Registar série',+ 'Next exercise': 'Exercício seguinte',+ 'Skip rest': 'Saltar descanso',+ 'Open openGym for the next set': 'Abre o openGym para a série seguinte','On the watch': 'No relógio','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Menos coisas, números maiores. Escolhe o que te ajuda a meio da série.','Exercise animation': 'Animação do exercício',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex d06353a17..9925e0002 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -2332,6 +2332,10 @@ export default {'Workout running': 'Тренировка идёт','Set {0} of {1}': 'Подход {0} из {1}','All sets done': 'Все подходы сделаны',+ 'Log set': 'Записать подход',+ 'Next exercise': 'Следующее упражнение',+ 'Skip rest': 'Пропустить отдых',+ 'Open openGym for the next set': 'Откройте openGym для следующего подхода','On the watch': 'На часах','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Меньше лишнего, крупнее цифры. Оставьте то, что помогает посреди подхода.','Exercise animation': 'Анимация упражнения',diff --git a/frontend/src/locales/sv.js b/frontend/src/locales/sv.jsindex d76a352da..c736e7eaf 100644--- a/frontend/src/locales/sv.js+++ b/frontend/src/locales/sv.js@@ -2363,6 +2363,10 @@ export default {'Workout running': 'Pass pågår','Set {0} of {1}': 'Set {0} av {1}','All sets done': 'Alla set klara',+ 'Log set': 'Logga set',+ 'Next exercise': 'Nästa övning',+ 'Skip rest': 'Hoppa över vilan',+ 'Open openGym for the next set': 'Öppna openGym för nästa set','On the watch': 'På klockan','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Färre saker, större siffror. Välj det som hjälper dig mitt i ett set.','Exercise animation': 'Övningsanimation',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 297e9ecf5..35985dccd 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -2339,6 +2339,10 @@ export default {'Workout running': 'กำลังฝึกอยู่','Set {0} of {1}': 'เซ็ต {0} จาก {1}','All sets done': 'ครบทุกเซ็ตแล้ว',+ 'Log set': 'บันทึกเซ็ต',+ 'Next exercise': 'ท่าถัดไป',+ 'Skip rest': 'ข้ามการพัก',+ 'Open openGym for the next set': 'เปิด openGym เพื่อทำเซ็ตถัดไป','On the watch': 'บนนาฬิกา','Fewer things, bigger numbers. Pick what helps you mid-set.': 'ของน้อยลง ตัวเลขใหญ่ขึ้น เลือกสิ่งที่ช่วยระหว่างเซ็ต','Exercise animation': 'ภาพเคลื่อนไหวท่า',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 920b8b981..491b77e71 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -2328,6 +2328,10 @@ export default {'Workout running': 'Antrenman sürüyor','Set {0} of {1}': 'Set {0}/{1}','All sets done': 'Tüm setler tamam',+ 'Log set': 'Seti kaydet',+ 'Next exercise': 'Sonraki egzersiz',+ 'Skip rest': 'Dinlenmeyi atla',+ 'Open openGym for the next set': 'Sonraki set için openGym’i aç','On the watch': 'Saatte','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Daha az şey, daha büyük sayılar. Set ortasında işine yarayanı seç.','Exercise animation': 'Egzersiz animasyonu',diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex 3a9193bbe..649df415b 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -2325,6 +2325,10 @@ export default {'Workout running': 'Тренування триває','Set {0} of {1}': 'Підхід {0} з {1}','All sets done': 'Усі підходи зроблено',+ 'Log set': 'Записати підхід',+ 'Next exercise': 'Наступна вправа',+ 'Skip rest': 'Пропустити відпочинок',+ 'Open openGym for the next set': 'Відкрий openGym для наступного підходу','On the watch': 'На годиннику','Fewer things, bigger numbers. Pick what helps you mid-set.': 'Менше зайвого, більші цифри. Залиш те, що допомагає посеред підходу.','Exercise animation': 'Анімація вправи',diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex 8672b92e9..9539c9f84 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -2321,6 +2321,10 @@ export default {'Workout running': '訓練進行中','Set {0} of {1}': '第 {0} 組,共 {1} 組','All sets done': '所有組已完成',+ 'Log set': '記錄本組',+ 'Next exercise': '下一個動作',+ 'Skip rest': '略過休息',+ 'Open openGym for the next set': '打開 openGym 繼續下一組','On the watch': '手錶上','Fewer things, bigger numbers. Pick what helps you mid-set.': '少一點東西,數字更大。選你做組時用得上的。','Exercise animation': '動作動畫',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex f4f7aaa97..8b21dcbcd 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -2328,6 +2328,10 @@ export default {'Workout running': '训练进行中','Set {0} of {1}': '第 {0} 组,共 {1} 组','All sets done': '所有组已完成',+ 'Log set': '记录本组',+ 'Next exercise': '下一个动作',+ 'Skip rest': '跳过休息',+ 'Open openGym for the next set': '打开 openGym 继续下一组','On the watch': '手表上','Fewer things, bigger numbers. Pick what helps you mid-set.': '少一点东西,数字更大。选你做组时用得上的。','Exercise animation': '动作动画',diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex 5a509f897..8bdbe75f8 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -1965,6 +1965,10 @@ function ActiveWorkout() {const late = Math.floor((Date.now() - at) / 1000)if (late > 1 && rest && rest !== restBefore && !rest.ready && !rest.paused) useUI.getState().addRest(-late)},+ // Next exercise and Skip rest: what this screen's own Next and the rest bar's Skip do.+ next: idx => update(s => { if (s.active && !s.active.editingWorkoutId && s.active.entries?.[idx]) s.active.cur = idx }),+ restSkip: () => useUI.getState().stopRest(),+ timer: () => useUI.getState().timer,}), [])// After the finished exercise folded away (toggle, above): the new current one is the next thingdiff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsxindex 0b9fc25b2..e22aa2062 100644--- a/frontend/src/views/Workout.test.jsx+++ b/frontend/src/views/Workout.test.jsx@@ -3653,4 +3653,17 @@ describe('the Lock Screen\'s Done (Live Activity)', () => {await act(async () => { mocks.live.setDone(0, 0, { at: Date.now() }) })expect(mocks.S.active.entries[0].sets[0].done).toBe(false)})++ it('Next exercise moves the current exercise without ticking, Skip rest stops the rest', async () => {+ await mount([exercise('live-bench', [false, false]), exercise('live-row', [false])])+ await act(async () => { mocks.live.next(1) })+ expect(mocks.S.active.cur).toBe(1)+ expect(mocks.S.active.entries.flatMap(e => e.sets).some(s => s.done)).toBe(false)+ mocks.timer = { left: 60, total: 90, endsAt: Date.now() + 60000 }+ expect(mocks.live.timer()).toBe(mocks.timer)+ const before = mocks.stopRest.mock.calls.length+ await act(async () => { mocks.live.restSkip() })+ expect(mocks.stopRest.mock.calls.length).toBe(before + 1)+ expect(mocks.timer).toBeNull()+ })})