diff options
Diffstat (limited to 'static')
| -rw-r--r-- | static/dashboard.js | 25 | ||||
| -rw-r--r-- | static/deck.css | 9 |
2 files changed, 21 insertions, 13 deletions
diff --git a/static/dashboard.js b/static/dashboard.js index 390c802..21e1cf3 100644 --- a/static/dashboard.js +++ b/static/dashboard.js @@ -24,7 +24,7 @@ export const HISTORY = 120; // trend samples: two minutes at 1 s const RUNNING = ["k1c", "sbbuilder", "obs"]; // the running row's order const G = { cpu: "", mem: "\u{f035b}", gpu: "\u{f08ae}", net: "\u{f04e1}", - wifi: "", charging: "\u{f0084}", tux: "" }; + wifi: "", charging: "\u{f0084}", tux: "", clock: "" }; const BATTERY = ["", "", "", "", ""]; // Nerd Font distro logos by os-release ID. const DISTRO = { @@ -109,8 +109,10 @@ const SKELETON = ` <stop offset="1" style="stop-color:var(--udt-border-1);stop-opacity:.05"/></linearGradient> </defs></svg> <section class="dash-top"> - <div class="dash-id"><i class="nf logo"></i><b class="os"></b><span class="kernel"></span> - <span class="sep">·</span><span class="up"></span></div> + <div class="dash-id"><i class="nf logo"></i><span><b class="os"></b> <span class="codename"></span></span> + <span class="sep">|</span><span><i class="nf">${G.tux}</i><span class="kernel"></span></span> + <span class="sep">|</span><span><i class="nf">${G.clock}</i><span class="up"></span></span> + <span class="sep upd">|</span><span class="upd n-upd"></span></div> <div class="chips sys"> <div class="chip c-cpu"><svg viewBox="0 0 120 100" preserveAspectRatio="none"><path class="hy"/></svg> <i class="nf ic">${G.cpu}</i><span class="col"><span class="n"></span><span class="v num"></span></span><span class="s"></span></div> @@ -164,8 +166,12 @@ export default { if (on.has("stats")) poll("stats", 1, (st) => { $(".logo").textContent = DISTRO[st.os?.id] ?? G.tux; $(".os").textContent = st.os?.name ?? ""; - $(".kernel").textContent = [st.os?.codename, `Linux ${st.os?.kernel ?? ""}`].filter(Boolean).join(" · "); - $(".up").textContent = `up ${uptime(st.uptime)}`; + $(".codename").textContent = st.os?.codename ? `-${st.os.codename}` : ""; + $(".codename").hidden = !st.os?.codename; + $(".kernel").textContent = st.os?.kernel ?? ""; + $(".up").textContent = uptime(st.uptime); + for (const e of root.querySelectorAll(".upd")) e.hidden = st.updates == null; + $(".n-upd").textContent = `${st.updates} update${st.updates === 1 ? "" : "s"} available`; push(hist.cpu, st.cpu); push(hist.down, st.net.down); push(hist.up, st.net.up); $(".c-cpu .n").textContent = st.cpuName ?? ""; $(".c-cpu path").setAttribute("d", area(hist.cpu, Math.max(25, ...hist.cpu))); @@ -187,17 +193,18 @@ export default { chip(".c-net", `↓${rate(st.net.down)} ↑${rate(st.net.up)}`); }); - const program = (title, p) => { + const program = (title, p, brand) => { + const h3 = `<h3>${brand ? `<span class="brand ${brand}"></span>` : ""}${esc(title)}</h3>`; const model = `<span class="model">${esc(p.model ? short(p.model) : "—")}</span>`; if (!(p.cost > 0)) { // local or free models: tokens, not dollars - return `<div class="prog inline"><h3>${esc(title)}</h3>${model} + return `<div class="prog inline">${h3}${model} <span class="tok"><span class="lbl">session</span><b class="num">${tok(p.session_tokens)}</b></span> <span class="tok"><span class="lbl">total</span><b class="num">${tok(p.tokens)}</b></span></div>`; } const parts = spendParts(p.models); const total = parts.reduce((a, m) => a + m.cost, 0); const color = (m, i) => (m.model === "other" ? OTHER : SPEND[i]); - return `<div class="prog"><header><h3>${esc(title)}</h3>${model}</header> + return `<div class="prog"><header>${h3}${model}</header> <div class="nums"> <div><div class="lbl">session</div><div class="big num">${money(p.session_cost)}</div> <div class="sub">${tok(p.session_tokens)} · ${p.session_calls ?? 0} calls</div></div> @@ -223,7 +230,7 @@ export default { chip(".c-5h", pct(c.five_hour_pct), null, c.five_hour_pct, c.five_hour_pct >= 80); chip(".c-7d", pct(c.seven_day_pct), null, c.seven_day_pct, c.seven_day_pct >= 80); spend._offline = null; - spend.innerHTML = program("opencode", st.opencode ?? {}) + program("Local Agent", st.assistant ?? {}); + spend.innerHTML = program("opencode", st.opencode ?? {}, "opencode") + program("Local Agent", st.assistant ?? {}); }); if (on.has("tablet")) poll("tablet", 10, (t) => { diff --git a/static/deck.css b/static/deck.css index 1d02a85..35c6335 100644 --- a/static/deck.css +++ b/static/deck.css @@ -646,10 +646,11 @@ select { .dash-defs { position: absolute; } .dash-top { display: grid; grid-template-rows: auto 1fr 1fr; gap: 8px; min-height: 0; } -.dash-id { display: flex; align-items: center; gap: 14px; font-size: 0.857rem; color: var(--udt-subtext0); white-space: nowrap; overflow: hidden; } -.dash-id .logo { font-size: 1.15rem; color: var(--udt-accent); } +.dash-id { display: flex; align-items: center; gap: 8px; font-size: 0.857rem; color: var(--udt-subtext0); white-space: nowrap; overflow: hidden; } +.dash-id .logo { font-size: 1.15rem; color: var(--udt-accent); margin-right: 4px; } +.dash-id .nf:not(.logo) { margin-right: 10px; } /* the glyphs draw past their advance */ .dash-id b { color: var(--udt-text); font-weight: 600; } -.dash-id .sep { color: var(--udt-surface2); } +.dash-id .sep { color: var(--udt-border-1); font-weight: 600; } .dash .chips { display: grid; gap: 8px; min-height: 0; } .dash .chips.sys { grid-template-columns: 1fr 1fr 1fr 1.3fr; } .dash .chips.aux { grid-template-columns: 1fr 1fr 1fr 1fr 1.3fr; } @@ -687,7 +688,7 @@ select { .dash .prog { display: flex; flex-direction: column; gap: 6px; } .dash .prog header { display: flex; align-items: baseline; gap: 10px; } -.dash .prog h3 { margin: 0; font-size: 0.857rem; text-transform: uppercase; letter-spacing: .08em; color: var(--udt-subtext0); } +.dash .prog h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 0.857rem; text-transform: uppercase; letter-spacing: .08em; color: var(--udt-subtext0); } .dash .prog .model { margin-left: auto; font-size: 0.786rem; color: var(--udt-overlay0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .dash .prog .nums { display: flex; gap: 22px; align-items: baseline; } .dash .prog .big { font-size: 1.25rem; font-weight: 600; } |
