Proposer l'installation de l'app au bon moment (lot 3d)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-18 15:17:39 +01:00
co-authored by Claude Opus 5.5
parent 888aec1003
commit 84b4027796
7 changed files with 461 additions and 4 deletions
+4 -2
View File
@@ -7,6 +7,7 @@
import { gameStats, sessionCombo, sessionRewards } from "../domain/gamification.js";
import { h } from "./dom.js";
import { href } from "./router.js";
import { installOffer, strengthSessions } from "./install.js";
/** @typedef {import("../domain/state.js").State} State */
/** @typedef {import("../domain/gamification.js").SessionRewards} SessionRewards */
@@ -60,7 +61,7 @@ export function comboLabel(sets) {
return sessionCombo(sets).label;
}
/** @type {{rewards: SessionRewards, summary: SessionSummary}|null} */
/** @type {{rewards: SessionRewards, summary: SessionSummary, sessions: number}|null} */
let lastFinish = null;
/**
@@ -81,7 +82,7 @@ let lastFinish = null;
* @param {SessionSummary} summary
*/
export function recordFinish(before, after, today, summary) {
lastFinish = { rewards: sessionRewards(before, after, { today }), summary };
lastFinish = { rewards: sessionRewards(before, after, { today }), summary, sessions: strengthSessions(after) };
}
export function takeFinish() {
@@ -166,6 +167,7 @@ export function finishScreen({ nav }) {
rewards.streak.after > 0 && h("p", { class: "muted reward__streak" },
`Série : ${rewards.streak.after} semaine${rewards.streak.after > 1 ? "s" : ""}.`,
rewards.streak.after > rewards.streak.before ? " Elle monte." : ""),
installOffer("finish", { hasProgram: true, sessions: done.sessions }),
h("div", { class: "action-bar" }, h("div", { class: "action-bar__in" },
h("a", { class: "btn btn--primary btn--block btn--lg", href: href.home() }, "Continuer"))));