diff options
| -rw-r--r-- | static/app.js | 14 | ||||
| -rw-r--r-- | static/deck.css | 3 | ||||
| -rw-r--r-- | static/index.html | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/static/app.js b/static/app.js index 3ec7dc2..61e094b 100644 --- a/static/app.js +++ b/static/app.js @@ -51,10 +51,20 @@ function saveLayout() { } } +// Tab icons, Font Awesome glyphs in the Nerd Font the server serves; a tab +// not listed shows its name. The name also shows next to the active one. +const TAB_ICONS = { Dashboard: "\uf0e4", Windows: "\uf2d2", OBS: "\uf03d", Assistant: "\uf086", K1C: "\uf02f" }; + function ensureTab(name) { if (tabs[name]) return tabs[name]; const button = document.createElement("button"); - button.textContent = name; + button.dataset.tab = name; + button.setAttribute("aria-label", name); + button.title = name; + button.innerHTML = `<i class="nf"></i><span></span>`; + button.firstElementChild.textContent = TAB_ICONS[name] ?? ""; + button.lastElementChild.textContent = name; + if (!TAB_ICONS[name]) button.classList.add("named"); button.onclick = () => showTab(name); tabBar.append(button); const section = document.createElement("section"); @@ -282,7 +292,7 @@ async function boot() { } function stepTab(dir) { - const names = [...tabBar.children].map((button) => button.textContent); + const names = [...tabBar.children].map((button) => button.dataset.tab); const at = names.findIndex((name) => !tabs[name]?.section.hidden); const next = at + dir; if (at !== -1 && next >= 0 && next < names.length) showTab(names[next]); diff --git a/static/deck.css b/static/deck.css index 98a2c2a..1ec72b6 100644 --- a/static/deck.css +++ b/static/deck.css @@ -74,6 +74,9 @@ body { background: var(--udt-surface0); border-color: var(--udt-surface1); } +.tabs button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; } +.tabs button .nf { font-size: 1.5rem; line-height: 1; margin-right: 6px; } /* the glyphs draw past their advance */ +.tabs button:not(.active):not(.named) span { display: none; } #tab-body { flex: 1; min-height: 0; overflow: auto; } .tab-panel { diff --git a/static/index.html b/static/index.html index ca3e827..fe5a8c6 100644 --- a/static/index.html +++ b/static/index.html @@ -37,7 +37,7 @@ <body> <header class="topbar"> <nav id="tabs" class="tabs"></nav> - <button id="reload" class="reload" aria-label="Reload the dashboard" title="Reload">⟳</button> + <button id="reload" class="reload" aria-label="Reload the dashboard" title="Reload"><i class="nf"></i></button> </header> <div id="tab-body"></div> <div id="asleep" hidden> |
