WOD ponctuel proposé par l'IA et records par WOD (lot 4c)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-18 15:06:39 +01:00
co-authored by Claude Opus 5.5
parent 06bd91d797
commit 7dc106837b
23 changed files with 275 additions and 23 deletions
+9 -3
View File
@@ -6,9 +6,10 @@
import { h, replace, vibrate } from "./dom.js";
import { resolveExercise } from "../domain/program.js";
import { clockText, currentMovement, formatHint, formatLabel, formatSeconds, parseClock, scoreFields, wodClock } from "../domain/wod.js";
import { clockText, currentMovement, formatHint, formatLabel, formatSeconds, parseClock, scoreFields, scoreLabel, wodClock, wodKey } from "../domain/wod.js";
import { wodRecords } from "../domain/analysis.js";
import { usesLoad, wodElapsed } from "./session-draft.js";
import { kg, parseAmount } from "./format.js";
import { kg, parseAmount, shortDay } from "./format.js";
import { confirmDialog } from "./feedback.js";
/** Compte à rebours avant le départ, en secondes. */
@@ -24,6 +25,8 @@ export function wodPanel({ draft, session, store, onChange }) {
const format = w.format;
const fields = scoreFields(format);
const total = formatSeconds(format);
// Le même WOD déjà fait (même nom, même format) : son record, à battre.
const record = wodRecords(store.getState()).find((r) => r.key === wodKey(session.name, format)) ?? null;
// ---- son et écran allumé ----------------------------------------------------------
/** @type {AudioContext|null} */
@@ -258,7 +261,10 @@ export function wodPanel({ draft, session, store, onChange }) {
h("section", { class: "wod-format" },
h("p", { class: "kicker" }, "WOD"),
h("p", { class: "wod-format__label" }, formatLabel(format)),
h("p", { class: "muted" }, formatHint(format))),
h("p", { class: "muted" }, formatHint(format)),
record && h("p", { class: "wod-format__record" },
`Record : ${scoreLabel(record.best.result)}, le ${shortDay(record.best.date)}`,
record.results.length > 1 ? ` · ${record.results.length} fois` : "")),
h("ol", { class: "wod-moves" }, moves),
clockBox,
score);