Bandeau « Mettre à jour » à la nouvelle version ; page d'autorisation : Refuser dans la barre ; test-browser sur le site assemblé
- update-banner.js : registerServiceWorker({ onUpdateReady }), confirmation
en séance (le brouillon survit au rechargement, vérifié dans le parcours).
- test-browser : le serveur sert une copie de make site (service worker
actif) ; le parcours publie une deuxième version en réécrivant sw.js.
- Clé désignée par son dernier groupe sur les écrans de confirmation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
08cc995eef
commit
f4fdd558c8
+16
-3
@@ -2,7 +2,7 @@
|
||||
// minuteur, le routeur et ses écrans.
|
||||
|
||||
import { createStore } from "./ui/store.js";
|
||||
import { href, startRouter } from "./ui/router.js";
|
||||
import { href, parseRoute, startRouter } from "./ui/router.js";
|
||||
import { createTimer } from "./ui/timer.js";
|
||||
import { h } from "./ui/dom.js";
|
||||
import { screenHeader } from "./ui/layout.js";
|
||||
@@ -24,6 +24,8 @@ import { connectAiScreen } from "./ui/screens/connect-ai.js";
|
||||
import { createSyncService } from "./ui/sync-service.js";
|
||||
import { readPairFragment } from "./ui/sync-model.js";
|
||||
import { toast } from "./ui/feedback.js";
|
||||
import { updateBanner } from "./ui/update-banner.js";
|
||||
import { loadDraft } from "./ui/draft-storage.js";
|
||||
|
||||
import { openEventStore } from "./infra/event-store.js";
|
||||
import { decodeProposalFragment } from "./domain/link.js";
|
||||
@@ -42,7 +44,10 @@ store.load(await db.list());
|
||||
// l'ouverture, après chaque saisie, au retour du réseau ou sur l'onglet.
|
||||
export const sync = createSyncService({
|
||||
db, store,
|
||||
onNewProposals: (n) => toast(n > 1 ? `${n} nouvelles propositions : à voir à l'accueil.` : "Nouvelle proposition : à voir à l'accueil."),
|
||||
onNewProposals: (n) => {
|
||||
const what = n > 1 ? `${n} nouvelles propositions` : "Nouvelle proposition";
|
||||
toast(parseRoute(location.hash).name === "home" ? `${what} reçue${n > 1 ? "s" : ""}.` : `${what} : à voir à l'accueil.`);
|
||||
},
|
||||
});
|
||||
await sync.start();
|
||||
|
||||
@@ -105,7 +110,15 @@ function takePairLink() {
|
||||
}
|
||||
takePairLink();
|
||||
window.addEventListener("hashchange", takePairLink);
|
||||
registerServiceWorker();
|
||||
// Nouvelle version publiée, installée et en attente : un bandeau propose de la
|
||||
// prendre tout de suite (sinon, elle prend la main au lancement suivant).
|
||||
registerServiceWorker({
|
||||
onUpdateReady: (apply) => {
|
||||
if (document.querySelector(".update")) return;
|
||||
const banner = updateBanner({ apply, inSession: () => parseRoute(location.hash).name === "session" || loadDraft() !== null });
|
||||
document.body.insertBefore(banner, document.getElementById("app"));
|
||||
},
|
||||
});
|
||||
|
||||
const timer = createTimer();
|
||||
document.body.append(timer.node);
|
||||
|
||||
Reference in New Issue
Block a user