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:
co-authored by
Claude Opus 5.5
parent
06bd91d797
commit
7dc106837b
@@ -4,7 +4,8 @@
|
||||
|
||||
import { h } from "../dom.js";
|
||||
import { addDays, daysBetween, mondayOf } from "../../domain/dates.js";
|
||||
import { attendance, exerciseHistory } from "../../domain/analysis.js";
|
||||
import { attendance, exerciseHistory, wodRecords } from "../../domain/analysis.js";
|
||||
import { formatLabel, scoreLabel } from "../../domain/wod.js";
|
||||
import { dec1, kg, mediumDay, plural, shortDay } from "../format.js";
|
||||
import { screenHeader } from "../layout.js";
|
||||
import { href } from "../router.js";
|
||||
@@ -50,6 +51,7 @@ function overview({ store, nav, today }) {
|
||||
const from = addDays(mondayOf(to), -7 * (ATTENDANCE_WEEKS - 1));
|
||||
const { weeks, totals } = attendance(state, from, to);
|
||||
const list = exercisesDone(state);
|
||||
const wods = wodRecords(state);
|
||||
const node = h("div", { class: "screen" },
|
||||
screenHeader({ back: { label: "Accueil", onClick: () => nav.back(href.home()) }, kicker: "Ton parcours", title: "Analyses" }),
|
||||
h("h2", { class: "tape" }, "Assiduité", h("span", { class: "tape__hint" }, `${ATTENDANCE_WEEKS} semaines`)),
|
||||
@@ -65,6 +67,13 @@ function overview({ store, nav, today }) {
|
||||
labels: [shortDay(weeks[0].monday), "cette semaine"],
|
||||
}),
|
||||
h("figcaption", { class: "chart__caption" }, "Séances par semaine, toutes natures. En couleur : la semaine en cours.")),
|
||||
wods.length > 0 && [
|
||||
h("h2", { class: "tape" }, "WOD", h("span", { class: "tape__hint" }, "record")),
|
||||
h("ul", { class: "rows" }, wods.map((w) => h("li", { class: "row" },
|
||||
h("span", { class: "row__main" },
|
||||
h("span", { class: "row__title" }, `${w.name} · ${formatLabel(w.format)}`),
|
||||
h("span", { class: "row__meta" }, `Record ${scoreLabel(w.best.result)} le ${shortDay(w.best.date)} · ${w.results.length} fois`
|
||||
+ (w.results.length > 1 ? ` · dernière : ${scoreLabel(w.results[w.results.length - 1].result)}` : ""))))))],
|
||||
h("h2", { class: "tape" }, "Par exercice"),
|
||||
list.length
|
||||
? h("ul", { class: "rows" }, list.map((x) => h("li", null, h("a", { class: "row", href: href.analysis(x.id) },
|
||||
|
||||
+14
-1
@@ -3,6 +3,8 @@
|
||||
// jour tirée du planning, les séances, le cardio, les repères et la grille des
|
||||
// autres écrans.
|
||||
|
||||
import { pendingOneOffs, rotationSessions } from "../../domain/program.js";
|
||||
import { formatLabel } from "../../domain/wod.js";
|
||||
import { h, paintWhenIdle, setAccent } from "../dom.js";
|
||||
import { inkOn, sessionColor } from "../color.js";
|
||||
import { longDay, plural, shortDay } from "../format.js";
|
||||
@@ -71,6 +73,7 @@ function homeContent(store, nav, today, synced) {
|
||||
if (!hasProgram(state)) return onboarding({ store });
|
||||
|
||||
const program = /** @type {import("../../domain/program.js").Program} */ (state.program);
|
||||
const oneOffs = pendingOneOffs(program, state.sessions);
|
||||
const model = todayModel(state, today);
|
||||
const last = lastDoneByKey(state);
|
||||
/** @type {Node|null} */
|
||||
@@ -161,8 +164,18 @@ function homeContent(store, nav, today, synced) {
|
||||
h("header", { class: "visually-hidden" }, h("h1", null, program.name)),
|
||||
todayBlock,
|
||||
|
||||
oneOffs.length > 0 && [
|
||||
h("h2", { class: "tape" }, "WOD proposé", h("span", { class: "tape__hint" }, "hors rotation")),
|
||||
h("ul", { class: "rows" }, oneOffs.map((s) =>
|
||||
h("li", null, h("a", { class: "row", href: href.session(s.key) },
|
||||
plaque("W", s.color),
|
||||
h("span", { class: "row__main" },
|
||||
h("span", { class: "row__title" }, s.name),
|
||||
h("span", { class: "row__meta" }, `${s.format ? formatLabel(s.format) + " · " : ""}${estimatedMinutes(s)} min · une fois, quand tu veux`)),
|
||||
h("span", { class: "chevron", "aria-hidden": "true" })))))],
|
||||
|
||||
h("h2", { class: "tape" }, "Séances"),
|
||||
h("ul", { class: "rows" }, program.sessions.map((s) =>
|
||||
h("ul", { class: "rows" }, rotationSessions(program).map((s) =>
|
||||
h("li", null, h("a", { class: "row", href: href.session(s.key) },
|
||||
plaque(s.key, s.color),
|
||||
h("span", { class: "row__main" },
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Le planning est calculé (planning.js), jamais stocké : seuls les réglages
|
||||
// (PlanSettingsChanged) et les faits (SessionLogged, DaySkipped…) sont au journal.
|
||||
|
||||
import { rotationSessions } from "../../domain/program.js";
|
||||
import { h, paintWhenIdle, replace } from "../dom.js";
|
||||
import { addDays, isoWeek, mondayOf, mondayOfIsoWeek } from "../../domain/dates.js";
|
||||
import { settingsForWeek } from "../../domain/planning.js";
|
||||
@@ -93,7 +94,7 @@ export function weekScreen({ store, nav, today, query }) {
|
||||
const next = selected.has(d) ? [...selected].filter((x) => x !== d) : [...selected, d];
|
||||
save(withDays(settings, next));
|
||||
const strength = weekRows(store.getState(), m, today()).plan.slots.filter((s) => s.kind === "strength").length;
|
||||
const need = program?.sessions.length ?? 0;
|
||||
const need = rotationSessions(program ?? null).length;
|
||||
status.textContent = next.length === 0 ? "Aucun jour retenu."
|
||||
: strength < need ? `${strength} séance${strength > 1 ? "s" : ""} de force sur ${need} : la rotation rattrapera la semaine suivante.`
|
||||
: `${strength} séances de force, espacées au maximum.`;
|
||||
|
||||
Reference in New Issue
Block a user