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
Merge v1311-swipe: swipe on sets, with the night fixes
Duarte Santosb073849c82d4
diff --cc frontend/src/lib/history.jsindex b3587b643,9104866e4..7247ac061--- a/frontend/src/lib/history.js+++ b/frontend/src/lib/history.js@@@ -960,22 -943,56 +960,68 @@@ const placeRow = (rows, i, row) =>return next}+/** The rows one set takes up at `i`: a timed per-side hold is an L row and an R row that read+ * as one set number (addSet pushes them as a pair), so taking one out takes its partner too.+ * Anything else is the row alone. Returns [start, count]. */+export function setSpanAt(rows, i) {+ const row = rows[i]+ if (row?.side === 'L' && rows[i + 1]?.side === 'R') return [i, 2]+ if (row?.side === 'R' && rows[i - 1]?.side === 'L') return [i - 1, 2]+ return [i, 1]+}++++ // What a copied set leaves behind (v1.3.11, swipe right or "Copy this set"): the tick and when it+ // happened, a hold's set-aside plan, the manual-weight marker (the copy follows a weight change+ // above it like any inherited row) and the drop/burst sub-rows, which belong to the set that was+ // actually done. Weight, reps, time, speed, effort, the warm-up phase, a pyramid's Max and the+ // side layout all come along.+ const NOT_COPIED = ['done', 'at', 'planSec', 'weightOrigin', 'type', 'drops', 'clusters']+ const bare = src => {+ const out = { ...src }+ for (const k of NOT_COPIED) delete out[k]+ return out+ }+ function copyOfRow(src) {+ if (isSideSet(src)) {+ const side = sd => ({ ...bare(sd), done: false })+ return syncSideAggregate({ ...bare(src), sides: { L: side(src.sides.L), R: side(src.sides.R) }, done: false })+ }+ return { ...bare(src), done: false }+ }++ /** "One more like this one": a copy of row `i` right below it, unticked and without sub-rows.+ * A timed per-side hold is planned as an L row then an R row (buildSets), so copying either+ * half copies the pair and puts it after the pair, keeping every L next to its R. */+ export function copySpanAt(rows, i) {+ const work = r => r && !isWarmupRow(r) ? r.side : null+ const start = work(rows[i]) === 'R' && work(rows[i - 1]) === 'L' ? i - 1 : i+ const end = work(rows[start]) === 'L' && work(rows[start + 1]) === 'R' ? start + 1 : start+ return { start, end }+ }+ export function copyRowAt(rows, i) {+ if (!rows[i]) return rows.slice()+ const { start, end } = copySpanAt(rows, i)+ const next = rows.slice()+ next.splice(end + 1, 0, ...rows.slice(start, end + 1).map(copyOfRow))+ return next+ }++ /** Undo for a removed set: `row` back at index `i` exactly as it was (tick, values, sub-rows).+ * An index past the end (the entry lost rows since) lands it last. */+ export function insertRowAt(rows, i, row) {+ const next = rows.slice()+ const at = Number.isInteger(i) ? Math.max(0, Math.min(i, next.length)) : next.length+ next.splice(at, 0, row)+ return next+ }+-/** Remove the row at `i`, never emptying the entry below one row. */+/** Remove the set at `i` (both halves of a per-side pair), never emptying the entry. */export function removeRowAt(rows, i) {- if (rows.length <= 1) return rows.slice()+ const [start, count] = setSpanAt(rows, i)+ if (rows.length <= count) return rows.slice()const next = rows.slice()- next.splice(i, 1)+ next.splice(start, count)return next}diff --cc frontend/src/lib/pt-br-locale.test.jsindex 00fd10fde,abcea5951..8e22a59f7--- a/frontend/src/lib/pt-br-locale.test.js+++ b/frontend/src/lib/pt-br-locale.test.js@@@ -41,7 -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('f2816f72d10ac570cceec1f6e00eb0d0310b0a7691daf33a25c85988deca8fff')- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('3ccd8ae4eccb5259688ba12a7386c270f1eb1e14de31620dab0244a4f6f9056f')++ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('13a18463457756651e1a9b7cd9b4d4db7123f77825aac92b6fcd99b2695861d2')})test('does not leak European Portuguese UI terms', () => {diff --cc frontend/src/locales/ar.jsindex f5efd656b,2edc4c9a7..91cf45be9--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@@ -1947,16 -1943,16 +1947,28 @@@ export default'Finish and save': 'إنهاء وحفظ','Make it a warm-up set': 'اجعلها مجموعة إحماء','Count it as a working set': 'احسبها مجموعة عمل',+ 'That looks too heavy. Keep it at {0} or less.': 'يبدو هذا ثقيلًا جدًا. الحد الأقصى {0}.',+ 'That’s still in the future. Try an earlier start.': 'هذا ما زال في المستقبل. جرّب وقت بدء أبكر.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'هذا أكثر من يوم. الحد الأقصى 24 ساعة.',+ 'That file isn’t an openGym backup.': 'هذا الملف ليس نسخة احتياطية من openGym.',+ 'That zip was repacked. Import the original backup file.': 'أُعيد ضغط ملف zip هذا. استورد ملف النسخة الاحتياطية الأصلي.',+ 'Couldn’t read that file.': 'تعذّرت قراءة هذا الملف.',+ 'This server doesn’t know that passkey. Make a profile first.': 'هذا الخادم لا يعرف مفتاح المرور هذا. أنشئ ملفًا شخصيًا أولًا.',+ 'That took a little too long. Give it another go.': 'استغرق ذلك وقتًا أطول قليلًا من اللازم. جرّب مرة أخرى.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'لم ينجح هذا الرمز. الرموز صالحة لمدة 5 دقائق ولمرة واحدة فقط، فاطلب رمزًا جديدًا.',+ 'Create profile with a password': 'إنشاء ملف شخصي بكلمة مرور',+ 'Set {0} done': 'المجموعة {0} مكتملة',+ 'Set {0} ({1}) done': 'المجموعة {0} ({1}) مكتملة',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'نسخ هذه المجموعة',+ 'Set {0} gone.': 'حُذفت المجموعة {0}.',+ 'Set {0} gone. Its timer stopped too.': 'حُذفت المجموعة {0}، وتوقف مؤقتها أيضًا.',+ 'Warm-up gone.': 'حُذف الإحماء.',+ 'Copied. One more like that one.': 'تم النسخ. واحدة أخرى مثلها.',+ 'Keep at least one set, champ': 'أبقِ مجموعة واحدة على الأقل يا بطل',+ 'Too late, that one’s gone': 'فات الأوان، لقد ذهبت',+ 'Psst: swipe a set. Left deletes, right copies.': 'نصيحة: اسحب مجموعة. لليمين حذف، لليسار نسخ.',+ 'Swipe on sets': 'السحب على المجموعات',+ 'Left deletes, right copies': 'لليمين حذف، لليسار نسخ',+ 'Options: copy, remove': 'خيارات: نسخ، إزالة',}diff --cc frontend/src/locales/de.jsindex 1190f3426,3c52ccfad..1583f1395--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@@ -1914,16 -1910,16 +1914,28 @@@ export default'Finish and save': 'Beenden und speichern','Make it a warm-up set': 'Zum Aufwärmsatz machen','Count it as a working set': 'Als Arbeitssatz zählen',+ 'That looks too heavy. Keep it at {0} or less.': 'Das wirkt zu schwer. Höchstens {0}, bitte.',+ 'That’s still in the future. Try an earlier start.': 'Das liegt noch in der Zukunft. Probier eine frühere Startzeit.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Das ist mehr als ein Tag. Höchstens 24 Stunden, bitte.',+ 'That file isn’t an openGym backup.': 'Diese Datei ist kein openGym-Backup.',+ 'That zip was repacked. Import the original backup file.': 'Dieses ZIP wurde neu gepackt. Importiere die originale Backup-Datei.',+ 'Couldn’t read that file.': 'Diese Datei lässt sich nicht lesen.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Diesen Passkey kennt der Server nicht. Erstell zuerst ein Profil.',+ 'That took a little too long. Give it another go.': 'Das hat etwas zu lange gedauert. Versuch es gleich noch mal.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Der Code hat nicht geklappt. Codes gelten 5 Minuten und nur einmal, also hol dir einen frischen.',+ 'Create profile with a password': 'Profil mit Passwort erstellen',+ 'Set {0} done': 'Satz {0} erledigt',+ 'Set {0} ({1}) done': 'Satz {0} ({1}) erledigt',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Diesen Satz kopieren',+ 'Set {0} gone.': 'Satz {0} ist weg.',+ 'Set {0} gone. Its timer stopped too.': 'Satz {0} ist weg. Sein Timer auch.',+ 'Warm-up gone.': 'Aufwärmsatz ist weg.',+ 'Copied. One more like that one.': 'Kopiert. Noch einer wie der.',+ 'Keep at least one set, champ': 'Ein Satz bleibt mindestens, Champ',+ 'Too late, that one’s gone': 'Zu spät, der ist weg',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst: Wisch über einen Satz. Links löscht, rechts kopiert.',+ 'Swipe on sets': 'Wischen auf Sätzen',+ 'Left deletes, right copies': 'Links löscht, rechts kopiert',+ 'Options: copy, remove': 'Optionen: kopieren, entfernen',}diff --cc frontend/src/locales/es.jsindex 0306bd838,adc2933ff..df548adf6--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'Terminar y guardar','Make it a warm-up set': 'Convertir en serie de calentamiento','Count it as a working set': 'Contar como serie efectiva',+ 'That looks too heavy. Keep it at {0} or less.': 'Eso parece demasiado. Como mucho {0}.',+ 'That’s still in the future. Try an earlier start.': 'Eso aún está en el futuro. Prueba con una hora de inicio anterior.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Eso es más de un día. Como mucho 24 horas.',+ 'That file isn’t an openGym backup.': 'Ese archivo no es una copia de openGym.',+ 'That zip was repacked. Import the original backup file.': 'Ese zip se volvió a empaquetar. Importa el archivo de copia original.',+ 'Couldn’t read that file.': 'No se pudo leer ese archivo.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Este servidor no conoce esa passkey. Crea un perfil primero.',+ 'That took a little too long. Give it another go.': 'Eso tardó un poco de más. Inténtalo otra vez.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ese código no funcionó. Los códigos duran 5 minutos y sirven una sola vez, así que pide uno nuevo.',+ 'Create profile with a password': 'Crear perfil con contraseña',+ 'Set {0} done': 'Serie {0} hecha',+ 'Set {0} ({1}) done': 'Serie {0} ({1}) hecha',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Copiar esta serie',+ 'Set {0} gone.': 'Serie {0} fuera.',+ 'Set {0} gone. Its timer stopped too.': 'Serie {0} fuera. Su temporizador también.',+ 'Warm-up gone.': 'Calentamiento fuera.',+ 'Copied. One more like that one.': 'Copiada. Otra igual a esa.',+ 'Keep at least one set, champ': 'Deja al menos una serie, campeón',+ 'Too late, that one’s gone': 'Demasiado tarde, ya no está',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst: desliza una serie. Izquierda borra, derecha copia.',+ 'Swipe on sets': 'Deslizar en las series',+ 'Left deletes, right copies': 'Izquierda borra, derecha copia',+ 'Options: copy, remove': 'Opciones: copiar, quitar',}diff --cc frontend/src/locales/fr.jsindex 32d16c071,bcbf6f0b8..d21c485ba--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'Terminer et enregistrer','Make it a warm-up set': 'En faire une série d’échauffement','Count it as a working set': 'Compter comme série de travail',+ 'That looks too heavy. Keep it at {0} or less.': 'Ça semble trop lourd. Pas plus de {0}.',+ 'That’s still in the future. Try an earlier start.': 'C’est encore dans le futur. Essaie une heure de début plus tôt.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'C’est plus d’une journée. Reste à 24 heures maximum.',+ 'That file isn’t an openGym backup.': 'Ce fichier n’est pas une sauvegarde openGym.',+ 'That zip was repacked. Import the original backup file.': 'Ce zip a été recompressé. Importe le fichier de sauvegarde d’origine.',+ 'Couldn’t read that file.': 'Impossible de lire ce fichier.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Ce serveur ne connaît pas cette passkey. Crée d’abord un profil.',+ 'That took a little too long. Give it another go.': 'C’était un peu trop long. Réessaie.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ce code n’a pas marché. Un code dure 5 minutes et ne sert qu’une fois, alors prends-en un tout neuf.',+ 'Create profile with a password': 'Créer un profil avec un mot de passe',+ 'Set {0} done': 'Série {0} faite',+ 'Set {0} ({1}) done': 'Série {0} ({1}) faite',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Copier cette série',+ 'Set {0} gone.': 'Série {0} partie.',+ 'Set {0} gone. Its timer stopped too.': 'Série {0} partie. Son minuteur aussi.',+ 'Warm-up gone.': 'Échauffement parti.',+ 'Copied. One more like that one.': 'Copiée. Encore une comme celle-là.',+ 'Keep at least one set, champ': 'Garde au moins une série, champion',+ 'Too late, that one’s gone': 'Trop tard, elle est partie',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst : glisse une série. Gauche supprime, droite copie.',+ 'Swipe on sets': 'Glisser sur les séries',+ 'Left deletes, right copies': 'Gauche supprime, droite copie',+ 'Options: copy, remove': 'Options : copier, supprimer',}diff --cc frontend/src/locales/hi.jsindex 62e5eb7af,ba05edcd2..f0c851284--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'समाप्त करें और सहेजें','Make it a warm-up set': 'इसे वार्म-अप सेट बनाएं','Count it as a working set': 'इसे वर्किंग सेट गिनें',+ 'That looks too heavy. Keep it at {0} or less.': 'यह बहुत भारी लग रहा है। ज़्यादा से ज़्यादा {0}।',+ 'That’s still in the future. Try an earlier start.': 'यह अभी भविष्य में है। थोड़ा पहले का शुरू होने का समय चुनें।',+ 'That’s more than a day. Keep it to 24 hours or less.': 'यह एक दिन से ज़्यादा है। ज़्यादा से ज़्यादा 24 घंटे।',+ 'That file isn’t an openGym backup.': 'यह फ़ाइल openGym बैकअप नहीं है।',+ 'That zip was repacked. Import the original backup file.': 'यह zip दोबारा पैक की गई है। मूल बैकअप फ़ाइल इम्पोर्ट करें।',+ 'Couldn’t read that file.': 'यह फ़ाइल पढ़ी नहीं जा सकी।',+ 'This server doesn’t know that passkey. Make a profile first.': 'यह सर्वर इस पासकी को नहीं पहचानता। पहले एक प्रोफ़ाइल बनाएँ।',+ 'That took a little too long. Give it another go.': 'इसमें थोड़ा ज़्यादा समय लग गया। एक बार फिर कोशिश करें।',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'यह कोड काम नहीं किया। कोड 5 मिनट चलते हैं और सिर्फ़ एक बार काम करते हैं, तो एक नया कोड ले लें।',+ 'Create profile with a password': 'पासवर्ड के साथ प्रोफ़ाइल बनाएँ',+ 'Set {0} done': 'सेट {0} पूरा',+ 'Set {0} ({1}) done': 'सेट {0} ({1}) पूरा',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'यह सेट कॉपी करें',+ 'Set {0} gone.': 'सेट {0} हट गया।',+ 'Set {0} gone. Its timer stopped too.': 'सेट {0} हट गया। उसका टाइमर भी रुक गया।',+ 'Warm-up gone.': 'वार्म-अप हट गया।',+ 'Copied. One more like that one.': 'कॉपी हो गया। एक और बिल्कुल वैसा ही।',+ 'Keep at least one set, champ': 'कम से कम एक सेट रहने दें, चैंपियन',+ 'Too late, that one’s gone': 'बहुत देर हो गई, वो जा चुका',+ 'Psst: swipe a set. Left deletes, right copies.': 'सुनिए: किसी सेट को स्वाइप करें। बाएँ हटाता है, दाएँ कॉपी करता है।',+ 'Swipe on sets': 'सेट पर स्वाइप',+ 'Left deletes, right copies': 'बाएँ हटाता है, दाएँ कॉपी करता है',+ 'Options: copy, remove': 'विकल्प: कॉपी, हटाएँ',}diff --cc frontend/src/locales/hu.jsindex abf826a8c,fef062b89..0d1c07b88--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@@ -1897,16 -1893,16 +1897,28 @@@ export default'Finish and save': 'Befejezés és mentés','Make it a warm-up set': 'Legyen bemelegítő sorozat','Count it as a working set': 'Számítson munkasorozatnak',+ 'That looks too heavy. Keep it at {0} or less.': 'Ez túl soknak tűnik. Legfeljebb {0}.',+ 'That’s still in the future. Try an earlier start.': 'Ez még a jövőben van. Próbálj korábbi kezdést.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Ez több mint egy nap. Legfeljebb 24 óra.',+ 'That file isn’t an openGym backup.': 'Ez a fájl nem openGym-mentés.',+ 'That zip was repacked. Import the original backup file.': 'Ezt a zipet újracsomagolták. Az eredeti mentésfájlt importáld.',+ 'Couldn’t read that file.': 'Ezt a fájlt nem sikerült beolvasni.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Ez a szerver nem ismeri ezt a jelszókulcsot. Előbb hozz létre egy profilt.',+ 'That took a little too long. Give it another go.': 'Ez egy kicsit túl sokáig tartott. Próbáld újra.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ez a kód nem működött. A kódok 5 percig érvényesek és csak egyszer használhatók, úgyhogy kérj egy újat.',+ 'Create profile with a password': 'Profil létrehozása jelszóval',+ 'Set {0} done': '{0}. sorozat kész',+ 'Set {0} ({1}) done': '{0}. sorozat ({1}) kész',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Sorozat másolása',+ 'Set {0} gone.': '{0}. sorozat törölve.',+ 'Set {0} gone. Its timer stopped too.': '{0}. sorozat törölve. Az időzítője is leállt.',+ 'Warm-up gone.': 'Bemelegítés törölve.',+ 'Copied. One more like that one.': 'Kimásolva. Még egy ugyanilyen.',+ 'Keep at least one set, champ': 'Legalább egy sorozat maradjon, bajnok',+ 'Too late, that one’s gone': 'Késő, az már nincs meg',+ 'Psst: swipe a set. Left deletes, right copies.': 'Pszt: húzz el egy sorozatot. Balra töröl, jobbra másol.',+ 'Swipe on sets': 'Húzás a sorozatokon',+ 'Left deletes, right copies': 'Balra töröl, jobbra másol',+ 'Options: copy, remove': 'Lehetőségek: másolás, eltávolítás',}diff --cc frontend/src/locales/it.jsindex 5c4a90e4d,345e89254..7bd9451c0--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'Termina e salva','Make it a warm-up set': 'Rendila serie di riscaldamento','Count it as a working set': 'Conta come serie allenante',+ 'That looks too heavy. Keep it at {0} or less.': 'Sembra troppo. Al massimo {0}.',+ 'That’s still in the future. Try an earlier start.': 'È ancora nel futuro. Prova un orario di inizio precedente.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'È più di un giorno. Al massimo 24 ore.',+ 'That file isn’t an openGym backup.': 'Questo file non è un backup di openGym.',+ 'That zip was repacked. Import the original backup file.': 'Questo zip è stato ricompresso. Importa il file di backup originale.',+ 'Couldn’t read that file.': 'Impossibile leggere questo file.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Questo server non conosce questa passkey. Crea prima un profilo.',+ 'That took a little too long. Give it another go.': 'Ci è voluto un po’ troppo. Riprova.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Questo codice non ha funzionato. I codici durano 5 minuti e valgono una volta sola, quindi prendine uno nuovo.',+ 'Create profile with a password': 'Crea profilo con password',+ 'Set {0} done': 'Serie {0} fatta',+ 'Set {0} ({1}) done': 'Serie {0} ({1}) fatta',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Copia questa serie',+ 'Set {0} gone.': 'Serie {0} via.',+ 'Set {0} gone. Its timer stopped too.': 'Serie {0} via. Anche il suo timer.',+ 'Warm-up gone.': 'Riscaldamento via.',+ 'Copied. One more like that one.': 'Copiata. Un’altra uguale.',+ 'Keep at least one set, champ': 'Tieni almeno una serie, campione',+ 'Too late, that one’s gone': 'Troppo tardi, è andata',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst: scorri una serie. Sinistra elimina, destra copia.',+ 'Swipe on sets': 'Scorri sulle serie',+ 'Left deletes, right copies': 'Sinistra elimina, destra copia',+ 'Options: copy, remove': 'Opzioni: copia, rimuovi',}diff --cc frontend/src/locales/ko.jsindex 5b74043f0,e03467878..61c00dc49--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': '마치고 저장','Make it a warm-up set': '워밍업 세트로 바꾸기','Count it as a working set': '본 세트로 세기',+ 'That looks too heavy. Keep it at {0} or less.': '너무 무거워 보여요. 최대 {0}까지예요.',+ 'That’s still in the future. Try an earlier start.': '아직 미래예요. 더 이른 시작 시간을 골라 보세요.',+ 'That’s more than a day. Keep it to 24 hours or less.': '하루가 넘어요. 최대 24시간까지예요.',+ 'That file isn’t an openGym backup.': '이 파일은 openGym 백업이 아니에요.',+ 'That zip was repacked. Import the original backup file.': '이 zip은 다시 압축됐어요. 원본 백업 파일을 가져오세요.',+ 'Couldn’t read that file.': '이 파일을 읽을 수 없어요.',+ 'This server doesn’t know that passkey. Make a profile first.': '이 서버는 이 패스키를 몰라요. 먼저 프로필을 만들어 주세요.',+ 'That took a little too long. Give it another go.': '조금 너무 오래 걸렸어요. 다시 해 보세요.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': '이 코드는 안 됐어요. 코드는 5분 동안 한 번만 쓸 수 있으니 새 코드를 받아 주세요.',+ 'Create profile with a password': '비밀번호로 프로필 만들기',+ 'Set {0} done': '{0}세트 완료',+ 'Set {0} ({1}) done': '{0}세트({1}) 완료',+ // Swipe on sets (v1.3.11)+ 'Copy this set': '이 세트 복사',+ 'Set {0} gone.': '{0}세트 삭제됨.',+ 'Set {0} gone. Its timer stopped too.': '{0}세트 삭제됨. 타이머도 멈췄어요.',+ 'Warm-up gone.': '워밍업 삭제됨.',+ 'Copied. One more like that one.': '복사됨. 같은 걸로 하나 더.',+ 'Keep at least one set, champ': '세트는 하나는 남겨야죠, 챔피언',+ 'Too late, that one’s gone': '너무 늦었어요, 이미 사라졌어요',+ 'Psst: swipe a set. Left deletes, right copies.': '쉿: 세트를 밀어 보세요. 왼쪽은 삭제, 오른쪽은 복사.',+ 'Swipe on sets': '세트 스와이프',+ 'Left deletes, right copies': '왼쪽은 삭제, 오른쪽은 복사',+ 'Options: copy, remove': '옵션: 복사, 삭제',}diff --cc frontend/src/locales/pl.jsindex 11d65a682,313a5ea78..309a00eca--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'Zakończ i zapisz','Make it a warm-up set': 'Zamień na serię rozgrzewkową','Count it as a working set': 'Licz jako serię roboczą',+ 'That looks too heavy. Keep it at {0} or less.': 'To wygląda na za dużo. Maksymalnie {0}.',+ 'That’s still in the future. Try an earlier start.': 'To jeszcze przyszłość. Spróbuj wcześniejszej godziny startu.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'To ponad doba. Maksymalnie 24 godziny.',+ 'That file isn’t an openGym backup.': 'Ten plik nie jest kopią openGym.',+ 'That zip was repacked. Import the original backup file.': 'Ten zip został spakowany na nowo. Zaimportuj oryginalny plik kopii.',+ 'Couldn’t read that file.': 'Nie udało się odczytać tego pliku.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Ten serwer nie zna tego passkey. Najpierw utwórz profil.',+ 'That took a little too long. Give it another go.': 'Trwało to trochę za długo. Spróbuj jeszcze raz.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Ten kod nie zadziałał. Kody są ważne 5 minut i działają raz, więc weź świeży.',+ 'Create profile with a password': 'Utwórz profil z hasłem',+ 'Set {0} done': 'Seria {0} zrobiona',+ 'Set {0} ({1}) done': 'Seria {0} ({1}) zrobiona',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Skopiuj tę serię',+ 'Set {0} gone.': 'Seria {0} usunięta.',+ 'Set {0} gone. Its timer stopped too.': 'Seria {0} usunięta. Jej minutnik też.',+ 'Warm-up gone.': 'Rozgrzewka usunięta.',+ 'Copied. One more like that one.': 'Skopiowano. Jeszcze jedna taka sama.',+ 'Keep at least one set, champ': 'Zostaw choć jedną serię, mistrzu',+ 'Too late, that one’s gone': 'Za późno, już jej nie ma',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst: przesuń serię. W lewo usuwa, w prawo kopiuje.',+ 'Swipe on sets': 'Przesuwanie serii',+ 'Left deletes, right copies': 'W lewo usuwa, w prawo kopiuje',+ 'Options: copy, remove': 'Opcje: kopiuj, usuń',}diff --cc frontend/src/locales/pt-BR.jsindex c8df6a0c3,597ae0654..8f98dc06f--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@@ -1173,16 -1170,14 +1173,24 @@@ export const PT_BR_OVERRIDES ='Delete {0}': 'Excluir {0}','Build your loop in Plan': 'Monte seu ciclo no Plano','Finish and save': 'Terminar e salvar',+ 'That looks too heavy. Keep it at {0} or less.': 'Isso parece pesado demais. No máximo {0}.',+ 'That’s still in the future. Try an earlier start.': 'Isso ainda está no futuro. Tente um horário de início mais cedo.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Isso é mais de um dia. No máximo 24 horas.',+ 'That file isn’t an openGym backup.': 'Esse arquivo não é um backup do openGym.',+ 'That zip was repacked. Import the original backup file.': 'Esse zip foi recompactado. Importe o arquivo de backup original.',+ 'Couldn’t read that file.': 'Não foi possível ler esse arquivo.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Este servidor não conhece essa chave de acesso. Crie um perfil primeiro.',+ 'That took a little too long. Give it another go.': 'Demorou um pouquinho demais. Tente de novo.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Esse código não funcionou. Os códigos duram 5 minutos e só valem uma vez, então pegue um novo.',+ 'Create profile with a password': 'Criar perfil com senha',+ // Swipe on sets (v1.3.11)+ 'Set {0} gone.': 'Série {0} já era.',+ 'Set {0} gone. Its timer stopped too.': 'Série {0} já era. O timer também.',+ 'Warm-up gone.': 'Aquecimento já era.',+ 'Keep at least one set, champ': 'Deixe pelo menos uma série, campeão',+ 'Too late, that one’s gone': 'Tarde demais, já era',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psiu: deslize uma série. Esquerda exclui, direita copia.',+ 'Left deletes, right copies': 'Esquerda exclui, direita copia',}export default { ...pt, ...PT_BR_OVERRIDES }diff --cc frontend/src/locales/pt.jsindex 6bb674bc8,8d3084e9d..540e13284--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'Terminar e guardar','Make it a warm-up set': 'Tornar série de aquecimento','Count it as a working set': 'Contar como série de trabalho',+ 'That looks too heavy. Keep it at {0} or less.': 'Isso parece pesado demais. No máximo {0}.',+ 'That’s still in the future. Try an earlier start.': 'Isso ainda está no futuro. Experimenta uma hora de início mais cedo.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Isso é mais de um dia. No máximo 24 horas.',+ 'That file isn’t an openGym backup.': 'Esse ficheiro não é uma cópia de segurança do openGym.',+ 'That zip was repacked. Import the original backup file.': 'Esse zip foi recompactado. Importa o ficheiro de cópia original.',+ 'Couldn’t read that file.': 'Não foi possível ler esse ficheiro.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Este servidor não conhece essa passkey. Cria primeiro um perfil.',+ 'That took a little too long. Give it another go.': 'Demorou um bocadinho demais. Tenta outra vez.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Esse código não funcionou. Os códigos duram 5 minutos e só servem uma vez, por isso pede um novo.',+ 'Create profile with a password': 'Criar perfil com palavra-passe',+ 'Set {0} done': 'Série {0} concluída',+ 'Set {0} ({1}) done': 'Série {0} ({1}) concluída',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Copiar esta série',+ 'Set {0} gone.': 'Série {0} foi-se.',+ 'Set {0} gone. Its timer stopped too.': 'Série {0} foi-se. O temporizador também.',+ 'Warm-up gone.': 'Aquecimento foi-se.',+ 'Copied. One more like that one.': 'Copiada. Mais uma igual.',+ 'Keep at least one set, champ': 'Fica pelo menos uma série, campeão',+ 'Too late, that one’s gone': 'Tarde demais, já foi',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst: desliza uma série. Esquerda elimina, direita copia.',+ 'Swipe on sets': 'Deslizar nas séries',+ 'Left deletes, right copies': 'Esquerda elimina, direita copia',+ 'Options: copy, remove': 'Opções: copiar, remover',}diff --cc frontend/src/locales/ru.jsindex 584ff0362,15a5d7351..5e75cd2e9--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@@ -1898,16 -1894,16 +1898,28 @@@ export default'Finish and save': 'Завершить и сохранить','Make it a warm-up set': 'Сделать разминочным подходом','Count it as a working set': 'Считать рабочим подходом',+ 'That looks too heavy. Keep it at {0} or less.': 'Это слишком много. Не больше {0}.',+ 'That’s still in the future. Try an earlier start.': 'Это ещё в будущем. Выбери время начала пораньше.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Это больше суток. Не больше 24 часов.',+ 'That file isn’t an openGym backup.': 'Этот файл не резервная копия openGym.',+ 'That zip was repacked. Import the original backup file.': 'Этот zip перепаковали. Импортируй исходный файл резервной копии.',+ 'Couldn’t read that file.': 'Не удалось прочитать этот файл.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Этот сервер не знает такой ключ доступа. Сначала создайте профиль.',+ 'That took a little too long. Give it another go.': 'Это заняло слишком много времени. Попробуйте ещё раз.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Этот код не сработал. Коды действуют 5 минут и только один раз, так что возьмите свежий.',+ 'Create profile with a password': 'Создать профиль с паролем',+ 'Set {0} done': 'Подход {0} выполнен',+ 'Set {0} ({1}) done': 'Подход {0} ({1}) выполнен',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Скопировать этот подход',+ 'Set {0} gone.': 'Подход {0} удалён.',+ 'Set {0} gone. Its timer stopped too.': 'Подход {0} удалён. Его таймер тоже.',+ 'Warm-up gone.': 'Разминка удалена.',+ 'Copied. One more like that one.': 'Скопировано. Ещё один такой же.',+ 'Keep at least one set, champ': 'Хотя бы один подход оставь, чемпион',+ 'Too late, that one’s gone': 'Поздно, его уже нет',+ 'Psst: swipe a set. Left deletes, right copies.': 'Псс: смахни подход. Влево удаляет, вправо копирует.',+ 'Swipe on sets': 'Свайп по подходам',+ 'Left deletes, right copies': 'Влево удаляет, вправо копирует',+ 'Options: copy, remove': 'Действия: копировать, удалить',}diff --cc frontend/src/locales/th.jsindex da7dcb2da,a41a4bed8..920b98277--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@@ -1905,16 -1901,16 +1905,28 @@@ export default'Finish and save': 'จบและบันทึก','Make it a warm-up set': 'เปลี่ยนเป็นเซ็ตวอร์มอัพ','Count it as a working set': 'นับเป็นเซ็ตจริง',+ 'That looks too heavy. Keep it at {0} or less.': 'ดูหนักเกินไปนะ ใส่ได้ไม่เกิน {0}',+ 'That’s still in the future. Try an earlier start.': 'ยังเป็นเวลาในอนาคตอยู่เลย ลองเวลาเริ่มที่เร็วกว่านี้',+ 'That’s more than a day. Keep it to 24 hours or less.': 'เกินหนึ่งวันแล้ว ใส่ได้ไม่เกิน 24 ชั่วโมง',+ 'That file isn’t an openGym backup.': 'ไฟล์นี้ไม่ใช่ข้อมูลสำรองของ openGym',+ 'That zip was repacked. Import the original backup file.': 'zip นี้ถูกบีบอัดใหม่ นำเข้าไฟล์สำรองต้นฉบับแทน',+ 'Couldn’t read that file.': 'อ่านไฟล์นี้ไม่ได้',+ 'This server doesn’t know that passkey. Make a profile first.': 'เซิร์ฟเวอร์นี้ไม่รู้จักพาสคีย์นี้ สร้างโปรไฟล์ก่อนนะ',+ 'That took a little too long. Give it another go.': 'ใช้เวลานานไปหน่อย ลองอีกครั้งนะ',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'รหัสนี้ใช้ไม่ได้ รหัสใช้ได้ 5 นาทีและใช้ได้ครั้งเดียว ขอรหัสใหม่นะ',+ 'Create profile with a password': 'สร้างโปรไฟล์ด้วยรหัสผ่าน',+ 'Set {0} done': 'เซ็ต {0} เสร็จแล้ว',+ 'Set {0} ({1}) done': 'เซ็ต {0} ({1}) เสร็จแล้ว',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'คัดลอกเซ็ตนี้',+ 'Set {0} gone.': 'ลบเซ็ต {0} แล้ว',+ 'Set {0} gone. Its timer stopped too.': 'ลบเซ็ต {0} แล้ว ตัวจับเวลาก็หยุดด้วย',+ 'Warm-up gone.': 'ลบวอร์มอัพแล้ว',+ 'Copied. One more like that one.': 'คัดลอกแล้ว อีกเซ็ตแบบเดิมเป๊ะ',+ 'Keep at least one set, champ': 'เก็บไว้อย่างน้อยหนึ่งเซ็ตนะแชมป์',+ 'Too late, that one’s gone': 'สายไปแล้ว เซ็ตนั้นไปแล้ว',+ 'Psst: swipe a set. Left deletes, right copies.': 'ชู่: ปัดเซ็ตได้นะ ซ้ายลบ ขวาคัดลอก',+ 'Swipe on sets': 'ปัดบนเซ็ต',+ 'Left deletes, right copies': 'ซ้ายลบ ขวาคัดลอก',+ 'Options: copy, remove': 'ตัวเลือก: คัดลอก, ลบ',}diff --cc frontend/src/locales/tr.jsindex 2b60f7335,f388faec6..bf89723e7--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': 'Bitir ve kaydet','Make it a warm-up set': 'Isınma setine çevir','Count it as a working set': 'Çalışma seti say',+ 'That looks too heavy. Keep it at {0} or less.': 'Bu fazla ağır görünüyor. En fazla {0}.',+ 'That’s still in the future. Try an earlier start.': 'Bu hâlâ gelecekte. Daha erken bir başlangıç dene.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Bu bir günden fazla. En fazla 24 saat.',+ 'That file isn’t an openGym backup.': 'Bu dosya bir openGym yedeği değil.',+ 'That zip was repacked. Import the original backup file.': 'Bu zip yeniden paketlenmiş. Orijinal yedek dosyasını içe aktar.',+ 'Couldn’t read that file.': 'Bu dosya okunamadı.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Bu sunucu o geçiş anahtarını tanımıyor. Önce bir profil oluştur.',+ 'That took a little too long. Give it another go.': 'Bu biraz fazla uzun sürdü. Bir kez daha dene.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Bu kod işe yaramadı. Kodlar 5 dakika geçerli ve tek kullanımlık, yenisini al.',+ 'Create profile with a password': 'Şifreyle profil oluştur',+ 'Set {0} done': 'Set {0} tamam',+ 'Set {0} ({1}) done': 'Set {0} ({1}) tamam',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Bu seti kopyala',+ 'Set {0} gone.': 'Set {0} gitti.',+ 'Set {0} gone. Its timer stopped too.': 'Set {0} gitti. Zamanlayıcısı da durdu.',+ 'Warm-up gone.': 'Isınma gitti.',+ 'Copied. One more like that one.': 'Kopyalandı. Aynısından bir tane daha.',+ 'Keep at least one set, champ': 'En az bir set kalsın, şampiyon',+ 'Too late, that one’s gone': 'Çok geç, o gitti',+ 'Psst: swipe a set. Left deletes, right copies.': 'Psst: bir seti kaydır. Sola silir, sağa kopyalar.',+ 'Swipe on sets': 'Setlerde kaydırma',+ 'Left deletes, right copies': 'Sola silir, sağa kopyalar',+ 'Options: copy, remove': 'Seçenekler: kopyala, kaldır',}diff --cc frontend/src/locales/uk.jsindex e9bb97a52,2694b8eeb..b7e6fb73f--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@@ -1891,16 -1887,16 +1891,28 @@@ export default'Finish and save': 'Завершити й зберегти','Make it a warm-up set': 'Зробити розминковим підходом','Count it as a working set': 'Рахувати робочим підходом',+ 'That looks too heavy. Keep it at {0} or less.': 'Це забагато. Не більше {0}.',+ 'That’s still in the future. Try an earlier start.': 'Це ще в майбутньому. Вибери ранніший час початку.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Це більше доби. Не більше 24 годин.',+ 'That file isn’t an openGym backup.': 'Цей файл не резервна копія openGym.',+ 'That zip was repacked. Import the original backup file.': 'Цей zip перепакували. Імпортуй оригінальний файл резервної копії.',+ 'Couldn’t read that file.': 'Не вдалося прочитати цей файл.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Цей сервер не знає такого ключа доступу. Спершу створіть профіль.',+ 'That took a little too long. Give it another go.': 'Це тривало трохи задовго. Спробуйте ще раз.',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': 'Цей код не спрацював. Коди діють 5 хвилин і лише один раз, тож візьміть свіжий.',+ 'Create profile with a password': 'Створити профіль з паролем',+ 'Set {0} done': 'Підхід {0} виконано',+ 'Set {0} ({1}) done': 'Підхід {0} ({1}) виконано',+ // Swipe on sets (v1.3.11)+ 'Copy this set': 'Скопіювати цей підхід',+ 'Set {0} gone.': 'Підхід {0} видалено.',+ 'Set {0} gone. Its timer stopped too.': 'Підхід {0} видалено. Його таймер теж.',+ 'Warm-up gone.': 'Розминку видалено.',+ 'Copied. One more like that one.': 'Скопійовано. Ще один такий самий.',+ 'Keep at least one set, champ': 'Залиш хоча б один підхід, чемпіоне',+ 'Too late, that one’s gone': 'Запізно, його вже нема',+ 'Psst: swipe a set. Left deletes, right copies.': 'Пс: змахни підхід. Ліворуч видаляє, праворуч копіює.',+ 'Swipe on sets': 'Свайп по підходах',+ 'Left deletes, right copies': 'Ліворуч видаляє, праворуч копіює',+ 'Options: copy, remove': 'Дії: копіювати, видалити',}diff --cc frontend/src/locales/zh-TW.jsindex fb118677d,88c4f4a78..d4aa26c1c--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@@ -1887,16 -1883,16 +1887,28 @@@ export default'Finish and save': '結束並儲存','Make it a warm-up set': '改為熱身組','Count it as a working set': '算作正式組',+ 'That looks too heavy. Keep it at {0} or less.': '這好像太重了。最多 {0}。',+ 'That’s still in the future. Try an earlier start.': '這還在未來。試試更早的開始時間。',+ 'That’s more than a day. Keep it to 24 hours or less.': '超過一天了。最多 24 小時。',+ 'That file isn’t an openGym backup.': '這個檔案不是 openGym 備份。',+ 'That zip was repacked. Import the original backup file.': '這個 zip 被重新打包過。請匯入原始備份檔案。',+ 'Couldn’t read that file.': '無法讀取這個檔案。',+ 'This server doesn’t know that passkey. Make a profile first.': '這個伺服器不認得這個通行密鑰。請先建立個人檔案。',+ 'That took a little too long. Give it another go.': '花的時間有點太久了。再試一次吧。',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': '這個代碼沒用。代碼只在 5 分鐘內有效,而且只能用一次,換個新的吧。',+ 'Create profile with a password': '用密碼建立個人檔案',+ 'Set {0} done': '第 {0} 組完成',+ 'Set {0} ({1}) done': '第 {0} 組({1})完成',+ // Swipe on sets (v1.3.11)+ 'Copy this set': '複製這一組',+ 'Set {0} gone.': '第 {0} 組已刪除。',+ 'Set {0} gone. Its timer stopped too.': '第 {0} 組已刪除,它的計時器也停了。',+ 'Warm-up gone.': '熱身組已刪除。',+ 'Copied. One more like that one.': '已複製。再來一組一樣的。',+ 'Keep at least one set, champ': '至少留一組吧,冠軍',+ 'Too late, that one’s gone': '太晚了,那組已經沒了',+ 'Psst: swipe a set. Left deletes, right copies.': '偷偷告訴你:滑動一組。左滑刪除,右滑複製。',+ 'Swipe on sets': '在組上滑動',+ 'Left deletes, right copies': '左滑刪除,右滑複製',+ 'Options: copy, remove': '選項:複製、刪除',}diff --cc frontend/src/locales/zh.jsindex 74505b21b,986a4ef32..be38c8821--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@@ -1894,16 -1890,16 +1894,28 @@@ export default'Finish and save': '结束并保存','Make it a warm-up set': '改为热身组','Count it as a working set': '算作正式组',+ 'That looks too heavy. Keep it at {0} or less.': '这好像太重了。最多 {0}。',+ 'That’s still in the future. Try an earlier start.': '这还在未来。试试更早的开始时间。',+ 'That’s more than a day. Keep it to 24 hours or less.': '超过一天了。最多 24 小时。',+ 'That file isn’t an openGym backup.': '这个文件不是 openGym 备份。',+ 'That zip was repacked. Import the original backup file.': '这个 zip 被重新打包过。请导入原始备份文件。',+ 'Couldn’t read that file.': '无法读取这个文件。',+ 'This server doesn’t know that passkey. Make a profile first.': '这个服务器不认识这个通行密钥。请先创建个人资料。',+ 'That took a little too long. Give it another go.': '花的时间有点太长了。再试一次吧。',+ 'That code didn’t work. Codes last 5 minutes and work once, so grab a fresh one.': '这个代码没用。代码只在 5 分钟内有效,且只能用一次,换个新的吧。',+ 'Create profile with a password': '用密码创建个人资料',+ 'Set {0} done': '第 {0} 组完成',+ 'Set {0} ({1}) done': '第 {0} 组({1})完成',+ // Swipe on sets (v1.3.11)+ 'Copy this set': '复制这一组',+ 'Set {0} gone.': '第 {0} 组已删除。',+ 'Set {0} gone. Its timer stopped too.': '第 {0} 组已删除,它的计时器也停了。',+ 'Warm-up gone.': '热身组已删除。',+ 'Copied. One more like that one.': '已复制。再来一组一样的。',+ 'Keep at least one set, champ': '至少留一组吧,冠军',+ 'Too late, that one’s gone': '太晚了,那组已经没了',+ 'Psst: swipe a set. Left deletes, right copies.': '悄悄告诉你:滑动一组。左滑删除,右滑复制。',+ 'Swipe on sets': '在组上滑动',+ 'Left deletes, right copies': '左滑删除,右滑复制',+ 'Options: copy, remove': '选项:复制、删除',}diff --cc frontend/src/store/useUI.jsindex 0f9e5d2db,669d76a70..3783ab638--- a/frontend/src/store/useUI.js+++ b/frontend/src/store/useUI.js@@@ -420,10 -417,9 +461,10 @@@ export function restoreRest(now = Date.const total = Math.round(Number(saved.total))const ok = useStore.getState().S?.active && total > 0 && (saved.paused ? saved.left > 0 : saved.endsAt > now)if (!ok) { try { ss.removeItem(REST_KEY) } catch { /* nothing to drop */ } return false }- const base = { total, forIdx: saved.forIdx ?? undefined, ...(saved.kind === 'switch' ? { kind: 'switch' } : {}) }+ const base = { total, forIdx: saved.forIdx ?? undefined, ...(saved.forSet != null ? { forSet: saved.forSet } : {}), ...(saved.kind === 'switch' ? { kind: 'switch' } : {}) }if (saved.paused) {useUI.setState({ timer: { ...base, left: Math.round(saved.left), endsAt: saved.endsAt, paused: true } })+ if (MOBILE) holdRestAlert(Math.round(saved.left), total)return true}pageHiddenAt = typeof document !== 'undefined' && document.hidden ? now : nulldiff --cc frontend/src/views/Workout.jsxindex 653603f65,036af5c18..adeea70c7--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@@ -7,7 -8,7 +8,7 @@@ import { useUI } from '../store/useUI.jimport { exOr, betterWeight } from '../lib/exercises.js'import { usesBar } from '../lib/bar.js'import { loadKindFor, baseWeightFor, inventoryFor, rowLoad, sameLoad, plateDelta, dropGrid } from '../lib/plates.js'- import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, makeWarmupAt, canBeWarmup, makeWorkAt, removeRowAt, removeLastSet, setSpanAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor, setsRepsOf } from '../lib/history.js'-import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, makeWarmupAt, makeWorkAt, removeRowAt, copyRowAt, copySpanAt, insertRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor, setsRepsOf } from '../lib/history.js'++import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, makeWarmupAt, canBeWarmup, makeWorkAt, removeRowAt, removeLastSet, setSpanAt, copyRowAt, copySpanAt, insertRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor, setsRepsOf } from '../lib/history.js'import { fmtNum, fmtPlate, exerciseNameText, fmtDate, fmtDaysAgo, todayISO, exCount, DAYN } from '../lib/format.js'import { speedUnitOf, toSpeed, fromSpeed } from '../lib/speed.js'import { beep, vibrate, unlock } from '../lib/sound.js'@@@ -425,7 -426,8 +426,8 @@@ function ExerciseBlock({ entryIdx, comp!warm && mode === 'reps' && !isDropSet(s) && { icon: 'bolt', label: t('Rest-pause burst'), sub: t('+ Burst'), onClick: () => addBurstRow(i) },] },{ items: [+ onCopySetAt && { icon: 'copy', label: t('Copy this set'), onClick: () => onCopySetAt(i) },- { icon: 'trash', label: t('Remove this set'), danger: true, disabled: !editing && entry.sets.length <= 1, onClick: () => onRemoveSetAt(i) },+ { icon: 'trash', label: t('Remove this set'), danger: true, disabled: !editing && entry.sets.length <= setSpanAt(entry.sets, i)[1], onClick: () => onRemoveSetAt(i) },] },],})@@@ -550,6 -552,24 +552,24 @@@<button aria-label={t('Increase')} onClick={() => onChange(snapWeightStep ? stepWeight(value, step, 1) : Math.max(0, Math.round(((value || 0) + step) * 100) / 100))}><Icon name="plus" /></button></div>)+ // Swipe on sets (v1.3.11, Settings → Workout): a set row swiped toward the start of the line is+ // removed with an Undo, toward the end copied below itself. Off, the row is the plain row it+ // was, and the Cards swipe works from it again. The row closes whenever its exercise's rows+ // change, the row is ticked, or a rest or hold starts: rows are keyed by index, so an open row+ // could otherwise end up showing another set.+ const swipeOn = !!(wc.swipeSets && onCopySetAt && onRemoveSetAt)+ const dismissHint = () => { if (useUI.getState().swipeHint) setUI({ swipeHint: null }) }+ const swipeRow = (s, i, row) => !swipeOn ? row : (- <SwipeRow canDelete={editing || entry.sets.length > 1}++ <SwipeRow canDelete={editing || entry.sets.length > setSpanAt(entry.sets, i)[1]}+ onDelete={() => onRemoveSetAt(i)} onCopy={() => onCopySetAt(i)}+ onBlocked={() => useUI.getState().toast(t('Keep at least one set, champ'))}+ onStart={dismissHint}+ closeKey={[entry.sets.length, s.done ? 1 : 0, s.sides?.L?.done ? 1 : 0, s.sides?.R?.done ? 1 : 0, restEnds || 0, working?.endsAt || 0, S.active.cur].join('|')}+ flash={setFlash && setFlash.i === i ? setFlash.id : 0}+ peek={swipeHint && swipeHint.i === i ? swipeHint.id : 0}>+ {row}+ </SwipeRow>+ )return <>{/* Animations set to Small: a thumbnail beside the name instead of a strip above it, so thefirst set is on screen without scrolling; a tap brings the full animation back. */}@@@ -655,9 -676,14 +676,14 @@@set off itself. The checkbox stays for anyone who timed it on their own watch. */}{timed && !editing && <button className="setgo" aria-label={t('Start set')} disabled={s.done || !!working}onClick={() => onStartTimed(i)}><Icon name="play" /></button>}- <Check checked={s.done} onChange={() => onToggle(i)} />+ <Check checked={s.done} label={sideTagOf(s) ? t('Set {0} ({1}) done', setNumOf(s, i), sideTagOf(s)) : t('Set {0} done', setNumOf(s, i))} onChange={() => onToggle(i)} /></div>- )}+ ))}+ {swipeHint && swipeHint.i === i && swipeOn && <div className="swhint">+ <button type="button" onClick={() => setUI({ swipeHint: null })}>+ <Icon name="swap" /><span>{t('Psst: swipe a set. Left deletes, right copies.')}</span><Icon name="xmark" />+ </button>+ </div>}{loadLine(String(i))}{/* Drop-sets and rest-pause bursts extend this same row — no long rest, no new set.A planned exercise arrives with these already filled in (applyIntensifierPlan);@@@ -696,6 -722,95 +722,103 @@@</>}+ /* ---------- swipe on sets: delete, undo, copy (v1.3.11) ---------- */+ // The swipe, the set-number menu and the Undo on the toast all come through here, so a set is+ // removed, put back and copied the same way whichever you used, and always through the store's+ // normal update: the sync sees an ordinary edit (with its _rev/baseRev), never an old snapshot+ // written back over newer state.+ //+ // Rows have no id of their own, so whatever points at a row by its index has to move with it:+ // the running hold (its callback writes the seconds to a row) and the rest a set started+ // (timer.forSet). Removing the set either one belongs to stops it first; Undo does not start it+ // again. Rows above or below just shift.+ let holdAt = null // { owner, idx, i }: the row a running hold will write to (startTimed)+ let flashSeq = 0+ // UI state written from here and from effects; a test that stubs the UI store without setState+ // simply does not see it.+ const setUI = patch => useUI.setState?.(patch)+ const shiftRowRefs = (idx, from, by) => {+ if (holdAt && holdAt.idx === idx && holdAt.i >= from) holdAt = { ...holdAt, i: holdAt.i + by }++ // The hold's saved owner (useUI.work.owner, what a reload brings it back to) moves with it.++ const wk = useUI.getState().work++ if (wk?.owner && wk.owner.idx === idx && wk.owner.i >= from) setUI({ work: { ...wk, owner: { ...wk.owner, i: wk.owner.i + by } } })+ const rest = useUI.getState().timer+ if (rest && rest.forIdx === idx && rest.forSet != null && rest.forSet >= from) setUI({ timer: { ...rest, forSet: rest.forSet + by } })+ }+ /** The number a set row shows: counted per phase (warm-ups and work sets each from 1), and a+ * timed per-side L/R pair as one set. */+ export function setNumberAt(sets, i) {+ const s = sets[i]+ const warm = isWarmupRow(s)+ const phaseNum = sets.slice(0, i + 1).filter(x => isWarmupRow(x) === warm).length+ return s?.side ? Math.ceil(phaseNum / 2) : phaseNum+ }+ /** Removes set `i` of active entry `idx`, with an Undo on the toast. In a live session one set+ * always stays (removeRowAt); the editor of a saved workout may take them all. */+ export function deleteActiveSet(idx, i, { editing = false } = {}) {+ const A = useStore.getState().S.active+ const e = A?.entries?.[idx]+ const row = e?.sets?.[i]+ if (!row) return false+ const ui = useUI.getState()- if (!editing && e.sets.length <= 1) { ui.toast(t('Keep at least one set, champ')); return false }++ // A timed per-side hold is an L row and an R row that read as one set: both go, and both come back.++ const [start, count] = setSpanAt(e.sets, i)++ if (!editing && e.sets.length <= count) { ui.toast(t('Keep at least one set, champ')); return false }++ const inSpan = j => j != null && j >= start && j < start + count+ let stopped = false- if (ui.work && holdAt && holdAt.idx === idx && holdAt.i === i) { holdAt = null; ui.stopWork(); stopped = true }++ const holdHere = ui.work && ((holdAt && holdAt.idx === idx && inSpan(holdAt.i)) || (ui.work.owner && ui.work.owner.idx === idx && inSpan(ui.work.owner.i)))++ if (holdHere) { holdAt = null; ui.stopWork(); stopped = true }+ const rest = ui.timer- if (rest && rest.forIdx === idx && rest.forSet === i) { ui.stopRest(); stopped = !rest.ready || stopped }- shiftRowRefs(idx, i + 1, -1)++ if (rest && rest.forIdx === idx && inSpan(rest.forSet)) { ui.stopRest(); stopped = !rest.ready || stopped }++ shiftRowRefs(idx, start + count, -count)+ const n = setNumberAt(e.sets, i)+ const warm = isWarmupRow(row)- const token = { activeId: A.id, idx, entryId: e.id, i, row: structuredClone(row) }++ const token = { activeId: A.id, idx, entryId: e.id, i: start, rows: structuredClone(e.sets.slice(start, start + count)) }+ useStore.getState().update(s => {+ const en = s.active?.entries?.[idx]+ if (!en) return- if (editing) en.sets.splice(i, 1)++ if (editing) en.sets.splice(start, count)+ else en.sets = removeRowAt(en.sets, i)+ }, true)+ const msg = warm ? t('Warm-up gone.') : stopped ? t('Set {0} gone. Its timer stopped too.', n) : t('Set {0} gone.', n)+ ui.toast(msg, { action: t('Undo'), onAction: () => undoDeleteSet(token) })+ return true+ }+ /** Puts a removed set back exactly as it was, at its old place in the same exercise. If the+ * exercise moved, it is found by its id; if it is gone, or the workout is, there is nothing to+ * put it back into. */+ export function undoDeleteSet(token) {+ const A = useStore.getState().S.active+ const ui = useUI.getState()+ const at = !A || A.id !== token.activeId ? -1+ : A.entries[token.idx]?.id === token.entryId ? token.idx+ : A.entries.findIndex(en => en.id === token.entryId)+ if (at < 0) { ui.toast(t('Too late, that one’s gone')); return false }++ const rows = token.rows || [token.row]+ const i = Math.min(token.i, A.entries[at].sets.length)- shiftRowRefs(at, i, 1)++ shiftRowRefs(at, i, rows.length)+ useStore.getState().update(s => {+ const en = s.active.entries[at]- en.sets = insertRowAt(en.sets, i, token.row)++ en.sets = rows.reduce((acc, r, k) => insertRowAt(acc, i + k, r), en.sets)+ }, true)+ setUI({ setFlash: { idx: at, i, id: ++flashSeq } })+ return true+ }+ /** "One more like this one": a copy of set `i` right below it (lib/history.js copyRowAt). */+ export function copyActiveSet(idx, i) {+ const e = useStore.getState().S.active?.entries?.[idx]+ if (!e?.sets?.[i]) return false+ const { start, end } = copySpanAt(e.sets, i)+ shiftRowRefs(idx, end + 1, end - start + 1)+ useStore.getState().update(s => {+ const en = s.active?.entries?.[idx]+ if (en) en.sets = copyRowAt(en.sets, i)+ }, true)+ setUI({ setFlash: { idx, i: end + 1, id: ++flashSeq } })+ useUI.getState().toast(t('Copied. One more like that one.'))+ return true+ }+/* ---------- active workout ---------- */export function removeActiveExercise(idx) {// Clear the work callback before indexes can shift. This also protects a confirmation sheet@@@ -1311,32 -1466,31 +1474,47 @@@ function ActiveWorkout()// the row is held to the end, ticked, or given a duration you typed yourself, and it never// reaches S.workouts (lib/finish-workout.js).const plan = (!e.sets[i].done && e.sets[i].planSec) || e.sets[i].sec || 45- useUI.getState().startWork(plan, exerciseNameText(exOr(e.id)), holdDone(idx, i, plan), { idx, i, id: e.id })+ const owner = { idx, i }- useUI.getState().startWork(plan, exerciseNameText(exOr(e.id)), (elapsed, { abandoned = false, chimed = false } = {}) => {- // The row may have moved while the hold ran (a set copied or removed above it): write to- // where it is now. holdAt is that place (deleteActiveSet, copyActiveSet).- const mine = holdAt?.owner === owner- const i = mine ? holdAt.i : owner.i- if (mine) holdAt = null- // A hold a rest displaced (useUI.abandonWork: a set ticked on another row, or another- // exercise) keeps its seconds and nothing else. It is not a finish: the row stays unticked- // and starts no rest, because the rest that displaced the hold is already counting down —- // and the plan it was held against is put aside so the row still knows what it is asking for.- if (abandoned) {- // A row ticked by hand while its hold ran comes through here too — toggle starts the rest- // that displaces the hold, so the hand-back lands on a row that is already ticked. It- // still wants the seconds (that is what was held, not the target), but a finished row has- // no use for a plan set aside.- mutEntry(idx, en => { if (en.sets[i].planSec == null && !en.sets[i].done) en.sets[i].planSec = plan; en.sets[i].sec = elapsed })- return- }- mutEntry(idx, en => { en.sets[i].sec = elapsed; delete en.sets[i].planSec })- if (!useStore.getState().S.active.entries[idx].sets[i].done) toggle(idx, i, undefined, { quiet: chimed })- })++ useUI.getState().startWork(plan, exerciseNameText(exOr(e.id)), holdDone(owner, plan), { idx, i, id: e.id })+ // After startWork: a hold it displaced has already written its seconds to its own row.+ holdAt = { owner, idx, i }}+ // What a hold hands back to its row: on its end, its Done, or a rest displacing it. Also bound+ // again to a hold restored after a reload (useUI.bindWork, below).- const holdDone = (idx, i, plan) => (elapsed, { abandoned = false, chimed = false } = {}) => {++ const holdDone = (owner, plan) => (elapsed, { abandoned = false, chimed = false } = {}) => {++ const { idx } = owner++ // The row may have moved while the hold ran (a set copied or removed above it): write to++ // where it is now. holdAt is that place (deleteActiveSet, copyActiveSet).++ const mine = holdAt?.owner === owner++ const i = mine ? holdAt.i : owner.i++ if (mine) holdAt = null+ // A hold a rest displaced (useUI.abandonWork: a set ticked on another row, or another- // exercise) keeps its seconds and nothing else. It is not a finish: the row stays unticked- // and starts no rest, because the rest that displaced the hold is already counting down —- // and the plan it was held against is put aside so the row still knows what it is asking for.- if (abandoned) {- // A row ticked by hand while its hold ran comes through here too — toggle starts the rest- // that displaces the hold, so the hand-back lands on a row that is already ticked. It- // still wants the seconds (that is what was held, not the target), but a finished row has- // no use for a plan set aside.- mutEntry(idx, en => { if (en.sets[i].planSec == null && !en.sets[i].done) en.sets[i].planSec = plan; en.sets[i].sec = elapsed })- return- }- mutEntry(idx, en => { en.sets[i].sec = elapsed; delete en.sets[i].planSec })++ // exercise) keeps its seconds and nothing else. It is not a finish: the row stays unticked++ // and starts no rest, because the rest that displaced the hold is already counting down —++ // and the plan it was held against is put aside so the row still knows what it is asking for.++ if (abandoned) {++ // A row ticked by hand while its hold ran comes through here too — toggle starts the rest++ // that displaces the hold, so the hand-back lands on a row that is already ticked. It++ // still wants the seconds (that is what was held, not the target), but a finished row has++ // no use for a plan set aside.++ mutEntry(idx, en => { if (en.sets[i].planSec == null && !en.sets[i].done) en.sets[i].planSec = plan; en.sets[i].sec = elapsed })++ return++ }++ mutEntry(idx, en => { en.sets[i].sec = elapsed; delete en.sets[i].planSec })+ if (!useStore.getState().S.active.entries[idx].sets[i].done) toggle(idx, i, undefined, { quiet: chimed })+ }+ // A hold that came back from a reload has no handler yet: this screen gives it its own.+ const holdDoneRef = useRef(holdDone)+ holdDoneRef.current = holdDone+ useEffect(() => {- useUI.getState().bindWork?.(wk => (...a) => holdDoneRef.current(wk.owner.idx, wk.owner.i, wk.total)(...a))++ useUI.getState().bindWork?.(wk => {++ // From here on it is tracked like a hold started on this screen (holdAt), so a set copied or++ // removed above it moves it along.++ const owner = { idx: wk.owner.idx, i: wk.owner.i }++ holdAt = { owner, idx: owner.idx, i: owner.i }++ return (...a) => holdDoneRef.current(owner, wk.total)(...a)++ })+ }, [])// `quiet`: the hold that ticks this set has just ended with the chime and its buzz pattern// (store/useUI.js). The tick's own beep would sound over the chime's first note and clip it,diff --cc frontend/src/views/Workout.swipe.test.jsxindex 000000000,84d030e02..83d97761bmode 000000,100644..100644--- a/frontend/src/views/Workout.swipe.test.jsx+++ b/frontend/src/views/Workout.swipe.test.jsx@@@ -1,0 -1,331 +1,364 @@@+ // @vitest-environment happy-dom+ import React, { act } from 'react'+ import { createRoot } from 'react-dom/client'+ import { MemoryRouter } from 'react-router-dom'+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+ import Workout, { deleteActiveSet, undoDeleteSet, copyActiveSet, removeActiveExercise } from './Workout.jsx'+ import { DEF, useStore } from '../store/useStore.js'+ import { useUI } from '../store/useUI.js'+ import { closeOpenRow } from '../lib/use-swipe-row.js'++ // Swipe on sets (v1.3.11): swipe toward the start removes a set with an Undo, toward the end+ // copies it. These cover the store paths the swipe, the set menu and the Undo share, the guards+ // (last set, timers), and the gesture on a real rendered row.++ 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 clone = value => JSON.parse(JSON.stringify(value))+ const row = (w, done = false, extra = {}) => ({ w, r: 8, done, ...extra })+ const entry = (id, sets, extra = {}) => ({ id, target: { sets: sets.length, reps: 8 }, sets, ...extra })++ let root+ let container++ function setActive(entries, { cur = 0, wc, hints = { swipeSets: true }, editing = false } = {}) {+ const S = clone(DEF)+ if (wc) S.wc = { ...S.wc, ...wc }+ S.hints = hints+ S.active = {+ id: 'swipe-test', d: '2026-10-06', start: Date.now(), routineId: null,+ name: 'Swipe test', bw: null, cur, entries,+ ...(editing ? { editingWorkoutId: 'w1' } : {}),+ }+ useStore.setState({ S, user: null })+ }+ const sets = (k = 0) => useStore.getState().S.active.entries[k].sets+ const toast = () => useUI.getState().toastMsg++ function render() {+ container = document.createElement('div')+ document.body.appendChild(container)+ root = createRoot(container)+ act(() => root.render(<MemoryRouter><Workout /></MemoryRouter>))+ }++ function pointer(target, type, x, y = 300, pointerType = 'touch') {+ const event = new Event(type, { bubbles: true, cancelable: true })+ Object.assign(event, { pointerId: 7, pointerType, clientX: x, clientY: y })+ act(() => { target.dispatchEvent(event) })+ }+ const click = target => act(() => { target.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true })) })+ // A swipe from x0 to x1 on `target`, ended with the click a browser may send after a touch.+ function swipe(target, x0, x1, { dy = 0, pointerType = 'touch', clickAfter = true } = {}) {+ pointer(target, 'pointerdown', x0, 300, pointerType)+ pointer(target, 'pointermove', x0 + (x1 - x0) / 2, 300 + dy / 2, pointerType)+ pointer(target, 'pointermove', x1, 300 + dy, pointerType)+ pointer(target, 'pointerup', x1, 300 + dy, pointerType)+ if (clickAfter) click(target)+ }++ beforeEach(() => {+ vi.useFakeTimers()+ localStorage.clear()+ document.documentElement.dir = 'ltr'+ useUI.getState().stopRest()+ useUI.getState().stopWork()+ useUI.setState({ sheets: [], toastMsg: '', toastAction: null, timer: null, work: null, swipeHint: null, setFlash: null })+ useStore.setState({ S: clone(DEF), user: null })+ root = null+ container = null+ })++ afterEach(() => {+ closeOpenRow(true)+ if (root) act(() => root.unmount())+ if (container) container.remove()+ useUI.getState().stopRest()+ useUI.getState().stopWork()+ vi.clearAllTimers()+ vi.useRealTimers()+ document.documentElement.dir = 'ltr'+ })++ describe('removing a set, and Undo', () => {+ it('removes the set, says which, and Undo puts the exact row back in its place', () => {+ const drop = row(80, true, { type: 'dropset', drops: [{ w: 60, r: 6 }], at: 5 })+ setActive([entry('1001', [row(80, true), drop, row(80)])])+ expect(deleteActiveSet(0, 1)).toBe(true)+ expect(sets()).toHaveLength(2)+ expect(toast()).toBe('Set 2 gone.')+ expect(useUI.getState().toastAction.label).toBe('Undo')++ act(() => useUI.getState().runToastAction())+ expect(sets()).toEqual([row(80, true), drop, row(80)])+ expect(useUI.getState().setFlash).toMatchObject({ idx: 0, i: 1 })+ })++ it('numbers a warm-up as a warm-up', () => {+ setActive([entry('1001', [row(40, false, { phase: 'warmup', warmup: true }), row(80), row(80)])])+ deleteActiveSet(0, 0)+ expect(toast()).toBe('Warm-up gone.')+ })++ it('keeps the last set of a live session, and lets the editor of a saved workout take it', () => {+ setActive([entry('1001', [row(80)])])+ expect(deleteActiveSet(0, 0)).toBe(false)+ expect(sets()).toHaveLength(1)+ expect(toast()).toBe('Keep at least one set, champ')++ setActive([entry('1001', [row(80, true)])], { editing: true })+ expect(deleteActiveSet(0, 0, { editing: true })).toBe(true)+ expect(sets()).toHaveLength(0)+ })++ it('stops the rest the removed set started, and Undo does not start it again', () => {+ setActive([entry('1001', [row(80, true), row(80, true), row(80)])])+ useUI.getState().startRest(90, 0, { forSet: 1 })+ deleteActiveSet(0, 1)+ expect(useUI.getState().timer).toBeNull()+ expect(toast()).toBe('Set 2 gone. Its timer stopped too.')+ act(() => useUI.getState().runToastAction())+ expect(sets()[1].done).toBe(true)+ expect(useUI.getState().timer).toBeNull()+ })++ it('keeps a rest another set started, pointed at where that set moved', () => {+ setActive([entry('1001', [row(80, true), row(80, true), row(80)])])+ useUI.getState().startRest(90, 0, { forSet: 1 })+ deleteActiveSet(0, 0)+ expect(useUI.getState().timer?.forSet).toBe(0)+ expect(toast()).toBe('Set 1 gone.')+ act(() => useUI.getState().runToastAction())+ expect(useUI.getState().timer?.forSet).toBe(1)+ })++ it('is too late once the exercise is gone, and finds an exercise that moved', () => {+ setActive([entry('1001', [row(80), row(80)]), entry('1002', [row(50), row(50)])])+ deleteActiveSet(1, 0)+ const token = { activeId: 'swipe-test', idx: 1, entryId: '1002', i: 0, row: row(50, true) }+ removeActiveExercise(0) // 1002 is now at 0+ expect(undoDeleteSet(token)).toBe(true)+ expect(sets(0)).toEqual([row(50, true), row(50)])++ removeActiveExercise(0)+ expect(undoDeleteSet({ ...token, entryId: '1002' })).toBe(false)+ expect(toast()).toBe('Too late, that one’s gone')+ })++ it('a newer toast takes the old Undo with it, and the removal stays', () => {+ setActive([entry('1001', [row(80), row(81), row(82)])])+ deleteActiveSet(0, 0)+ copyActiveSet(0, 0)+ expect(useUI.getState().toastAction).toBeNull()+ expect(sets().map(s => s.w)).toEqual([81, 81, 82])+ })+ })++ describe('copying a set', () => {+ it('puts an unticked copy right below, flashes it and says so', () => {+ setActive([entry('1001', [row(80, true, { rir: 2 }), row(80)])])+ expect(copyActiveSet(0, 0)).toBe(true)+ expect(sets()).toEqual([row(80, true, { rir: 2 }), row(80, false, { rir: 2 }), row(80)])+ expect(useUI.getState().setFlash).toMatchObject({ idx: 0, i: 1 })+ expect(toast()).toBe('Copied. One more like that one.')+ expect(useUI.getState().toastAction).toBeNull()+ })+ })++ describe('a hold running while rows move', () => {+ const timed = (secs, extra = {}) => entry('1002', secs.map(sec => ({ sec, w: 0, done: false })), { target: { sets: secs.length, sec: 30, mode: 'time' }, ...extra })++ it('writes what it held to its own row after a set above it was copied or removed', () => {+ setActive([timed([30, 40, 50])])+ render()+ const play = () => [...container.querySelectorAll('button[aria-label="Start set"]')]+ act(() => play()[2].click()) // hold on the 50 s row+ expect(useUI.getState().work).not.toBeNull()+ act(() => { copyActiveSet(0, 0) }) // rows: 30 30 40 50, the hold's row is now 3+ act(() => { deleteActiveSet(0, 1) }) // rows: 30 40 50, back at 2+ act(() => useUI.getState().finishWorkEarly())+ expect(sets()[2].done).toBe(true)+ expect(sets()[2].sec).toBeLessThanOrEqual(50)+ expect(sets()[0].done).toBe(false)+ expect(sets()[1].done).toBe(false)+ })++ it('stops when its own row is removed, and logs nothing anywhere', () => {+ setActive([timed([30, 40])])+ render()+ act(() => [...container.querySelectorAll('button[aria-label="Start set"]')][1].click())+ act(() => { deleteActiveSet(0, 1) })+ expect(useUI.getState().work).toBeNull()+ expect(toast()).toBe('Set 2 gone. Its timer stopped too.')+ act(() => vi.advanceTimersByTime(60_000))+ expect(sets()).toEqual([{ sec: 30, w: 0, done: false }])+ })++++ it('moves the saved owner along too, so a reload brings the hold back to its own row', () => {++ setActive([timed([30, 40, 50])])++ render()++ act(() => [...container.querySelectorAll('button[aria-label="Start set"]')][2].click())++ expect(useUI.getState().work.owner).toMatchObject({ idx: 0, i: 2 })++ act(() => { copyActiveSet(0, 0) })++ expect(useUI.getState().work.owner).toMatchObject({ idx: 0, i: 3 })++ act(() => { deleteActiveSet(0, 0) })++ expect(useUI.getState().work.owner).toMatchObject({ idx: 0, i: 2 })++ })++})++++describe('a timed per-side hold (an L row and an R row)', () => {++ const pair = sec => [{ sec, w: 0, done: false, side: 'L' }, { sec, w: 0, done: false, side: 'R' }]++ const sided = rows => entry('1002', rows, { target: { sets: rows.length / 2, sec: 30, mode: 'time', side: true } })++++ it('removes both halves as one set, and Undo puts both back', () => {++ const rows = [...pair(30), ...pair(40)]++ setActive([sided(rows)])++ deleteActiveSet(0, 1)++ expect(sets()).toEqual(pair(40))++ expect(toast()).toBe('Set 1 gone.')++ act(() => useUI.getState().runToastAction())++ expect(sets()).toEqual(rows)++ })++++ it('keeps the last pair of a live session', () => {++ setActive([sided(pair(30))])++ expect(deleteActiveSet(0, 0)).toBe(false)++ expect(sets()).toEqual(pair(30))++ expect(toast()).toBe('Keep at least one set, champ')++ })+ })++ describe('the swipe on a rendered set row', () => {+ const swrows = () => [...container.querySelectorAll('.swrow')]+ // happy-dom lays nothing out: give rows a phone's width so the thresholds mean what they do there.+ let widthSpy+ beforeEach(() => { widthSpy = vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(360) })+ afterEach(() => widthSpy.mockRestore())+ const repsPlus = k => swrows()[k].querySelectorAll('button[aria-label="Increase"]')[1]++ it('wraps every set row when on, and none when off', () => {+ setActive([entry('1001', [row(80), row(80)])])+ render()+ expect(swrows()).toHaveLength(2)+ expect(swrows()[0].hasAttribute('data-swipe-ignore')).toBe(true)+ // the two buttons behind the row are out of reach while it is shut+ for (const pane of swrows()[0].querySelectorAll('.swpane')) {+ expect(pane.getAttribute('aria-hidden')).toBe('true')+ expect(pane.hasAttribute('inert')).toBe(true)+ expect(pane.querySelector('button').tabIndex).toBe(-1)+ }+ act(() => root.unmount()); container.remove()++ setActive([entry('1001', [row(80), row(80)])], { wc: { swipeSets: false } })+ render()+ expect(swrows()).toHaveLength(0)+ expect(container.querySelector('[data-swipe-ignore]')).toBeNull()+ expect(container.querySelectorAll('.setrow')).toHaveLength(2)+ })++ it('a tap on + is a tap, a swipe that starts on + does not press it', () => {+ setActive([entry('1001', [row(80), row(80)])])+ render()+ pointer(repsPlus(0), 'pointerdown', 200)+ pointer(repsPlus(0), 'pointerup', 200)+ click(repsPlus(0))+ expect(sets()[0].r).toBe(9)++ swipe(repsPlus(0), 200, 250) // short: opens on Copy, nothing pressed+ expect(sets()[0].r).toBe(9)+ expect(sets()).toHaveLength(2)+ })++ it('a long swipe toward the end copies, toward the start removes with Undo', () => {+ setActive([entry('1001', [row(80, true), row(70)])])+ render()+ swipe(swrows()[0], 100, 330)+ act(() => vi.advanceTimersByTime(400))+ expect(sets().map(s => [s.w, s.done])).toEqual([[80, true], [80, false], [70, false]])++ swipe(swrows()[2], 330, 60)+ act(() => vi.advanceTimersByTime(800))+ expect(sets().map(s => s.w)).toEqual([80, 80])+ expect(toast()).toBe('Set 3 gone.')+ act(() => useUI.getState().runToastAction())+ expect(sets().map(s => s.w)).toEqual([80, 80, 70])+ })++ it('mirrors in Arabic: a swipe to the right removes', () => {+ document.documentElement.dir = 'rtl'+ setActive([entry('1001', [row(80), row(70)])])+ render()+ swipe(swrows()[1], 60, 330)+ act(() => vi.advanceTimersByTime(800))+ expect(sets().map(s => s.w)).toEqual([80])+ })++ it('rubber-bands the last set back and says why', () => {+ setActive([entry('1001', [row(80)])])+ render()+ expect(swrows()[0].querySelector('.swpane.del').classList.contains('dis')).toBe(true)+ swipe(swrows()[0], 330, 60)+ act(() => vi.advanceTimersByTime(800))+ expect(sets()).toHaveLength(1)+ expect(toast()).toBe('Keep at least one set, champ')+ })++ it('leaves vertical moves, mouse drags and the screen edges alone', () => {+ setActive([entry('1001', [row(80), row(70)])])+ render()+ swipe(swrows()[1], 200, 120, { dy: 200 }) // mostly down: a scroll+ swipe(swrows()[1], 330, 60, { pointerType: 'mouse' })+ swipe(swrows()[1], 10, 300) // from the left edge: iOS back+ act(() => vi.advanceTimersByTime(800))+ expect(sets().map(s => s.w)).toEqual([80, 70])+ })++ it('a short swipe opens the row on a real button, and that button acts', () => {+ setActive([entry('1001', [row(80), row(70)])])+ render()+ swipe(swrows()[1], 300, 240)+ const del = swrows()[1].querySelector('.swpane.del')+ expect(del.hasAttribute('inert')).toBe(false)+ expect(del.querySelector('button').tabIndex).toBe(0)+ click(del.querySelector('button'))+ act(() => vi.advanceTimersByTime(800))+ expect(sets().map(s => s.w)).toEqual([80])+ })++ it('in Cards, a swipe on a set row never turns the card', () => {+ setActive([entry('1001', [row(80), row(70)]), entry('1002', [row(50)])])+ render()+ swipe(swrows()[0], 300, 240)+ act(() => vi.advanceTimersByTime(800))+ expect(useStore.getState().S.active.cur).toBe(0)+ })+ })++ describe('the one-time hint', () => {+ it('nudges the first unticked set once per person, with a chip', () => {+ setActive([entry('1001', [row(80, true), row(80)])], { hints: {} })+ render()+ expect(container.querySelector('.swhint')).toBeNull()+ act(() => vi.advanceTimersByTime(700))+ expect(useStore.getState().S.hints.swipeSets).toBe(true)+ expect(useUI.getState().swipeHint).toMatchObject({ idx: 0, i: 1 })+ expect(container.querySelector('.swhint').textContent).toBe('Psst: swipe a set. Left deletes, right copies.')+ act(() => vi.advanceTimersByTime(6100))+ expect(container.querySelector('.swhint')).toBeNull()+ })++ it('stays away with swiping off, or once seen', () => {+ setActive([entry('1001', [row(80)])], { hints: {}, wc: { swipeSets: false } })+ render()+ act(() => vi.advanceTimersByTime(700))+ expect(useStore.getState().S.hints.swipeSets).toBeUndefined()+ act(() => root.unmount()); container.remove()++ setActive([entry('1001', [row(80)])], { hints: { swipeSets: true } })+ render()+ act(() => vi.advanceTimersByTime(700))+ expect(useUI.getState().swipeHint).toBeNull()+ })+ })