create mission

This commit is contained in:
2026-06-13 11:38:02 +07:00
parent 853acefac1
commit 10f4c36c23
4 changed files with 1345 additions and 5 deletions

View File

@@ -7,6 +7,9 @@ const pageTitleEl = document.querySelector(".pageTitle");
const navItemEls = Array.from(document.querySelectorAll(".navItem[data-page]"));
const pageOverviewEl = el("pageOverview");
const pageConfigEl = el("pageConfig");
const pageMissionsEl = el("pageMissions");
const contentEl = document.querySelector(".content");
const contentRightEl = el("contentRight");
const overviewBackendEl = el("overviewBackend");
const overviewActiveLayoutEl = el("overviewActiveLayout");
const overviewActiveModelEl = el("overviewActiveModel");
@@ -117,16 +120,28 @@ const state = {
};
function setActivePage(page) {
const p = page === "overview" ? "overview" : "config";
const valid = ["overview", "config", "missions"];
const p = valid.includes(page) ? page : "config";
navItemEls.forEach((a) => {
const on = (a.dataset.page || "") === p;
a.classList.toggle("active", on);
if (on) a.setAttribute("aria-current", "page");
else a.removeAttribute("aria-current");
});
if (pageTitleEl) pageTitleEl.textContent = p === "overview" ? "Tổng quan" : "Cấu Hình";
const titles = { overview: "Tổng quan", config: "Cấu Hình", missions: "Missions" };
if (pageTitleEl) pageTitleEl.textContent = titles[p] || "Cấu Hình";
if (pageOverviewEl) pageOverviewEl.hidden = p !== "overview";
if (pageConfigEl) pageConfigEl.hidden = p !== "config";
if (pageMissionsEl) pageMissionsEl.hidden = p !== "missions";
if (configSplitterEl) configSplitterEl.hidden = p !== "config";
if (contentRightEl) contentRightEl.hidden = p !== "config";
if (contentEl) {
contentEl.classList.toggle("content--overview", p === "overview");
contentEl.classList.toggle("content--config", p === "config");
contentEl.classList.toggle("content--missions", p === "missions");
}
if (saveLayoutBtn) saveLayoutBtn.hidden = p !== "config";
if (p === "missions" && window.MissionsApp) window.MissionsApp.onPageShow();
try {
localStorage.setItem("activePage", p);
} catch {
@@ -145,7 +160,7 @@ function initNavigation() {
let initial = "config";
try {
const saved = localStorage.getItem("activePage");
if (saved === "overview" || saved === "config") initial = saved;
if (saved === "overview" || saved === "config" || saved === "missions") initial = saved;
} catch {
/* ignore */
}