aboutsummaryrefslogtreecommitdiffstats
path: root/static/modules/stats.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-10 19:53:32 +0100
committerDanilo M. <danix@danix.xyz>2026-11-10 19:53:32 +0100
commitc75b6f1ff69d944bb07b9395880a63620a0a8a00 (patch)
tree85275188ebfbaf7863f0089b4644e089cd977604 /static/modules/stats.js
parentd0c5ae2bf4a8a0ab1ddec409e007e7aef0dfc3e3 (diff)
downloaddeck-it-c75b6f1ff69d944bb07b9395880a63620a0a8a00.tar.gz
deck-it-c75b6f1ff69d944bb07b9395880a63620a0a8a00.zip
feat(dashboard): one fixed screen for the tablet
The Dashboard tab drops the draggable card grid for a fixed layout: a top band of system, Claude and tablet chips with trend and fill backgrounds, music and spending always on, a row of one to three busy modules (printer, build VM, OBS) that scroll long lines, and the action icons in Hyprland's rotating border. The stats, tablet and llm panels and the vendored Gridstack go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/modules/stats.js')
-rw-r--r--static/modules/stats.js79
1 files changed, 0 insertions, 79 deletions
diff --git a/static/modules/stats.js b/static/modules/stats.js
deleted file mode 100644
index 0e35a91..0000000
--- a/static/modules/stats.js
+++ /dev/null
@@ -1,79 +0,0 @@
-// deck-it - stats panel
-// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-const gib = (kb) => (kb / 1048576).toFixed(1);
-const bytes = (b) => (b == null ? "?" : (b / 1073741824).toFixed(1));
-const rate = (b) => (b >= 1048576 ? `${(b / 1048576).toFixed(1)}M` : `${Math.round(b / 1024)}k`);
-const uptime = (s) => {
- const d = Math.floor(s / 86400);
- const h = Math.floor((s % 86400) / 3600);
- 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";
- const l = document.createElement("span");
- l.className = "mlabel";
- l.textContent = label;
- const v = document.createElement("span");
- v.className = "mvalue num";
- v.textContent = value;
- const s = document.createElement("span");
- s.className = "msub";
- s.textContent = sub || "";
- d.append(l, v, s);
- return d;
-}
-
-export default {
- title: "System",
- interval: 1,
-
- mount(el) {
- el.innerHTML = `<div class="stats"></div>`;
- },
-
- update(st, el) {
- const box = el.querySelector(".stats");
- box.textContent = "";
- const g = st.gpu;
- box.append(
- tile(st.cpuName ?? "CPU", `${st.cpu}%`, st.cpuTemp != null ? `${st.cpuTemp}°C` : "—"),
- tile("Memory", gib(st.memUsed), `/ ${gib(st.memTotal)} GiB`),
- tile(g?.name ?? "GPU", g?.temp != null ? `${g.temp}°` : "—",
- g ? `${bytes(g.memUsed)} / ${bytes(g.memTotal)} GiB` : "no GPU"),
- tile("Network", `↓${rate(st.net.down)} ↑${rate(st.net.up)}`),
- );
- 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);
- },
-};