Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(views): prevent crowded transcript end ticks (#7458)
Jiayuan Zhange5b28564b08d
diff --git a/packages/views/common/task-transcript/build-steps.test.ts b/packages/views/common/task-transcript/build-steps.test.tsindex 855e48338a..6d479d4b8d 100644--- a/packages/views/common/task-transcript/build-steps.test.ts+++ b/packages/views/common/task-transcript/build-steps.test.ts@@ -237,6 +237,16 @@ describe("timelineTicks", () => {it("returns nothing for a run with no length", () => {expect(timelineTicks(0)).toEqual([]);});++ it("omits a round tick that would crowd the exact run end", () => {+ expect(timelineTicks(2 * 60_000 + 2_000, 6)).toEqual([+ 0,+ 30_000,+ 60_000,+ 90_000,+ 122_000,+ ]);+ });});describe("laneSegmentPosition", () => {diff --git a/packages/views/common/task-transcript/build-steps.ts b/packages/views/common/task-transcript/build-steps.tsindex af0dc3b59f..040fbeab97 100644--- a/packages/views/common/task-transcript/build-steps.ts+++ b/packages/views/common/task-transcript/build-steps.ts@@ -354,6 +354,16 @@ export function timelineTicks(totalMs: number, maxTicks = 6): number[] {const interval = steps.find((step) => totalMs / step <= maxTicks) ?? steps[steps.length - 1]!;const ticks: number[] = [];for (let at = 0; at < totalMs; at += interval) ticks.push(at);+ const lastRoundTick = ticks[ticks.length - 1];+ // The exact run end is more useful than a nearby round tick. Keeping both+ // makes labels such as `2m` and `2m 2s` occupy the same right-edge pixels.+ if (+ lastRoundTick !== undefined &&+ lastRoundTick > 0 &&+ totalMs - lastRoundTick < interval / 2+ ) {+ ticks.pop();+ }ticks.push(totalMs);return ticks;}