Workout: ein Mehr-Menue pro Uebung und ein Menue pro Satz statt Tastenreihen, dazu "Bedienelemente im Training" in den Einstellungen
Vorher standen pro Uebung Notiz/Details, zwei Superset-Tasten, ein Stangen-Chip, unter den Saetzen drei Tasten und unter der Karte Prev/Next, Hinzufuegen, Hoch/Runter, Tauschen, Entfernen; pro Satz dazu +Drop/+Burst und bei Warm-ups ein X. Jetzt: - Uebungskopf: nur noch "⋯" (Notiz, Details, Progression, Stangengewicht, Aufwaermsatz, Superset mit vorheriger/naechster, Tauschen, Hoch, Runter, Entfernen). Der Notiz-Stift bleibt sichtbar, sobald eine Notiz existiert. Die Aktionen zielen auf GENAU diese Uebung, auch als Superset-Mitglied (blockProps traegt idx, moveUnitAt(at, dir) statt moveCurrentUnit). - Satznummer ist ein Button: Drop-Satz, Rest-Pause-Burst, diesen Satz entfernen (ersetzt die Chips und das Warm-up-X). Unter der Karte nur noch "Satz hinzufuegen". - Stangen-Chip wird eine Textzeile (Bearbeiten ueber das Menue). - Settings → Waehrend eines Trainings → "Bedienelemente im Training": Plus/Minus-Tasten (aus = Zahl antippen und eintippen, .stp.plain), Drop/Burst-Kuerzel an jedem Satz, Superset-Tasten im Kopf, Verschieben/Tauschen/Entfernen unter der Uebung. S.wc ueberlagert WC_DEFAULT (lib/workout-controls.js), alte Profile lesen als schlankes Layout. - menuSheet() in sheets.jsx als generisches Aktionsmenue, Icon "more". - 14 neue Strings in allen 14 Packs (pt-BR mit voce-Formen), pt-BR-Guard 617/592/088bb72a. - Tests: Menue-Pfade + Schalter neu; Move/Swap/Remove-Tests laufen mit exerciseButtons an.
This commit is contained in:
1 parent
0cbd32c0f5
commit
86d3723b88
24 files changed
+440
-43
No files matched your search
@@ -108,6 +108,7 @@ const P = {
|
||||
flag: <><path d="M6 20.4V4.2" /><path d="M6.4 5.2h13v9.2h-13" /><path d="M12.9 5.2v9.2M6.4 9.8h13" /></>,
|
||||
chartLine: <path d="M3.6 20.2V4.4M3.6 20.2h16.8M6.4 16.4l3.9-4.8 3.1 2.7 5.2-6.6" />,
|
||||
dot: <circle cx="12" cy="12" r="4.2" fill="currentColor" stroke="none" />,
|
||||
more: <><circle cx="5.5" cy="12" r="1.6" fill="currentColor" stroke="none" /><circle cx="12" cy="12" r="1.6" fill="currentColor" stroke="none" /><circle cx="18.5" cy="12" r="1.6" fill="currentColor" stroke="none" /></>,
|
||||
history: <><path d="M4.5 12.2a7.6 7.6 0 1 0 2.5-5.6" /><path d="M4.1 4.4v4.3h4.3" /><path d="M12 8.3v4.2l3.1 1.9" /></>,
|
||||
signOut: <><path d="M14.2 4.6H7a1.9 1.9 0 0 0-1.9 1.9v11a1.9 1.9 0 0 0 1.9 1.9h7.2" /><path d="m16.8 8.4 3.6 3.6-3.6 3.6M20.4 12H10.2" /></>,
|
||||
shuffle: <><path d="M3.6 7.2h2.9c1.6 0 2.8.9 3.8 2.4l3 4.8c1 1.5 2.2 2.4 3.8 2.4h2.9M3.6 16.8h2.9c1.6 0 2.8-.9 3.8-2.4l.7-1.1M15.6 9.9l.7-1.1c1-1.5 2.2-2.4 3.8-2.4h1.9" /><path d="m17.9 4.3 2.8 2.1-2.8 2.1M17.9 14.7l2.8 2.1-2.8 2.1" /></>,
|
||||
|
||||
@@ -639,6 +639,7 @@ h4.sec{
|
||||
.setrow .n{
|
||||
width:24px;height:24px;border-radius:50%;background:var(--surface-2);color:var(--label-2);
|
||||
display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;flex:none;
|
||||
position:relative;padding:0;border:0;font-family:inherit;cursor:pointer;
|
||||
transition:background var(--fast),color var(--fast);
|
||||
}
|
||||
.setrow .stp.w{flex:1.4;min-width:0}
|
||||
@@ -667,6 +668,19 @@ h4.sec{
|
||||
.subrow .stp.mini button{width:26px;height:30px}
|
||||
.subrow .stp.mini .num{font-size:13px;min-height:30px}
|
||||
.subrow .iconbtn{width:26px;height:26px;font-size:11px;flex:none}
|
||||
/* The number is the set's menu (drop / burst / remove); a 24px circle needs a finger-sized hit area. */
|
||||
.setrow .n::before{content:'';position:absolute;inset:-10px}
|
||||
/* No +/- buttons: the number field takes the whole cell and is the tap target. */
|
||||
.stp.plain{grid-template-columns:1fr}
|
||||
.stp.plain .val{width:100%}
|
||||
.stp.plain .num{width:100%;text-align:center}
|
||||
/* --- menu sheet (the workout's "more" menus) --- */
|
||||
.menu-list .menu-item{min-height:52px;padding:8px 12px}
|
||||
.menu-list .menu-item .lrow-i{width:32px;height:32px;font-size:16px;background:var(--surface-2);color:var(--label)}
|
||||
.menu-list .menu-item.danger .tt,.menu-list .menu-item.danger .lrow-i{color:var(--red)}
|
||||
.menu-list .menu-item.disabled{opacity:.4;pointer-events:none}
|
||||
.menu-on{color:transparent;font-size:16px;flex:none}
|
||||
.menu-on.is-on{color:var(--acc)}
|
||||
.setextra{display:flex;flex-wrap:wrap;gap:6px;margin:2px 0 8px 32px}
|
||||
.setextra .chip.add{display:inline-flex;align-items:center;gap:4px;color:var(--acc)}
|
||||
.setextra .chip.add svg{width:13px;height:13px}
|
||||
|
||||
@@ -27,11 +27,11 @@ describe('Brazilian Portuguese locale', () => {
|
||||
.sort(byCodeUnit)
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
|
||||
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(612)
|
||||
expect(inherited).toHaveLength(583)
|
||||
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(617)
|
||||
expect(inherited).toHaveLength(592)
|
||||
// If this fails, review the changed keys and wording before accepting a new hash. From
|
||||
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('c7ddbc412a3e758704289b4414372f2cbc0e26be4c0a0d95676cb3316ecae85a')
|
||||
expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('088bb72a6ce33793bcc81215c2e7fc036226d8f144c53a633982e5b336226293')
|
||||
})
|
||||
|
||||
test('does not leak European Portuguese UI terms', () => {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Which optional control groups the workout screen shows besides the sets themselves
|
||||
// (Settings → During a workout → Workout controls). The lean default keeps the sets and one
|
||||
// "more" button per exercise; each flag brings one of the old always-visible groups back.
|
||||
// Lives in its own module so views can read it without the store — the store's DEF only
|
||||
// references it.
|
||||
export const WC_DEFAULT = Object.freeze({
|
||||
steppers: true, // +/- buttons on every weight/reps/effort field
|
||||
setShortcuts: false, // "+ Drop" / "+ Burst" chips on every set and the warm-up/remove/add row
|
||||
pairButtons: false, // "Make superset with previous/next" in the exercise header
|
||||
exerciseButtons: false, // Move up/down, Swap, Remove exercise below the exercise
|
||||
})
|
||||
|
||||
export function workoutControls(S) {
|
||||
return { ...WC_DEFAULT, ...((S && S.wc) || {}) }
|
||||
}
|
||||
@@ -1156,4 +1156,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Richte die Kamera auf den QR-Code',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Die Kamera ist hier nicht verfügbar — importiere ein Foto oder tippe den Code ein.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Kamerazugriff wurde verweigert — erlaube ihn im Browser und versuche es erneut.',
|
||||
'Add note': 'Notiz hinzufügen',
|
||||
'Edit note': 'Notiz bearbeiten',
|
||||
'Progression settings': 'Progressions-Einstellungen',
|
||||
'Set {0}': 'Satz {0}',
|
||||
'Drop set': 'Drop-Satz',
|
||||
'Rest-pause burst': 'Rest-Pause-Burst',
|
||||
'Remove this set': 'Diesen Satz entfernen',
|
||||
'Workout controls': 'Bedienelemente im Training',
|
||||
'Weight and reps buttons': 'Plus/Minus-Tasten für Gewicht und Wdh.',
|
||||
'Off: tap the number and type it': 'Aus: Zahl antippen und eintippen',
|
||||
'Drop and burst shortcuts on every set': 'Drop/Burst-Kürzel an jedem Satz',
|
||||
'Superset buttons in the exercise header': 'Superset-Tasten im Übungskopf',
|
||||
'Move, swap and remove buttons below the exercise': 'Verschieben/Tauschen/Entfernen-Tasten unter der Übung',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Alles, was hier ausgeblendet ist, bleibt einen Tipp entfernt: die ⋯-Taste einer Übung und die Nummer eines Satzes.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Apunta la cámara al código QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'La cámara no está disponible aquí — importa una foto o escribe el código.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Se denegó el acceso a la cámara — permítelo en el navegador e inténtalo de nuevo.',
|
||||
'Add note': 'Añadir nota',
|
||||
'Edit note': 'Editar nota',
|
||||
'Progression settings': 'Ajustes de progresión',
|
||||
'Set {0}': 'Serie {0}',
|
||||
'Drop set': 'Serie descendente',
|
||||
'Rest-pause burst': 'Ráfaga rest-pause',
|
||||
'Remove this set': 'Quitar esta serie',
|
||||
'Workout controls': 'Controles del entrenamiento',
|
||||
'Weight and reps buttons': 'Botones +/− de peso y repeticiones',
|
||||
'Off: tap the number and type it': 'Desactivado: toca el número y escríbelo',
|
||||
'Drop and burst shortcuts on every set': 'Atajos de drop y ráfaga en cada serie',
|
||||
'Superset buttons in the exercise header': 'Botones de superserie en la cabecera del ejercicio',
|
||||
'Move, swap and remove buttons below the exercise': 'Botones mover, cambiar y quitar debajo del ejercicio',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Todo lo que ocultes aquí sigue a un toque: el botón ⋯ de un ejercicio y el número de una serie.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Pointez la caméra vers le code QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'La caméra n’est pas disponible ici — importez une photo ou saisissez le code.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'L’accès à la caméra a été refusé — autorisez-le dans le navigateur et réessayez.',
|
||||
'Add note': 'Ajouter une note',
|
||||
'Edit note': 'Modifier la note',
|
||||
'Progression settings': 'Réglages de progression',
|
||||
'Set {0}': 'Série {0}',
|
||||
'Drop set': 'Série dégressive',
|
||||
'Rest-pause burst': 'Rafale rest-pause',
|
||||
'Remove this set': 'Supprimer cette série',
|
||||
'Workout controls': 'Commandes pendant la séance',
|
||||
'Weight and reps buttons': 'Boutons +/− poids et répétitions',
|
||||
'Off: tap the number and type it': 'Désactivé : touchez le nombre et saisissez-le',
|
||||
'Drop and burst shortcuts on every set': 'Raccourcis drop et rafale sur chaque série',
|
||||
'Superset buttons in the exercise header': 'Boutons superset dans l\'en-tête de l\'exercice',
|
||||
'Move, swap and remove buttons below the exercise': 'Boutons déplacer, remplacer et retirer sous l\'exercice',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Tout ce qui est masqué ici reste à un tap : le bouton ⋯ d\'un exercice et le numéro d\'une série.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'कैमरे को QR कोड पर रखें',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'कैमरा यहाँ उपलब्ध नहीं है — फ़ोटो इंपोर्ट करें या कोड टाइप करें।',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'कैमरे की अनुमति नहीं मिली — ब्राउज़र में अनुमति दें और फिर कोशिश करें।',
|
||||
'Add note': 'नोट जोड़ें',
|
||||
'Edit note': 'नोट संपादित करें',
|
||||
'Progression settings': 'प्रगति सेटिंग',
|
||||
'Set {0}': 'सेट {0}',
|
||||
'Drop set': 'ड्रॉप सेट',
|
||||
'Rest-pause burst': 'रेस्ट-पॉज़ बर्स्ट',
|
||||
'Remove this set': 'यह सेट हटाएँ',
|
||||
'Workout controls': 'वर्कआउट नियंत्रण',
|
||||
'Weight and reps buttons': 'वज़न और रेप्स के +/− बटन',
|
||||
'Off: tap the number and type it': 'बंद: संख्या पर टैप करें और टाइप करें',
|
||||
'Drop and burst shortcuts on every set': 'हर सेट पर ड्रॉप और बर्स्ट शॉर्टकट',
|
||||
'Superset buttons in the exercise header': 'व्यायाम शीर्षक में सुपरसेट बटन',
|
||||
'Move, swap and remove buttons below the exercise': 'व्यायाम के नीचे स्थानांतरित, बदलें और हटाएँ बटन',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'यहाँ छिपाया गया सब कुछ एक टैप दूर रहता है: व्यायाम का ⋯ बटन और सेट की संख्या।',
|
||||
}
|
||||
@@ -1140,4 +1140,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Irányítsd a kamerát a QR-kódra',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'A kamera itt nem elérhető — importálj egy fotót vagy írd be a kódot.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'A kamera-hozzáférés elutasítva — engedélyezd a böngészőben, és próbáld újra.',
|
||||
'Add note': 'Jegyzet hozzáadása',
|
||||
'Edit note': 'Jegyzet szerkesztése',
|
||||
'Progression settings': 'Progresszió beállításai',
|
||||
'Set {0}': '{0}. sorozat',
|
||||
'Drop set': 'Drop szett',
|
||||
'Rest-pause burst': 'Rest-pause sorozat',
|
||||
'Remove this set': 'Sorozat eltávolítása',
|
||||
'Workout controls': 'Vezérlők edzés közben',
|
||||
'Weight and reps buttons': 'Súly és ismétlés +/− gombok',
|
||||
'Off: tap the number and type it': 'Ki: koppints a számra és írd be',
|
||||
'Drop and burst shortcuts on every set': 'Drop és rest-pause gyorsgombok minden sorozatnál',
|
||||
'Superset buttons in the exercise header': 'Szuperszett gombok a gyakorlat fejlécében',
|
||||
'Move, swap and remove buttons below the exercise': 'Mozgatás, csere és eltávolítás gombok a gyakorlat alatt',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Minden, amit itt elrejtesz, egy koppintásra marad: a gyakorlat ⋯ gombja és a sorozat száma.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Inquadra il codice QR con la fotocamera',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'La fotocamera non è disponibile qui — importa una foto o digita il codice.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Accesso alla fotocamera negato — consentilo nel browser e riprova.',
|
||||
'Add note': 'Aggiungi nota',
|
||||
'Edit note': 'Modifica nota',
|
||||
'Progression settings': 'Impostazioni di progressione',
|
||||
'Set {0}': 'Serie {0}',
|
||||
'Drop set': 'Drop set',
|
||||
'Rest-pause burst': 'Raffica rest-pause',
|
||||
'Remove this set': 'Rimuovi questa serie',
|
||||
'Workout controls': 'Controlli durante l’allenamento',
|
||||
'Weight and reps buttons': 'Pulsanti +/− di peso e ripetizioni',
|
||||
'Off: tap the number and type it': 'Disattivato: tocca il numero e digitalo',
|
||||
'Drop and burst shortcuts on every set': 'Scorciatoie drop e raffica su ogni serie',
|
||||
'Superset buttons in the exercise header': 'Pulsanti superset nell’intestazione dell’esercizio',
|
||||
'Move, swap and remove buttons below the exercise': 'Pulsanti sposta, sostituisci e rimuovi sotto l’esercizio',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Tutto ciò che nascondi qui resta a un tocco: il pulsante ⋯ di un esercizio e il numero di una serie.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': '카메라를 QR 코드에 맞추세요',
|
||||
'Camera is not available here — import a photo or type the code instead.': '여기서는 카메라를 사용할 수 없습니다 — 사진을 가져오거나 코드를 입력하세요.',
|
||||
'Camera access was denied — allow it in your browser and try again.': '카메라 접근이 거부되었습니다 — 브라우저에서 허용한 뒤 다시 시도하세요.',
|
||||
'Add note': '메모 추가',
|
||||
'Edit note': '메모 편집',
|
||||
'Progression settings': '진행 설정',
|
||||
'Set {0}': '{0}세트',
|
||||
'Drop set': '드롭 세트',
|
||||
'Rest-pause burst': '레스트 포즈',
|
||||
'Remove this set': '이 세트 삭제',
|
||||
'Workout controls': '운동 중 버튼',
|
||||
'Weight and reps buttons': '무게·횟수 +/− 버튼',
|
||||
'Off: tap the number and type it': '끄면 숫자를 눌러 직접 입력',
|
||||
'Drop and burst shortcuts on every set': '모든 세트에 드롭·레스트 포즈 바로가기',
|
||||
'Superset buttons in the exercise header': '운동 제목의 슈퍼세트 버튼',
|
||||
'Move, swap and remove buttons below the exercise': '운동 아래의 이동·교체·삭제 버튼',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': '여기서 숨긴 것은 모두 한 번의 탭으로 열 수 있습니다: 운동의 ⋯ 버튼과 세트 번호.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Skieruj aparat na kod QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Aparat nie jest tu dostępny — zaimportuj zdjęcie lub wpisz kod.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Odmówiono dostępu do aparatu — zezwól w przeglądarce i spróbuj ponownie.',
|
||||
'Add note': 'Dodaj notatkę',
|
||||
'Edit note': 'Edytuj notatkę',
|
||||
'Progression settings': 'Ustawienia progresji',
|
||||
'Set {0}': 'Seria {0}',
|
||||
'Drop set': 'Drop set',
|
||||
'Rest-pause burst': 'Seria rest-pause',
|
||||
'Remove this set': 'Usuń tę serię',
|
||||
'Workout controls': 'Przyciski podczas treningu',
|
||||
'Weight and reps buttons': 'Przyciski +/− ciężaru i powtórzeń',
|
||||
'Off: tap the number and type it': 'Wyłączone: dotknij liczby i wpisz ją',
|
||||
'Drop and burst shortcuts on every set': 'Skróty drop i rest-pause przy każdej serii',
|
||||
'Superset buttons in the exercise header': 'Przyciski superserii w nagłówku ćwiczenia',
|
||||
'Move, swap and remove buttons below the exercise': 'Przyciski przenieś, zamień i usuń pod ćwiczeniem',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Wszystko, co tu ukryjesz, jest o jedno dotknięcie: przycisk ⋯ ćwiczenia i numer serii.',
|
||||
}
|
||||
@@ -638,6 +638,11 @@ export const PT_BR_OVERRIDES = {
|
||||
'Clear selection': 'Limpar seleção',
|
||||
'Primary target': 'Músculo principal',
|
||||
'Also trains': 'Também trabalha',
|
||||
'Progression settings': 'Configurações de progressão',
|
||||
'Workout controls': 'Controles durante o treino',
|
||||
'Off: tap the number and type it': 'Desligado: toque no número e digite',
|
||||
'Move, swap and remove buttons below the exercise': 'Botões mover, trocar e remover abaixo do exercício',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Tudo o que você esconde aqui fica a um toque: o botão ⋯ de um exercício e o número de uma série.',
|
||||
}
|
||||
|
||||
export default { ...pt, ...PT_BR_OVERRIDES }
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Aponta a câmara para o código QR',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'A câmara não está disponível aqui — importa uma foto ou escreve o código.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'O acesso à câmara foi recusado — permite-o no navegador e tenta de novo.',
|
||||
'Add note': 'Adicionar nota',
|
||||
'Edit note': 'Editar nota',
|
||||
'Progression settings': 'Definições de progressão',
|
||||
'Set {0}': 'Série {0}',
|
||||
'Drop set': 'Drop set',
|
||||
'Rest-pause burst': 'Rajada rest-pause',
|
||||
'Remove this set': 'Remover esta série',
|
||||
'Workout controls': 'Controlos durante o treino',
|
||||
'Weight and reps buttons': 'Botões +/− de peso e repetições',
|
||||
'Off: tap the number and type it': 'Desligado: toca no número e escreve-o',
|
||||
'Drop and burst shortcuts on every set': 'Atalhos de drop e rajada em cada série',
|
||||
'Superset buttons in the exercise header': 'Botões de superset no cabeçalho do exercício',
|
||||
'Move, swap and remove buttons below the exercise': 'Botões mover, trocar e remover por baixo do exercício',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Tudo o que escondes aqui fica a um toque: o botão ⋯ de um exercício e o número de uma série.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Наведите камеру на QR-код',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Камера здесь недоступна — импортируйте фото или введите код.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Доступ к камере запрещён — разрешите его в браузере и попробуйте снова.',
|
||||
'Add note': 'Добавить заметку',
|
||||
'Edit note': 'Изменить заметку',
|
||||
'Progression settings': 'Настройки прогрессии',
|
||||
'Set {0}': 'Подход {0}',
|
||||
'Drop set': 'Дроп-сет',
|
||||
'Rest-pause burst': 'Отдых-пауза',
|
||||
'Remove this set': 'Удалить этот подход',
|
||||
'Workout controls': 'Кнопки во время тренировки',
|
||||
'Weight and reps buttons': 'Кнопки +/− для веса и повторений',
|
||||
'Off: tap the number and type it': 'Выкл.: нажмите на число и введите его',
|
||||
'Drop and burst shortcuts on every set': 'Кнопки дроп-сета и отдых-паузы у каждого подхода',
|
||||
'Superset buttons in the exercise header': 'Кнопки суперсета в заголовке упражнения',
|
||||
'Move, swap and remove buttons below the exercise': 'Кнопки переместить, заменить и удалить под упражнением',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Всё скрытое здесь остаётся в одном нажатии: кнопка ⋯ упражнения и номер подхода.',
|
||||
}
|
||||
@@ -1148,4 +1148,18 @@ export default {
|
||||
'Point the camera at the QR code': 'เล็งกล้องไปที่ QR โค้ด',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'ใช้กล้องที่นี่ไม่ได้ — นำเข้ารูปภาพหรือพิมพ์รหัสแทน',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'การเข้าถึงกล้องถูกปฏิเสธ — อนุญาตในเบราว์เซอร์แล้วลองอีกครั้ง',
|
||||
'Add note': 'เพิ่มโน้ต',
|
||||
'Edit note': 'แก้ไขโน้ต',
|
||||
'Progression settings': 'ตั้งค่าการเพิ่มน้ำหนัก',
|
||||
'Set {0}': 'เซ็ต {0}',
|
||||
'Drop set': 'ดรอปเซ็ต',
|
||||
'Rest-pause burst': 'เรสต์พอส',
|
||||
'Remove this set': 'ลบเซ็ตนี้',
|
||||
'Workout controls': 'ปุ่มระหว่างออกกำลังกาย',
|
||||
'Weight and reps buttons': 'ปุ่ม +/− น้ำหนักและจำนวนครั้ง',
|
||||
'Off: tap the number and type it': 'ปิด: แตะตัวเลขแล้วพิมพ์เอง',
|
||||
'Drop and burst shortcuts on every set': 'ปุ่มลัดดรอปเซ็ตและเรสต์พอสทุกเซ็ต',
|
||||
'Superset buttons in the exercise header': 'ปุ่มซูเปอร์เซ็ตในหัวข้อท่า',
|
||||
'Move, swap and remove buttons below the exercise': 'ปุ่มย้าย สลับ และลบใต้ท่าออกกำลังกาย',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'ทุกอย่างที่ซ่อนไว้ยังอยู่ห่างแค่แตะเดียว: ปุ่ม ⋯ ของท่าและหมายเลขเซ็ต',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': 'Kamerayı QR koda tutun',
|
||||
'Camera is not available here — import a photo or type the code instead.': 'Kamera burada kullanılamıyor — bir fotoğraf içe aktarın veya kodu yazın.',
|
||||
'Camera access was denied — allow it in your browser and try again.': 'Kamera erişimi reddedildi — tarayıcıda izin verip tekrar deneyin.',
|
||||
'Add note': 'Not ekle',
|
||||
'Edit note': 'Notu düzenle',
|
||||
'Progression settings': 'İlerleme ayarları',
|
||||
'Set {0}': 'Set {0}',
|
||||
'Drop set': 'Drop set',
|
||||
'Rest-pause burst': 'Rest-pause patlaması',
|
||||
'Remove this set': 'Bu seti kaldır',
|
||||
'Workout controls': 'Antrenman kontrolleri',
|
||||
'Weight and reps buttons': 'Ağırlık ve tekrar +/− düğmeleri',
|
||||
'Off: tap the number and type it': 'Kapalı: sayıya dokunup yazın',
|
||||
'Drop and burst shortcuts on every set': 'Her sette drop ve patlama kısayolları',
|
||||
'Superset buttons in the exercise header': 'Egzersiz başlığında süperset düğmeleri',
|
||||
'Move, swap and remove buttons below the exercise': 'Egzersizin altında taşı, değiştir ve kaldır düğmeleri',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': 'Burada gizlenen her şey bir dokunuş uzakta kalır: egzersizin ⋯ düğmesi ve setin numarası.',
|
||||
}
|
||||
@@ -1137,4 +1137,18 @@ export default {
|
||||
'Point the camera at the QR code': '将摄像头对准二维码',
|
||||
'Camera is not available here — import a photo or type the code instead.': '此处无法使用摄像头 — 请导入照片或手动输入代码。',
|
||||
'Camera access was denied — allow it in your browser and try again.': '摄像头访问被拒绝 — 请在浏览器中允许后重试。',
|
||||
'Add note': '添加备注',
|
||||
'Edit note': '编辑备注',
|
||||
'Progression settings': '渐进设置',
|
||||
'Set {0}': '第 {0} 组',
|
||||
'Drop set': '递减组',
|
||||
'Rest-pause burst': '休息暂停组',
|
||||
'Remove this set': '删除这一组',
|
||||
'Workout controls': '训练中的按钮',
|
||||
'Weight and reps buttons': '重量和次数的 +/− 按钮',
|
||||
'Off: tap the number and type it': '关闭:点按数字直接输入',
|
||||
'Drop and burst shortcuts on every set': '每组显示递减/休息暂停快捷按钮',
|
||||
'Superset buttons in the exercise header': '动作标题中的超级组按钮',
|
||||
'Move, swap and remove buttons below the exercise': '动作下方的移动、替换和删除按钮',
|
||||
'Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.': '这里隐藏的一切都只需一次点按:动作的 ⋯ 按钮和组号。',
|
||||
}
|
||||
@@ -49,6 +49,31 @@ function ConfirmDialog({ title, message, confirmText, cancelText, danger, onConf
|
||||
<Button variant="ghost" className="dim" onClick={close}>{cancelText || t('Cancel')}</Button>
|
||||
</div>
|
||||
}
|
||||
/* ============================ menu sheet ============================ */
|
||||
// A list of actions, one per row, closing on tap. This is where the workout screen parks
|
||||
// everything that is not a set you are about to log: the point of a single "more" button is
|
||||
// that the ten things you do once a session stop competing with the two you do every set.
|
||||
// items: [{ icon, label, sub, onClick, danger, disabled, on }] — `on` draws a check for toggles.
|
||||
function MenuSheet({ title, subtitle, items, close }) {
|
||||
return <>
|
||||
{title && <h3 style={{ marginBottom: subtitle ? 2 : 10 }}>{title}</h3>}
|
||||
{subtitle && <div className="muted small" style={{ marginBottom: 10 }}>{subtitle}</div>}
|
||||
<div className="list menu-list">
|
||||
{items.filter(Boolean).map((it, i) => <div key={i}
|
||||
className={'item menu-item' + (it.danger ? ' danger' : '') + (it.disabled ? ' disabled' : '')}
|
||||
aria-disabled={it.disabled || undefined}
|
||||
{...tappable(it.disabled ? null : () => { close(); it.onClick && it.onClick() })}>
|
||||
{it.icon && <span className="lrow-i"><Icon name={it.icon} /></span>}
|
||||
<div className="grow"><div className="tt">{it.label}</div>{it.sub && <div className="ss">{it.sub}</div>}</div>
|
||||
{it.on != null && <span className={'menu-on' + (it.on ? ' is-on' : '')}><Icon name="check" /></span>}
|
||||
</div>)}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
export function menuSheet(opts) {
|
||||
ui().openSheet(close => <MenuSheet {...opts} close={close} />)
|
||||
}
|
||||
|
||||
// Themed replacement for window.confirm — callback-based (no blocking).
|
||||
export function confirmSheet(opts) {
|
||||
ui().openSheet(close => <ConfirmDialog {...opts} close={close} />, { kind: 'center' })
|
||||
|
||||
@@ -8,6 +8,8 @@ import { MOBILE, initReminderSync, nativeLoad, nativeSave, syncReminder, writeAu
|
||||
import { loadRemote, chooseLocal, forgetRemote, connect } from '../lib/remote.js'
|
||||
import { loadCoachDevice, saveCoachDevice, coachDeviceSettings } from '../lib/coach-device.js'
|
||||
|
||||
import { WC_DEFAULT } from '../lib/workout-controls.js'
|
||||
|
||||
const KEY = 'gym_state_v1'
|
||||
export const DEF = {
|
||||
unit: 'kg', restSec: 90, restPauseSec: 15, sound: true, timerFlash: false, keepAwake: true, lang: 'en',
|
||||
@@ -18,6 +20,10 @@ export const DEF = {
|
||||
// or 'list' (every exercise stacked and scrollable). Purely presentational: profiles
|
||||
// written before this setting existed overlay onto DEF and keep the 'cards' behaviour.
|
||||
workoutView: 'cards',
|
||||
// Which controls the workout screen shows besides the sets themselves. The default is the
|
||||
// lean layout: one "more" button per exercise and a menu on each set number. Every switch
|
||||
// brings one of the old always-visible button groups back (Settings → During a workout).
|
||||
wc: { ...WC_DEFAULT },
|
||||
// effort: which per-set effort scale is logged — 'none' | 'rir' | 'rpe'. null, not 'none', so
|
||||
// that a profile which never chose (loaded state is overlaid on DEF, on every path: local,
|
||||
// server pull, backup import) still falls back to the `showRir` boolean this replaced and
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useStore, DEF, hasData } from '../store/useStore.js'
|
||||
import { workoutControls } from '../lib/workout-controls.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { ACCENTS, todayISO, localTZ, weekStartOf, MONDAY, SUNDAY } from '../lib/format.js'
|
||||
import { effortOf } from '../lib/history.js'
|
||||
@@ -157,6 +158,11 @@ export default function Settings() {
|
||||
value={S.workoutView === 'list' ? 'list' : 'cards'}
|
||||
onChange={v => update(s => { s.workoutView = v })} />
|
||||
</Row>
|
||||
{/* The lean workout screen keeps the sets and one "more" button per exercise; each switch
|
||||
brings one of the old always-visible button groups back for people who liked them. */}
|
||||
<Row icon="wrench" iconTint="var(--purple)" title={t('Workout controls')} accessory="chevron"
|
||||
subtitle={t('Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.')}
|
||||
onClick={() => workoutControlsSheet()} />
|
||||
<SelectRow icon="timer" iconTint="var(--orange)" title={t('Rest timer')}
|
||||
value={S.restSec} onChange={v => update(s => { s.restSec = v })}
|
||||
options={[{ value: 0, label: t('Off') }, ...[60, 90, 120, 150, 180].map(v => ({ value: v, label: v + 's' }))]} />
|
||||
@@ -292,6 +298,36 @@ const EFFORT_ROWS = [
|
||||
// against. Not where the stepper starts; + walks up from the bottom of the scale.
|
||||
const EFFORT_TYPICAL = 2
|
||||
|
||||
// Settings → During a workout → Workout controls. S.wc overlays DEF.wc, so a profile from
|
||||
// before this setting existed reads as the lean default.
|
||||
function WorkoutControlsSheet() {
|
||||
const S = useStore(s => s.S)
|
||||
const update = useStore(s => s.update)
|
||||
const wc = workoutControls(S)
|
||||
const set = (k, v) => update(s => { s.wc = { ...workoutControls(s), [k]: v } })
|
||||
return <>
|
||||
<h3>{t('Workout controls')}</h3>
|
||||
<div className="muted small" style={{ marginBottom: 12 }}>{t('Everything hidden here stays one tap away: the ⋯ button of an exercise and the number of a set.')}</div>
|
||||
<Section>
|
||||
<Row icon="plus" iconTint="var(--acc)" title={t('Weight and reps buttons')} subtitle={t('Off: tap the number and type it')}>
|
||||
<Switch checked={wc.steppers} onChange={v => set('steppers', v)} />
|
||||
</Row>
|
||||
<Row icon="bolt" iconTint="var(--orange)" title={t('Drop and burst shortcuts on every set')}>
|
||||
<Switch checked={wc.setShortcuts} onChange={v => set('setShortcuts', v)} />
|
||||
</Row>
|
||||
<Row icon="link" iconTint="var(--blue)" title={t('Superset buttons in the exercise header')}>
|
||||
<Switch checked={wc.pairButtons} onChange={v => set('pairButtons', v)} />
|
||||
</Row>
|
||||
<Row icon="shuffle" iconTint="var(--teal)" title={t('Move, swap and remove buttons below the exercise')}>
|
||||
<Switch checked={wc.exerciseButtons} onChange={v => set('exerciseButtons', v)} />
|
||||
</Row>
|
||||
</Section>
|
||||
</>
|
||||
}
|
||||
function workoutControlsSheet() {
|
||||
useUI.getState().openSheet(() => <WorkoutControlsSheet />)
|
||||
}
|
||||
|
||||
function effortHelpSheet() {
|
||||
useUI.getState().openSheet(close => <>
|
||||
<h3>{t('Effort per set')}</h3>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { workoutControls } from '../lib/workout-controls.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { exOr } from '../lib/exercises.js'
|
||||
import { usesBar, barWeightFor, plateSplit } from '../lib/bar.js'
|
||||
@@ -11,7 +12,7 @@ import { t, exerciseNameFor } from '../lib/i18n.js'
|
||||
import { api } from '../lib/api.js'
|
||||
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from '../lib/supersetFlow.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet } from '../sheets.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button, Check, NumberField } from '../components/ui.jsx'
|
||||
import { nextPrescription, applyPrescription, defaultIncrement, weightIncrement, stepWeight } from '../lib/progression.js'
|
||||
@@ -63,7 +64,7 @@ function Elapsed({ start }) {
|
||||
}
|
||||
|
||||
/* ---------- one exercise block (reps: weight×reps · time: a held duration · cardio: duration+speed) ---------- */
|
||||
function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef, onProgressionSettings }) {
|
||||
function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext, onSetRowRef, onProgressionSettings, onSwap, onMoveUp, onMoveDown, canMoveUp, canMoveDown, onRemoveExercise, busy }) {
|
||||
const S = useStore(s => s.S)
|
||||
const update = useStore(s => s.update)
|
||||
const working = useUI(s => s.work)
|
||||
@@ -152,15 +153,60 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
}
|
||||
// Uses the shared stepper markup so a set row picks up the same control styling
|
||||
// as every other +/- field in the app.
|
||||
// Which of the optional control groups this profile wants on screen (Settings → During a
|
||||
// workout → Workout controls). The lean default keeps the sets and one "more" button; each
|
||||
// switch brings one of the old always-visible button rows back.
|
||||
const wc = workoutControls(S)
|
||||
const cell = (s, i, col, cls) => (
|
||||
<div className={'stp ' + cls}>
|
||||
<button aria-label="Decrease" onClick={() => bump(s, i, col, -1)}><Icon name="minus" /></button>
|
||||
<div className={'stp ' + cls + (wc.steppers ? '' : ' plain')}>
|
||||
{wc.steppers && <button aria-label="Decrease" onClick={() => bump(s, i, col, -1)}><Icon name="minus" /></button>}
|
||||
{/* a typed effort is capped — there is no RPE 12, and 12 reps in reserve is a warm-up */}
|
||||
<span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''}
|
||||
onChange={v => onField(i, col.f, col.eff ? capEffort(col.eff, v) : v)} /></span>
|
||||
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
|
||||
{wc.steppers && <button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>}
|
||||
</div>
|
||||
)
|
||||
// Everything about this exercise that is not a set you are logging right now lives behind one
|
||||
// button. What used to be a row of buttons in the header, a chip under the bar, a strip of
|
||||
// three under the sets and four more below the card is a single list you open once a session.
|
||||
const barInfo = (!cardio && !(bw && !added) && usesBar(ex)) ? (() => {
|
||||
const bar = barWeightFor(S, entry.id)
|
||||
if (!(bar > 0)) return null
|
||||
const nextW = entry.sets.find(s => !s.done)?.w
|
||||
const refW = nextW > 0 ? nextW : Math.max(0, ...entry.sets.map(s => s.w || 0))
|
||||
const split = plateSplit(refW, bar)
|
||||
return { bar, text: t('Bar {0}', fmtNum(bar) + ' ' + S.unit) + (split != null ? ' · ' + t('{0} per side', fmtNum(split) + ' ' + S.unit) : '') }
|
||||
})() : null
|
||||
const openMore = () => menuSheet({
|
||||
title: exerciseNameFor(ex),
|
||||
items: [
|
||||
{ icon: 'pencil', label: entry.note ? t('Edit note') : t('Add note'), sub: entry.note || undefined, onClick: () => exerciseNoteSheet(entryIdx) },
|
||||
{ icon: 'info', label: t('Details'), onClick: () => exerciseDetailSheet(ex) },
|
||||
onProgressionSettings && { icon: 'chartLine', label: t('Progression settings'), sub: guidance ? t(guidance.policyLabel) : undefined, onClick: onProgressionSettings },
|
||||
barInfo && { icon: 'barbell', label: t('Bar weight'), sub: barInfo.text, onClick: () => barWeightSheet(entry.id) },
|
||||
{ icon: 'flame', label: t('Add warm-up set'), onClick: onAddWarmup },
|
||||
onPairPrev && { icon: 'link', label: t('Make superset with previous'), onClick: onPairPrev },
|
||||
onPairNext && { icon: 'link', label: t('Make superset with next'), onClick: onPairNext },
|
||||
onSwap && { icon: 'shuffle', label: t('Swap exercise'), onClick: onSwap, disabled: busy },
|
||||
onMoveUp && { icon: 'chevronUp', label: t('Move up'), onClick: onMoveUp, disabled: busy || !canMoveUp },
|
||||
onMoveDown && { icon: 'chevronDown', label: t('Move down'), onClick: onMoveDown, disabled: busy || !canMoveDown },
|
||||
onRemoveExercise && { icon: 'trash', label: t('Remove exercise'), onClick: onRemoveExercise, danger: true, disabled: busy },
|
||||
],
|
||||
})
|
||||
// The set number is the set's own menu: drop / burst / remove — three things that used to
|
||||
// sit as chips and an X on every single row.
|
||||
const openSetMenu = (s, i) => {
|
||||
const warm = isWarmupRow(s)
|
||||
menuSheet({
|
||||
title: (warm ? t('Warm-up') : t('Set {0}', entry.sets.slice(0, i + 1).filter(x => isWarmupRow(x) === warm).length)),
|
||||
subtitle: setLabel(entry.id, s, entry.target),
|
||||
items: [
|
||||
!warm && mode === 'reps' && !isRestPauseSet(s) && { icon: 'arrowDown', label: t('Drop set'), sub: t('+ Drop'), onClick: () => addDropRow(i) },
|
||||
!warm && mode === 'reps' && !isDropSet(s) && { icon: 'bolt', label: t('Rest-pause burst'), sub: t('+ Burst'), onClick: () => addBurstRow(i) },
|
||||
{ icon: 'trash', label: t('Remove this set'), danger: true, disabled: entry.sets.length <= 1, onClick: () => onRemoveSetAt(i) },
|
||||
],
|
||||
})
|
||||
}
|
||||
// A smaller stepper for a drop's weight/reps or a burst's reps — editing what the plan (or a
|
||||
// live "+ Drop"/"+ Burst" tap) already put on the row, not typing into a fresh field.
|
||||
const miniStepper = (value, step, dec, onChange, snapWeightStep = false) => (
|
||||
@@ -175,13 +221,12 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
<div className="row between" style={{ marginBottom: 6 }}>
|
||||
<div style={{ fontSize: compact ? 17 : 20, fontWeight: 600, letterSpacing: '-.02em', textTransform: 'capitalize', lineHeight: 1.2 }}>{exerciseNameFor(ex)}</div>
|
||||
<div className="row" style={{ gap: 2, flex: 'none' }}>
|
||||
<button className="iconbtn" aria-label={t('Note')} title={t('Note')}
|
||||
style={entry.note ? { color: 'var(--acc)' } : undefined}
|
||||
onClick={() => exerciseNoteSheet(entryIdx)}><Icon name="pencil" /></button>
|
||||
<button className="iconbtn" aria-label={t('Details')} onClick={() => exerciseDetailSheet(ex)}><Icon name="info" /></button>
|
||||
{entry.note && <button className="iconbtn" aria-label={t('Note')} title={t('Note')} style={{ color: 'var(--acc)' }}
|
||||
onClick={() => exerciseNoteSheet(entryIdx)}><Icon name="pencil" /></button>}
|
||||
<button className="iconbtn" aria-label={t('More')} title={t('More')} onClick={openMore}><Icon name="more" /></button>
|
||||
</div>
|
||||
</div>
|
||||
{!compact && (onPairPrev || onPairNext) && <div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>
|
||||
{wc.pairButtons && !compact && (onPairPrev || onPairNext) && <div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>
|
||||
{onPairPrev && <Button size="xs" variant="tinted" icon="link" title={t('Make superset with previous')} onClick={onPairPrev}>{t('Make superset with previous')}</Button>}
|
||||
{onPairNext && <Button size="xs" variant="tinted" icon="link" title={t('Make superset with next')} onClick={onPairNext}>{t('Make superset with next')}</Button>}
|
||||
</div>}
|
||||
@@ -210,19 +255,9 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
(first undone set; the heaviest row once everything is checked). The logged number
|
||||
stays the total — this chip is the split, and tapping it edits the bar's own weight
|
||||
(S.barWeights, per exercise) mid-workout. Weight ≤ bar leaves just the bar. */}
|
||||
{!cardio && !(bw && !added) && usesBar(ex) && (() => {
|
||||
const bar = barWeightFor(S, entry.id)
|
||||
if (!(bar > 0)) return null
|
||||
const nextW = entry.sets.find(s => !s.done)?.w
|
||||
const refW = nextW > 0 ? nextW : Math.max(0, ...entry.sets.map(s => s.w || 0))
|
||||
const split = plateSplit(refW, bar)
|
||||
return <div style={{ marginBottom: 6 }}>
|
||||
<button className="chip nocap" style={{ display: 'inline-flex', alignItems: 'center', gap: 5 }} onClick={() => barWeightSheet(entry.id)}>
|
||||
<Icon name="dumbbell" style={{ fontSize: 12 }} />
|
||||
{t('Bar {0}', fmtNum(bar) + ' ' + S.unit)}{split != null ? ' · ' + t('{0} per side', fmtNum(split) + ' ' + S.unit) : ''}
|
||||
</button>
|
||||
</div>
|
||||
})()}
|
||||
{barInfo && <div className="small dim" style={{ marginBottom: 6, display: 'flex', alignItems: 'center', gap: 5 }}>
|
||||
<Icon name="dumbbell" style={{ fontSize: 12 }} />{barInfo.text}
|
||||
</div>}
|
||||
{guidance && <button type="button" className={'progline' + (plan.kind === 'deload' ? ' warn' : '')}
|
||||
aria-label={t('Open progression settings')} onClick={onProgressionSettings}>
|
||||
<Icon name={plan.kind === 'up' ? 'arrowUp' : plan.kind === 'deload' ? 'arrowDown' : 'lightbulb'} />
|
||||
@@ -241,7 +276,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
{isFirstWarmup && <div className="setph">{t('Warm-up')}</div>}
|
||||
{!warm && warmBefore && <div className="setsep" />}
|
||||
<div ref={el => onSetRowRef?.(i, el)} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' eff3' : '')}>
|
||||
<div className="n">{phaseNum}</div>
|
||||
<button type="button" className="n" aria-label={t('Set {0}', phaseNum)} title={t('More')} onClick={() => openSetMenu(s, i)}>{phaseNum}</button>
|
||||
{cell(s, i, col1, 'w')}
|
||||
{col2 && cell(s, i, col2, 'r')}
|
||||
{col3 && cell(s, i, col3, 'eff')}
|
||||
@@ -249,8 +284,6 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
set off itself. The checkbox stays for anyone who timed it on their own watch. */}
|
||||
{timed && <button className="setgo" aria-label={t('Start set')} disabled={s.done || !!working}
|
||||
onClick={() => onStartTimed(i)}><Icon name="play" /></button>}
|
||||
{warm && <button className="iconbtn" style={{ fontSize: 13 }} aria-label={t('Remove set')}
|
||||
disabled={entry.sets.length <= 1} onClick={() => onRemoveSetAt(i)}><Icon name="xmark" /></button>}
|
||||
<Check checked={s.done} onChange={() => onToggle(i)} />
|
||||
</div>
|
||||
{/* Drop-sets and rest-pause bursts extend this same row — no long rest, no new set.
|
||||
@@ -273,19 +306,19 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
|
||||
<button className="iconbtn" aria-label={t('Remove burst')} onClick={() => removeCluster(i, ci)}><Icon name="xmark" /></button>
|
||||
</div>
|
||||
))}
|
||||
<div className="setextra">
|
||||
{wc.setShortcuts && <div className="setextra">
|
||||
{!isRestPauseSet(s) && <button className="chip add" onClick={() => addDropRow(i)}><Icon name="arrowDown" />{t('+ Drop')}</button>}
|
||||
{!isDropSet(s) && <button className="chip add" onClick={() => addBurstRow(i)}><Icon name="bolt" />{t('+ Burst')}</button>}
|
||||
</div>
|
||||
</div>}
|
||||
</>}
|
||||
</div>
|
||||
})}
|
||||
<div style={{ height: 8 }} />
|
||||
<div className="row" style={{ flexWrap: 'wrap' }}>
|
||||
{wc.setShortcuts ? <div className="row" style={{ flexWrap: 'wrap' }}>
|
||||
<Button size="sm" icon="flame" onClick={onAddWarmup}>{t('Add warm-up set')}</Button>
|
||||
<Button size="sm" icon="minus" disabled={entry.sets.length <= 1} onClick={onRemoveSet}>{t('Remove set')}</Button>
|
||||
<Button size="sm" icon="plus" onClick={onAddSet}>{t('Add set')}</Button>
|
||||
</div>
|
||||
</div> : <Button size="sm" icon="plus" onClick={onAddSet}>{t('Add set')}</Button>}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
@@ -334,6 +367,7 @@ function ActiveWorkout() {
|
||||
// what is rendered — completion, rest, top-weight and auto-advance share one path.
|
||||
// Unknown/absent values read as cards, keeping every pre-existing profile as it was.
|
||||
const listMode = S.workoutView === 'list'
|
||||
const wc = workoutControls(S)
|
||||
// Superset flow: center the actionable row when completing a set moves to the partner or
|
||||
// back to the first exercise of the next round. Entry-bound maps keep repeated exercise IDs
|
||||
// distinct, while each rendered set index identifies the existing row within that entry.
|
||||
@@ -418,15 +452,15 @@ function ActiveWorkout() {
|
||||
})
|
||||
const onPairPrev = !isSuperset && cur > 0 ? () => pairAt(cur - 1, cur) : null
|
||||
const onPairNext = !isSuperset && cur < A.entries.length - 1 ? () => pairAt(cur, cur + 1) : null
|
||||
const moveCurrentUnit = direction => {
|
||||
const moveUnitAt = (at, direction) => {
|
||||
const ui = useUI.getState()
|
||||
const active = useStore.getState().S.active
|
||||
if (ui.work || !canMoveActiveWorkoutUnit(active, active?.cur, direction)) return
|
||||
if (ui.work || !canMoveActiveWorkoutUnit(active, at, direction)) return
|
||||
// Invalidate an old timed callback before indexes shift. A running rest is not cancelled:
|
||||
// it belongs to an exercise (timer.forIdx), and that exercise only changes position.
|
||||
ui.stopWork()
|
||||
update(s => {
|
||||
const moved = moveActiveWorkoutUnit(s.active, s.active?.cur, direction)
|
||||
const moved = moveActiveWorkoutUnit(s.active, at, direction)
|
||||
if (!moved) return
|
||||
progressHighWater.current = moved.indices.map(index => progressHighWater.current[index])
|
||||
const rest = useUI.getState().timer
|
||||
@@ -437,8 +471,19 @@ function ActiveWorkout() {
|
||||
}, true)
|
||||
}
|
||||
|
||||
// One prop object per entry so the card and list layouts share the exact same wiring.
|
||||
const moveCurrentUnit = direction => moveUnitAt(cur, direction)
|
||||
|
||||
// One prop object per entry so the card and list layouts share the exact same wiring. The
|
||||
// exercise-level actions (swap, move, remove) address the entry itself, so the "more" menu of
|
||||
// a superset member acts on that member, not on whatever the marker happens to point at.
|
||||
const blockProps = idx => ({
|
||||
onSwap: () => swapActiveWorkoutExercise(idx),
|
||||
onMoveUp: () => moveUnitAt(idx, -1),
|
||||
onMoveDown: () => moveUnitAt(idx, 1),
|
||||
canMoveUp: canMoveActiveWorkoutUnit(A, idx, -1),
|
||||
canMoveDown: canMoveActiveWorkoutUnit(A, idx, 1),
|
||||
onRemoveExercise: () => confirmRemoveExercise(idx),
|
||||
busy: !!work,
|
||||
onToggle: i => toggle(idx, i),
|
||||
onField: (i, f, v) => setField(idx, i, f, v),
|
||||
onAddSet: () => addSet(idx),
|
||||
@@ -754,7 +799,7 @@ function ActiveWorkout() {
|
||||
<Button trailingIcon="chevronRight" disabled={unitIdx < 0 || unitIdx >= units.length - 1} onClick={() => navigateUnit(1)}>{t('Next')}</Button>
|
||||
</div>}
|
||||
{!listMode && <div style={{ height: 10 }} />}
|
||||
{listMode && A.entries.length > 0 && <div className="muted small" style={{ marginBottom: 6 }}>{t('Move, swap and remove below act on the exercise marked {0}.', t('Current'))}</div>}
|
||||
{wc.exerciseButtons && listMode && A.entries.length > 0 && <div className="muted small" style={{ marginBottom: 6 }}>{t('Move, swap and remove below act on the exercise marked {0}.', t('Current'))}</div>}
|
||||
<Button onClick={() => exercisePicker((ex, quick) => {
|
||||
const routine = S.routines.find(r => r.id === A.routineId)
|
||||
const freestyle = !A.routineId
|
||||
@@ -784,7 +829,7 @@ function ActiveWorkout() {
|
||||
if (quick) { commit(seed || defaultConfig(ex.id)); useUI.getState().toast(t('“{0}” added to {1}', exerciseNameFor(ex), routine ? routine.name : t('Freestyle'))) }
|
||||
else exConfigSheet(ex, null, commit, null, routine, seed)
|
||||
})} icon="plus">{t('Add exercise')}</Button>
|
||||
{A.entries.length > 0 && <>
|
||||
{wc.exerciseButtons && A.entries.length > 0 && <>
|
||||
<div style={{ height: 6 }} />
|
||||
<div className="row">
|
||||
<Button size="sm" icon="chevronUp" aria-label={t('Move up')}
|
||||
|
||||
@@ -27,6 +27,7 @@ let sheetContainer
|
||||
|
||||
function setActive(entries, cur = 0) {
|
||||
const S = clone(DEF)
|
||||
S.wc = { ...S.wc, exerciseButtons: true } // the removal button is opt-in now; the menu path is covered in Workout.test.jsx
|
||||
S.active = {
|
||||
id: 'remove-test', d: '2026-08-11', start: Date.now(), routineId: null,
|
||||
name: 'Remove test', bw: null, cur, entries
|
||||
|
||||
@@ -21,6 +21,7 @@ const mocks = vi.hoisted(() => {
|
||||
toast: vi.fn(),
|
||||
scrollCalls: [],
|
||||
swapActiveWorkoutExercise: vi.fn(),
|
||||
menuSheet: vi.fn(),
|
||||
}
|
||||
state.stopRest = vi.fn(() => { state.timer = null })
|
||||
state.stopWork = vi.fn(() => { state.work = null })
|
||||
@@ -67,6 +68,7 @@ vi.mock('../sheets.jsx', () => ({
|
||||
workoutCompleteSheet: mocks.workoutCompleteSheet,
|
||||
confirmSheet: mocks.confirmSheet,
|
||||
swapActiveWorkoutExercise: mocks.swapActiveWorkoutExercise,
|
||||
menuSheet: mocks.menuSheet,
|
||||
// Both note sheets belong here even though the tests never open one: Workout.jsx reads
|
||||
// sessionNoteSheet during render, so a missing export is a render crash, not a no-op.
|
||||
exerciseNoteSheet: vi.fn(),
|
||||
@@ -784,6 +786,8 @@ describe('superset actionable-set centring', () => {
|
||||
})
|
||||
|
||||
describe('active workout whole-unit move controls', () => {
|
||||
// These exercise-level buttons are opt-in now (Settings → Workout controls); the menu path is covered below.
|
||||
const mountLegacy = (entries, cur) => mount(entries, cur, { wc: { exerciseButtons: true } })
|
||||
const action = label => container.querySelector(`button[aria-label="${label}"]`)
|
||||
|
||||
it('shows labelled controls and moves the selected standalone exercise one unit', async () => {
|
||||
@@ -792,7 +796,7 @@ describe('active workout whole-unit move controls', () => {
|
||||
target: { mode: 'reps', reps: 7, weight: 82.5, notes: 'Keep this target' },
|
||||
sets: [{ w: 77.5, r: 6, done: true, rir: 2 }],
|
||||
})
|
||||
await mount([
|
||||
await mountLegacy([
|
||||
exercise('duplicate', [false], { occurrenceId: 'duplicate#1' }),
|
||||
exercise('middle', [false]),
|
||||
selected,
|
||||
@@ -815,7 +819,7 @@ describe('active workout whole-unit move controls', () => {
|
||||
const first = exercise('group-a', [false], { sg: 'pair', occurrenceId: 'group-a#1' })
|
||||
const selected = exercise('group-b', [true], { sg: 'pair', occurrenceId: 'group-b#1' })
|
||||
const groupMeta = { pair: { kind: 'complex', label: 'Carry pair', cues: 'Stay braced.' } }
|
||||
await mount([
|
||||
await mountLegacy([
|
||||
exercise('before', [false]),
|
||||
first,
|
||||
selected,
|
||||
@@ -834,7 +838,7 @@ describe('active workout whole-unit move controls', () => {
|
||||
|
||||
it('disables both moves while a work timer can still write by index', async () => {
|
||||
mocks.work = { left: 5, total: 5, endsAt: Date.now() + 5000 }
|
||||
await mount([exercise('first', [false]), exercise('second', [false])], 1)
|
||||
await mountLegacy([exercise('first', [false]), exercise('second', [false])], 1)
|
||||
|
||||
expect(action('Move up')?.disabled).toBe(true)
|
||||
expect(action('Move down')?.disabled).toBe(true)
|
||||
@@ -842,8 +846,9 @@ describe('active workout whole-unit move controls', () => {
|
||||
})
|
||||
|
||||
describe('active exercise swap control', () => {
|
||||
const mountLegacy = (entries, cur) => mount(entries, cur, { wc: { exerciseButtons: true } })
|
||||
it('opens the swap flow for the selected duplicate occurrence', async () => {
|
||||
await mount([exercise('bench', [false]), exercise('bench', [false]), exercise('row', [false])], 1)
|
||||
await mountLegacy([exercise('bench', [false]), exercise('bench', [false]), exercise('row', [false])], 1)
|
||||
|
||||
const swap = container.querySelector('button[aria-label="Swap exercise"]')
|
||||
expect(swap).toBeTruthy()
|
||||
@@ -942,3 +947,65 @@ describe('workout list view', () => {
|
||||
expect(container.querySelectorAll('[role="checkbox"]').length).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('workout controls: the more menu and the set menu', () => {
|
||||
const lastMenu = () => mocks.menuSheet.mock.calls.at(-1)[0]
|
||||
const item = label => lastMenu().items.filter(Boolean).find(it => it.label === label)
|
||||
|
||||
it('shows one More button per exercise and no legacy button rows by default', async () => {
|
||||
await mount([exercise('plain-bench', [false]), exercise('plain-row', [false])])
|
||||
expect(container.querySelector('button[aria-label="More"]')).toBeTruthy()
|
||||
for (const label of ['Move up', 'Swap exercise']) expect(container.querySelector(`button[aria-label="${label}"]`)).toBeNull()
|
||||
expect([...container.querySelectorAll('button')].some(b => b.textContent.trim() === 'Remove exercise')).toBe(false)
|
||||
expect([...container.querySelectorAll('button')].some(b => b.textContent.trim() === '+ Drop')).toBe(false)
|
||||
expect([...container.querySelectorAll('button')].some(b => b.textContent.trim() === 'Add set')).toBe(true)
|
||||
})
|
||||
|
||||
it('routes swap, move, remove, warm-up and details through the More menu of that exercise', async () => {
|
||||
await mount([exercise('plain-bench', [false]), exercise('plain-row', [false])], 0)
|
||||
await act(async () => { container.querySelector('button[aria-label="More"]').dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
expect(mocks.menuSheet).toHaveBeenCalledOnce()
|
||||
expect(lastMenu().items.filter(Boolean).map(it => it.label)).toEqual(expect.arrayContaining([
|
||||
'Add note', 'Details', 'Add warm-up set', 'Make superset with next', 'Swap exercise', 'Move up', 'Move down', 'Remove exercise',
|
||||
]))
|
||||
expect(item('Move up').disabled).toBe(true)
|
||||
expect(item('Move down').disabled).toBe(false)
|
||||
expect(item('Remove exercise').danger).toBe(true)
|
||||
|
||||
item('Swap exercise').onClick()
|
||||
expect(mocks.swapActiveWorkoutExercise).toHaveBeenCalledWith(0)
|
||||
|
||||
await act(async () => { item('Add warm-up set').onClick() })
|
||||
expect(mocks.S.active.entries[0].sets.some(s => s.phase === 'warmup' || s.warmup)).toBe(true)
|
||||
|
||||
await act(async () => { item('Remove exercise').onClick() })
|
||||
expect(mocks.confirmSheet).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('opens a per-set menu from the set number with drop, burst and remove', async () => {
|
||||
await mount([exercise('plain-bench', [false, false])])
|
||||
await act(async () => { container.querySelector('button[aria-label="Set 2"]').dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
expect(lastMenu().items.filter(Boolean).map(it => it.label)).toEqual(['Drop set', 'Rest-pause burst', 'Remove this set'])
|
||||
|
||||
await act(async () => { item('Drop set').onClick() })
|
||||
expect(mocks.S.active.entries[0].sets[1].drops?.length).toBe(1)
|
||||
|
||||
await act(async () => { container.querySelector('button[aria-label="Set 2"]').dispatchEvent(new dom.Event('click', { bubbles: true })) })
|
||||
await act(async () => { item('Remove this set').onClick() })
|
||||
expect(mocks.S.active.entries[0].sets.length).toBe(1)
|
||||
})
|
||||
|
||||
it('brings the legacy button rows back per switch', async () => {
|
||||
await mount([exercise('plain-bench', [false]), exercise('plain-row', [false])], 0, {
|
||||
wc: { setShortcuts: true, pairButtons: true, exerciseButtons: true },
|
||||
})
|
||||
const labels = [...container.querySelectorAll('button')].map(b => b.textContent.trim())
|
||||
expect(labels).toEqual(expect.arrayContaining(['+ Drop', 'Add warm-up set', 'Remove set', 'Make superset with next', 'Move up', 'Swap exercise', 'Remove exercise']))
|
||||
})
|
||||
|
||||
it('drops the +/- buttons when steppers are off and keeps the number field', async () => {
|
||||
await mount([exercise('plain-bench', [false])], 0, { wc: { steppers: false } })
|
||||
expect(container.querySelector('.setrow .stp button[aria-label="Increase"]')).toBeNull()
|
||||
expect(container.querySelector('.setrow .stp.plain .num')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user