UI: show clear storage state and hide migrate button when not needed
This commit is contained in:
22
app.js
22
app.js
@@ -36,6 +36,7 @@ const brandTabs = document.getElementById("brandTabs");
|
||||
const consoleTabs = document.getElementById("consoleTabs");
|
||||
const gameSectionTitle = document.getElementById("gameSectionTitle");
|
||||
const dataModeInfo = document.getElementById("dataModeInfo");
|
||||
const storageState = document.getElementById("storageState");
|
||||
const toolsDrawer = document.getElementById("toolsDrawer");
|
||||
const toolsToggleBtn = document.getElementById("toolsToggleBtn");
|
||||
const toolsCloseBtn = document.getElementById("toolsCloseBtn");
|
||||
@@ -438,17 +439,36 @@ function renderDataMode() {
|
||||
|
||||
if (dataMode === "api") {
|
||||
dataModeInfo.textContent = "Source: API (lecture/ecriture active sur la base de donnees).";
|
||||
if (storageState) {
|
||||
storageState.textContent = "Etat: Base de donnees active";
|
||||
}
|
||||
} else if (dataMode === "api-empty") {
|
||||
dataModeInfo.textContent = "Source: API (base vide). Ajoute une section pour demarrer.";
|
||||
if (storageState) {
|
||||
storageState.textContent = "Etat: Base de donnees active (vide)";
|
||||
}
|
||||
} else if (dataMode === "local-pending-import") {
|
||||
dataModeInfo.textContent = "Source: localStorage detectee. Migration vers DB disponible.";
|
||||
if (storageState) {
|
||||
storageState.textContent = "Etat: LocalStorage (migration en attente)";
|
||||
}
|
||||
} else if (dataMode === "local-fallback") {
|
||||
dataModeInfo.textContent = "Source: localStorage (fallback). API indisponible.";
|
||||
if (storageState) {
|
||||
storageState.textContent = "Etat: LocalStorage (API indisponible)";
|
||||
}
|
||||
} else {
|
||||
dataModeInfo.textContent = "Source: localStorage";
|
||||
if (storageState) {
|
||||
storageState.textContent = "Etat: LocalStorage";
|
||||
}
|
||||
}
|
||||
|
||||
const showMigrateBtn = apiReachable && pendingLocalImport && payloadHasCatalogData(pendingLocalImport);
|
||||
const showMigrateBtn =
|
||||
dataMode === "local-pending-import" &&
|
||||
apiReachable &&
|
||||
pendingLocalImport &&
|
||||
payloadHasCatalogData(pendingLocalImport);
|
||||
if (showMigrateBtn) {
|
||||
migrateBtn.classList.remove("hidden");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user