add top bar
This commit is contained in:
13
www/app.js
13
www/app.js
@@ -3,7 +3,6 @@ const el = (id) => document.getElementById(id);
|
||||
const statusEl = el("status");
|
||||
const listEl = el("lidarList");
|
||||
const lidarFormHintEl = el("lidarFormHint");
|
||||
const pageTitleEl = document.querySelector(".pageTitle");
|
||||
const navItemEls = Array.from(document.querySelectorAll(".navItem[data-page]"));
|
||||
const pageOverviewEl = el("pageOverview");
|
||||
const pageConfigEl = el("pageConfig");
|
||||
@@ -134,13 +133,6 @@ function setActivePage(page) {
|
||||
if (on) a.setAttribute("aria-current", "page");
|
||||
else a.removeAttribute("aria-current");
|
||||
});
|
||||
const titles = {
|
||||
dashboard: "Dashboard",
|
||||
config: "Cấu Hình",
|
||||
missions: "Missions",
|
||||
integrations: "Tích hợp",
|
||||
};
|
||||
if (pageTitleEl) pageTitleEl.textContent = titles[p] || "Cấu Hình";
|
||||
if (pageOverviewEl) pageOverviewEl.hidden = p !== "dashboard";
|
||||
if (pageConfigEl) pageConfigEl.hidden = p !== "config";
|
||||
if (pageMissionsEl) pageMissionsEl.hidden = p !== "missions";
|
||||
@@ -153,7 +145,6 @@ function setActivePage(page) {
|
||||
contentEl.classList.toggle("content--missions", p === "missions");
|
||||
contentEl.classList.toggle("content--integrations", p === "integrations");
|
||||
}
|
||||
if (saveLayoutBtn) saveLayoutBtn.hidden = p !== "config";
|
||||
if (p === "missions" && window.MissionsApp) window.MissionsApp.onPageShow();
|
||||
else if (window.MissionsApp?.onPageHide) window.MissionsApp.onPageHide();
|
||||
if (p === "dashboard" && window.DashboardApp) window.DashboardApp.onPageShow();
|
||||
@@ -3155,7 +3146,7 @@ async function loadAll() {
|
||||
}
|
||||
}
|
||||
|
||||
el("refreshBtn").addEventListener("click", async () => {
|
||||
el("refreshBtn")?.addEventListener("click", async () => {
|
||||
try {
|
||||
state.viewInitialized = false;
|
||||
await loadAll();
|
||||
@@ -3398,7 +3389,7 @@ window.addEventListener("keyup", (evt) => {
|
||||
if (evt.key === "Shift") canvasWrap.classList.remove("shift-pan");
|
||||
});
|
||||
|
||||
saveLayoutBtn.addEventListener("click", async () => {
|
||||
saveLayoutBtn?.addEventListener("click", async () => {
|
||||
try {
|
||||
await saveCurrentLayout();
|
||||
setStatus(`Đã lưu layout «${state.activeLayoutName || ""}»`);
|
||||
|
||||
Reference in New Issue
Block a user