diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index e317a2749..c93f1c9cc 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -1161,9 +1161,9 @@ body.panel .row.pref.flash { border-radius: 10px; } .balance-curve .bc-pace { color: var(--muted); } .qc-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; } .qc-line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; } -/* a window far shorter than the span drawn (a 5-hour one over a week) is a - comb of drops: faint, and without its upright even burn */ -.qc-line.qc-short { stroke-width: 1; opacity: .45; } +/* a window far shorter than the span drawn (a 5-hour one over a week) draws + its current cycle only, lighter, and without its upright even burn */ +.qc-line.qc-short { stroke-width: 1.25; opacity: .7; } .qc-even { stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; vector-effect: non-scaling-stroke; } .qc-now { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 1 2; vector-effect: non-scaling-stroke; } .quota-curve .qc-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; } diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 454652099..2ef41934c 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -16800,13 +16800,17 @@ function drawQuotaPlot(g, lines, x0, x1, w, h, now, thin) { const s = i % 7, color = `var(--c${s + 1})`; const c = l.cycle || quotaCycle(l, now); // a window far shorter than the span (a 5-hour one over a week) is - // drawn faint, without its even burn, an all but upright dash + // drawn without its even burn, an all but upright dash const short = !thin && c.reset && c.reset - c.start < (x1 - x0) / 12; if (c.reset && c.start < c.reset && !short) { const e = sv("line", { x1: X(c.start), y1: 0, x2: X(c.reset), y2: h, class: "qc-even", "data-series": s }, { stroke: color }); g.append(e); } - const d = quotaPaths(l.points, x0, x1, w, h); + // and only its current cycle: the cycles before it, each a drop of its + // own, crawled across the week like a comb of bugs (@xxxxxthhh on X) + let pts = l.points; + if (short) { const now1 = pts.filter((p) => p.at >= c.start); pts = now1.length ? now1 : pts.slice(-1); } + const d = quotaPaths(pts, x0, x1, w, h); if (d) g.append(sv("path", { d, class: "qc-line" + (short ? " qc-short" : ""), "data-name": l.name, "data-series": s }, { stroke: color })); }); // a spark ends at now already, and in 16px the dotted now line read as a diff --git a/internal/gui/tests/quota-curve.test.cjs b/internal/gui/tests/quota-curve.test.cjs index d94619018..e92e0b4ae 100644 --- a/internal/gui/tests/quota-curve.test.cjs +++ b/internal/gui/tests/quota-curve.test.cjs @@ -325,7 +325,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await curve.locator("path.qc-line.qc-short").getAttribute("data-name"), "5 hours"); assert.equal(await curve.locator("line.qc-now").count(), 1); const five = await curve.locator('path.qc-line[data-name="5 hours"]').getAttribute("d"); - assert.equal((five.match(/M/g) || []).length, 2, "the 5-hour line breaks where its window started again: " + five); + assert.equal((five.match(/M/g) || []).length, 1, "the 5-hour line is its current cycle only, no comb of earlier drops: " + five); const legend = await curve.locator(".qc-key").allTextContents(); assert.deepEqual(legend, [w.five + "40%", w.week + "70%"]); assert.equal(await page.locator(".subscription-card", { hasText: "Kimi" }).locator(".quota-curve").count(), 0, "no readings, no curve");