diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-10 16:36:23 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-10 16:36:23 +0100 |
| commit | cdb96a6fcf60716b5fb96cc999d452e75b75ed42 (patch) | |
| tree | 032612b51af870b7b54d7d8f68430d9c92ab8563 /static/app.js | |
| parent | 5a8da8ab392266d5f3bbf3abed61472d6734f31c (diff) | |
| download | deck-it-cdb96a6fcf60716b5fb96cc999d452e75b75ed42.tar.gz deck-it-cdb96a6fcf60716b5fb96cc999d452e75b75ed42.zip | |
feat: icons in the tab bar
Each tab is a Nerd Font glyph (gauge, windows, camera, chat, printer),
with the name only next to the active one; a tab without an icon keeps
its name. Swipes find tabs by data-tab now that the text is not the name.
The reload button is the refresh glyph.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/app.js')
| -rw-r--r-- | static/app.js | 14 |
1 files changed, 12 insertions, 2 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]); |
