Exercices de chaque côté : objectif « / côté », chrono droite puis gauche (R1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-22 21:36:04 +01:00
co-authored by Claude Opus 5.5
parent ca680c7035
commit 4456327417
20 changed files with 310 additions and 18 deletions
+8 -5
View File
@@ -11,7 +11,7 @@ import { TRACKING_MODES, EFFORTS } from "../domain/vocabulary.js";
import { resolveExercise, trackingFor } from "../domain/program.js";
import { EFFORT_LABELS, TRACKING_LABELS } from "./labels.js";
import { kg, parseAmount, restLabel } from "./format.js";
import { doneCount, draftExercise, markSet, proposedReps, targetLabel, targetReps, usesLoad, usesTime } from "./session-draft.js";
import { chronoSteps, doneCount, draftExercise, markSet, proposedReps, targetLabel, targetReps, usesLoad, usesTime } from "./session-draft.js";
import { progressionAdvice } from "../domain/progression.js";
/**
@@ -113,7 +113,7 @@ export function exerciseCard(o) {
const panel = h("div", { class: "set-panel", role: "group", "aria-label": `Série ${i + 1}` },
h("p", { class: "set-panel__title" }, `Série ${i + 1}`,
timed ? ` · ${ex.seconds} s` : range ? ` · objectif ${range.low === range.high ? range.low : range.low + "–" + range.high} répétitions` : ""),
timed ? ` · ${ex.seconds} s${ex.sides ? " par côté" : ""}` : range ? ` · objectif ${range.low === range.high ? range.low : range.low + "–" + range.high} répétitions` : ""),
!timed && h("div", { class: "stepper" },
h("button", { type: "button", class: "stepper__btn", "aria-label": "Une répétition de moins", on: { click: () => step(-1) } }, "−"),
value,
@@ -146,8 +146,10 @@ export function exerciseCard(o) {
if (chronoBtn) chronoBtn.textContent = "Toutes les séries sont faites";
return;
}
const seconds = ex.seconds ?? 45;
timer.startWork(seconds, `${ex.name} · série ${i + 1}`, () => {
// De chaque côté : droite, changement de côté, gauche, enchaînés (chronoSteps).
const steps = chronoSteps(ex, i);
const run = (/** @type {number} */ k) => timer.startWork(steps[k].seconds, steps[k].label, () => {
if (k + 1 < steps.length) return run(k + 1);
// Fin du chrono : la série est cochée (bug d'Atelier : « cocher » n'existait
// pas), puis on demande le ressenti, qui lancera le repos.
if (ex.done[i] === null) markSet(o.draft, ex, i, { reps: null, effort: null });
@@ -155,10 +157,11 @@ export function exerciseCard(o) {
openPanel = null;
showPanel(i);
});
run(0);
};
const refreshChrono = () => {
if (chronoBtn) chronoBtn.textContent = `Lancer la série · ${ex.seconds ?? 45} s`;
if (chronoBtn) chronoBtn.textContent = `Lancer la série · ${ex.seconds ?? 45} s${ex.sides ? " par côté" : ""}`;
};
/**