aboutsummaryrefslogtreecommitdiffstats
path: root/static/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/app.js')
-rw-r--r--static/app.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/static/app.js b/static/app.js
index 54d4b26..ce3ec62 100644
--- a/static/app.js
+++ b/static/app.js
@@ -47,6 +47,19 @@ function ensureTab(name) {
return tabs[name];
}
+const TAB_ORDER = ["Dashboard", "Windows", "OBS"];
+
+function sortTabs() {
+ const rank = (name) => {
+ const at = TAB_ORDER.indexOf(name);
+ return at === -1 ? TAB_ORDER.length : at;
+ };
+ for (const name of Object.keys(tabs).sort((a, b) => rank(a) - rank(b))) {
+ tabBar.append(tabs[name].button);
+ tabBody.append(tabs[name].section);
+ }
+}
+
function showTab(name) {
for (const [n, tab] of Object.entries(tabs)) {
tab.section.hidden = n !== name;
@@ -168,6 +181,7 @@ async function boot() {
}
}
ready = true;
+ sortTabs();
const saved = localStorage.getItem(TAB_KEY);
showTab(tabs[saved] ? saved : "Dashboard");
}