@enigmax/dashboard 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/index.html +28 -13
- package/package.json +1 -1
package/assets/index.html
CHANGED
|
@@ -545,21 +545,36 @@
|
|
|
545
545
|
const reset = w.kind === "session"
|
|
546
546
|
? (w.resetsAt ? "Resets " + fmtResetIn(w.resetsAt) : "No active session")
|
|
547
547
|
: (w.resetsAt ? fmtResetAt(w.resetsAt) : "");
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
548
|
+
const live = w.live ? ' <span class="tag meas">live</span>' : "";
|
|
549
|
+
const span = w.kind === "session" ? 5 * 3600000 : 7 * 86400000;
|
|
550
|
+
const head = '<div class="wcard"><div class="wtitle">' + esc(w.label) + live + '</div><div class="wreset">' + esc(reset) + '</div>';
|
|
551
|
+
if (sub === "weeklySonnet" && (w.used || 0) === 0 && w.pct == null) {
|
|
552
|
+
return head + '<div class="wval muted">You haven\'t used Sonnet yet</div></div>';
|
|
553
|
+
}
|
|
554
|
+
// Every card shows a bar: the real usage % when known (live or vs a set limit),
|
|
555
|
+
// otherwise how much of the window has elapsed in time - so the weekly card has a
|
|
556
|
+
// bar even before the proxy has captured live limits.
|
|
557
|
+
let barPct, barCol, barNote, valLine;
|
|
558
|
+
if (w.pct != null) {
|
|
559
|
+
barPct = Math.min(100, w.pct);
|
|
560
|
+
barCol = w.pct >= 90 ? "var(--accent2)" : "var(--accent)";
|
|
561
|
+
barNote = (w.live ? "live · " : "") + fmt(w.used || 0) + " tok";
|
|
562
|
+
valLine = Math.round(w.pct) + "% used";
|
|
563
|
+
} else if (w.resetsAt) {
|
|
564
|
+
const start = w.resetsAt - span;
|
|
565
|
+
barPct = Math.max(0, Math.min(100, (Date.now() - start) / span * 100));
|
|
566
|
+
barCol = "var(--muted)";
|
|
567
|
+
barNote = "window " + Math.round(barPct) + "% elapsed";
|
|
568
|
+
valLine = fmt(w.used || 0) + " tok";
|
|
556
569
|
} else {
|
|
557
|
-
|
|
558
|
-
+ '<div class="wset"><input type="number" min="0" class="wlimit" data-plan="' + sub + '" placeholder="set limit (tokens)">'
|
|
559
|
-
+ '<button type="button" class="laddb" data-plan="' + sub + '">Set</button></div>';
|
|
570
|
+
barPct = 0; barCol = "var(--muted)"; barNote = ""; valLine = fmt(w.used || 0) + " tok";
|
|
560
571
|
}
|
|
561
|
-
const
|
|
562
|
-
|
|
572
|
+
const bar = '<div class="bar-track" style="margin-top:8px"><div class="bar-fill" style="width:' + barPct + '%;background:' + barCol + '"></div></div>'
|
|
573
|
+
+ (barNote ? '<div class="wreset" style="margin-top:4px">' + esc(barNote) + "</div>" : "");
|
|
574
|
+
const setter = w.pct == null
|
|
575
|
+
? '<div class="wset"><input type="number" min="0" class="wlimit" data-plan="' + sub + '" placeholder="set limit for %"><button type="button" class="laddb" data-plan="' + sub + '">Set</button></div>'
|
|
576
|
+
: "";
|
|
577
|
+
return head + '<div class="wval">' + valLine + "</div>" + bar + setter + "</div>";
|
|
563
578
|
}
|
|
564
579
|
function renderWindows(u) {
|
|
565
580
|
const w = u && u.windows;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmax/dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Local browser dashboard UI for enigma: the static page and chart assets enigma serves on its loopback dashboard (savings, real tool usage, in-browser settings). Installed on demand by enigma-cli; not a runtime dependency.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|