Transforme l'accueil et sépare l'application

This commit is contained in:
2026-04-12 12:51:57 +02:00
parent ae56850e5c
commit 776e9ccf2f
8 changed files with 519 additions and 213 deletions

15
app.js
View File

@@ -1,4 +1,5 @@
const PAGE = document.body.dataset.page;
const SETUP_PAGE = "application.html";
const STORAGE_KEY = "chesscubing-arena-state-v2";
const WINDOW_NAME_KEY = "chesscubing-arena-state-v2:";
@@ -178,7 +179,7 @@ function initSetupPage() {
function initChronoPage() {
if (!match) {
replaceTo("index.html");
replaceTo(SETUP_PAGE);
return;
}
@@ -314,7 +315,7 @@ function initChronoPage() {
refs.arbiterResetButton?.addEventListener("click", () => {
clearMatch();
replaceTo("index.html");
replaceTo(SETUP_PAGE);
});
function handleChronoTap(color) {
@@ -344,7 +345,7 @@ function initChronoPage() {
syncRunningState(match);
if (match.result) {
navigateTo("index.html");
navigateTo(SETUP_PAGE);
return;
}
@@ -500,7 +501,7 @@ function initChronoPage() {
function initCubePage() {
if (!match) {
replaceTo("index.html");
replaceTo(SETUP_PAGE);
return;
}
@@ -564,7 +565,7 @@ function initCubePage() {
refs.primaryButton?.addEventListener("click", () => {
if (match.result) {
navigateTo("index.html");
navigateTo(SETUP_PAGE);
return;
}
@@ -596,7 +597,7 @@ function initCubePage() {
refs.resetButton?.addEventListener("click", () => {
clearMatch();
replaceTo("index.html");
replaceTo(SETUP_PAGE);
});
function handleCubeTap(color) {
@@ -1384,7 +1385,7 @@ function resultText(storedMatch) {
function routeForMatch(storedMatch) {
if (!storedMatch) {
return "index.html";
return SETUP_PAGE;
}
return storedMatch.phase === "cube" && !storedMatch.result ? "cube.html" : "chrono.html";