@@ -294,6 +288,36 @@ export function UsageBody({ data, period, t, onOpenTurn }: { data: UsageData; pe
);
}
+type ChartRow = { label: string; values: Record
; total: number };
+
+function Bars({ rows, max, series, t, small, testid }: { rows: ChartRow[]; max: number; series: readonly string[]; t: T; small?: boolean; testid: string }) {
+ return (
+
+ {rows.map((r) => (
+
+ {series.map((s) =>
+ r.values[s] ? (
+
+ ) : null,
+ )}
+
+ ))}
+
+ );
+}
+
+function DayLabels({ days }: { days: [string, number, number][] }) {
+ if (days.length <= 1) return null;
+ return (
+
+ {days.map(([label, start]) => (
+ {days.length <= 7 ? new Date(start).toLocaleDateString(undefined, { weekday: "short", day: "2-digit" }) : new Date(start).getDate()}
+ ))}
+
+ );
+}
+
function Tile({ label, value, sub, testid }: { label: string; value: string; sub: string; testid?: string }) {
return (
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 5978fd88..44b11cfd 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -3935,6 +3935,9 @@
"not_checked_other": "{{count}} not checked yet",
"median_sub": "waiting for you not counted",
"per_day": "Tokens per day, by purpose",
+ "overhead": "Everything but main work",
+ "overhead_sub": "On its own scale: the tallest day is {{tokens}} tokens.",
+ "point_hint": "Point at a bar to see each part's tokens.",
"by_coworker": "By coworker",
"coworker": "Coworker",
"automation": "(automation)",
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index e8f837c9..b1d24e1a 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -3876,6 +3876,9 @@
"not_checked_other": "{{count}} 个尚未检查",
"median_sub": "不计等你的时间",
"per_day": "每天的令牌,按用途",
+ "overhead": "主要工作以外的全部",
+ "overhead_sub": "单独的刻度:最高的一天为 {{tokens}} 令牌。",
+ "point_hint": "指向柱形可查看每一部分的令牌数。",
"by_coworker": "按同事",
"coworker": "同事",
"automation": "(自动化)",
diff --git a/surfaces/gui/src/obs3.test.ts b/surfaces/gui/src/obs3.test.ts
index 7e02b18f..72cf372f 100644
--- a/surfaces/gui/src/obs3.test.ts
+++ b/surfaces/gui/src/obs3.test.ts
@@ -7,6 +7,7 @@ import {
footerParts,
healthTone,
localDays,
+ overheadByDay,
previousDays,
purposeByDay,
seriesOf,
@@ -69,6 +70,18 @@ describe("tokens per day, by purpose", () => {
expect(out.rows[1].total).toBe(7);
expect(out.legend).toEqual({ main: 120, summary: 0, auto_approver: 7, title: 3, other: 0 });
});
+ it("the second chart leaves main work out and has its own scale (T3-7)", () => {
+ const days: [string, number, number][] = [["d1", 0, 10], ["d2", 10, 20]];
+ const g = (day: string, purpose: string, total: number) => ({ key: { day, purpose }, total }) as any;
+ const chart = purposeByDay(days, [g("d1", "main", 17_000_000), g("d1", "summary", 36_000), g("d2", "auto_approver", 457_000), g("d2", "title", 7_700)]);
+ const o = overheadByDay(chart)!;
+ expect(o.series).toEqual(["summary", "auto_approver", "title", "other"]);
+ expect(o.rows.map((r) => r.total)).toEqual([36_000, 464_700]);
+ expect(o.max).toBe(464_700); // not the 17M of main work
+ expect(o.rows[0].values.main).toBe(0);
+ // only main work: no second chart
+ expect(overheadByDay(purposeByDay(days, [g("d1", "main", 5)]))).toBeNull();
+ });
});
describe("the Auto-approve strip", () => {
diff --git a/surfaces/gui/src/obs3.ts b/surfaces/gui/src/obs3.ts
index 6c9f79a3..b0619ce3 100644
--- a/surfaces/gui/src/obs3.ts
+++ b/surfaces/gui/src/obs3.ts
@@ -105,6 +105,16 @@ export function purposeByDay(days: DayBoundary[], groups: RollupGroup[]) {
return { rows, legend, max: Math.max(1, ...rows.map((r) => r.total)) };
}
+/** T3-7: the same days without main work, on their own scale, so summaries, the
+ * auto-approver and titles get a readable size (main work is often 95% or more). Null when
+ * the period has none of them. */
+export function overheadByDay(chart: ReturnType) {
+ const series = SERIES.filter((s) => s !== "main");
+ const rows = chart.rows.map((r) => ({ ...r, values: { ...r.values, main: 0 }, total: r.total - r.values.main }));
+ const max = Math.max(0, ...rows.map((r) => r.total));
+ return max > 0 ? { rows, max, series } : null;
+}
+
// -- the Auto-approve strip (§7.3, M3-R5) -----------------------------------------------------
/** Under 10 checks a part is a count ("allowed 1"), from 10 a share ("allowed 72%"): "allowed
* 100%" of one check says nothing. */
diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.css
index ce359554..7c032c75 100644
--- a/surfaces/gui/src/styles.css
+++ b/surfaces/gui/src/styles.css
@@ -2620,6 +2620,7 @@ html[data-theme="dark"] { --bar-model:#4c8dff; --bar-tool:#3fb8ad; --bar-wait:#3
.p3-card { padding:12px 14px; min-width:0; }
.p3-h { font-weight:500; font-size:var(--fs-ui); color:var(--ink); }
.p3-bars { display:flex; align-items:flex-end; gap:3px; height:120px; margin-top:10px; border-bottom:1px solid var(--line); }
+.p3-bars.small { height:56px; margin-top:6px; } /* T3-7 */
.p3-bar { flex:1; height:100%; display:flex; flex-direction:column-reverse; min-width:2px; }
.p3-bar i { display:block; width:100%; }
.p3-bar i:last-child { border-radius:3px 3px 0 0; }