aboutsummaryrefslogtreecommitdiffstats
path: root/static/modules/stats.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-10 18:23:20 +0100
committerDanilo M. <danix@danix.xyz>2026-11-10 18:23:20 +0100
commit5b85512ccd0d87cb61c30f73cea262c7a0545d37 (patch)
treeb186fd0b5f1fad48c5b0be6b78da3661ea6aa8c8 /static/modules/stats.js
parent624a7a845c601990f5550a3cb3db38b139feb5da (diff)
downloaddeck-it-5b85512ccd0d87cb61c30f73cea262c7a0545d37.tar.gz
deck-it-5b85512ccd0d87cb61c30f73cea262c7a0545d37.zip
feat(stats): an OS row with logo, kernel and uptime
The System card's small 'up Nh' line becomes a full-width tile: the distro's Nerd Font logo, NAME and VERSION_ID from /etc/os-release in large type, the codename and kernel release below, and the uptime large on the right. An unknown distro gets Tux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/modules/stats.js')
-rw-r--r--static/modules/stats.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/static/modules/stats.js b/static/modules/stats.js
index e280e47..0e35a91 100644
--- a/static/modules/stats.js
+++ b/static/modules/stats.js
@@ -23,6 +23,12 @@ const uptime = (s) => {
return d ? `${d}d ${h}h` : `${h}h`;
};
+// Nerd Font distro logos; anything else gets Tux.
+const DISTRO = {
+ slackware: "\uf318", arch: "\uf303", debian: "\uf306", fedora: "\uf30a",
+ ubuntu: "\uf31b", gentoo: "\uf30d", opensuse: "\uf314", void: "\uf32e",
+};
+
function tile(label, value, sub) {
const d = document.createElement("div");
d.className = "mtile";
@@ -58,9 +64,16 @@ export default {
g ? `${bytes(g.memUsed)} / ${bytes(g.memTotal)} GiB` : "no GPU"),
tile("Network", `↓${rate(st.net.down)} ↑${rate(st.net.up)}`),
);
- const foot = document.createElement("div");
- foot.className = "mfoot";
- foot.textContent = `up ${uptime(st.uptime)}`;
- box.append(foot);
+ const os = st.os ?? {};
+ const sys = document.createElement("div");
+ sys.className = "mtile msys";
+ sys.innerHTML = `<i class="nf"></i><div><span class="mvalue"></span><span class="msub"></span></div>
+ <div class="mup"><span class="mlabel">uptime</span><span class="mvalue num"></span></div>`;
+ sys.querySelector("i").textContent = DISTRO[os.id] ?? "\uf17c";
+ sys.querySelector("div .mvalue").textContent = os.name ?? "Linux";
+ sys.querySelector(".msub").textContent =
+ [os.codename, `Linux ${os.kernel ?? ""}`].filter(Boolean).join(" · ");
+ sys.querySelector(".mup .mvalue").textContent = uptime(st.uptime);
+ box.append(sys);
},
};