Skip to content

Commit 7244f47

Browse files
committed
feat(web): tapping the Tasks line opens the whole todo list
The Tasks line only showed the count and the current step, and its details button appeared only when that text was cut off, so the rest of the list still meant opening a turn's work log. A thread-now line can now carry details that open from its text, by tap or hover. The Tasks line uses that for every step, marked done, in progress, or not started. Droid (Claude Opus) in T3 Code
1 parent 8edd798 commit 7244f47

4 files changed

Lines changed: 102 additions & 25 deletions

File tree

‎apps/web/src/components/chat/ThreadActivityBanners.tsx‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
} from "@t3tools/client-runtime/state/thread-execution";
1212
import { childThreadInputsTitle } from "@t3tools/client-runtime/state/threads";
1313
import {
14+
CheckIcon,
15+
CircleDotIcon,
16+
CircleIcon,
1417
GitBranchIcon,
1518
ListTodoIcon,
1619
MessageCircleIcon,
@@ -112,9 +115,42 @@ export function tasksNowItem(input: {
112115
icon: <ListTodoIcon />,
113116
title: input.todoList.title,
114117
description: input.todoList.current ?? undefined,
118+
details: (
119+
<ol className="flex flex-col gap-1">
120+
{input.todoList.steps.map((step) => (
121+
<li key={step.id} className="flex items-start gap-1.5">
122+
<span
123+
aria-hidden
124+
className={cn(
125+
"flex h-4 shrink-0 items-center [&_svg]:size-3",
126+
step.status === "completed" && "text-success",
127+
)}
128+
>
129+
{step.status === "completed" ? (
130+
<CheckIcon />
131+
) : step.status === "running" ? (
132+
<CircleDotIcon />
133+
) : (
134+
<CircleIcon />
135+
)}
136+
</span>
137+
<span className={cn(step.status === "completed" && "text-muted-foreground")}>
138+
<span className="sr-only">{TASK_STEP_STATUS_LABELS[step.status]}: </span>
139+
{step.text}
140+
</span>
141+
</li>
142+
))}
143+
</ol>
144+
),
115145
};
116146
}
117147

148+
const TASK_STEP_STATUS_LABELS = {
149+
completed: "Done",
150+
running: "In progress",
151+
pending: "Not started",
152+
} as const;
153+
118154
/** Background commands and subagents, for the end of the timeline. */
119155
export function backgroundWorkNowItem(input: {
120156
readonly threadId: ThreadId;

‎apps/web/src/components/chat/ThreadNow.tsx‎

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type { ReactNode } from "react";
33

44
import { threadSyncLabel, type ThreadSyncPhase } from "../../threadSync";
55
import { cn } from "~/lib/utils";
6+
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
7+
import { ComposerBanner } from "./ComposerBanner";
68
import { NoticeText } from "./ComposerBannerStack";
79

810
/** A line of thread state for the end of the timeline. */
@@ -11,6 +13,8 @@ export interface ThreadNowItem {
1113
readonly icon: ReactNode;
1214
readonly title: ReactNode;
1315
readonly description?: ReactNode;
16+
/** Opens from the title and detail, for state that does not fit on one line. */
17+
readonly details?: ReactNode;
1418
readonly actions?: ReactNode;
1519
}
1620

@@ -33,6 +37,17 @@ function ThreadNowLine({
3337
/** Announces the line when it appears; only for something that needs the user. */
3438
readonly announce?: boolean;
3539
}) {
40+
const text = (
41+
<>
42+
{item.title}
43+
{item.description ? (
44+
<>
45+
{" "}
46+
<span aria-hidden>·</span> {item.description}
47+
</>
48+
) : null}
49+
</>
50+
);
3651
return (
3752
<div
3853
role={announce ? "alert" : undefined}
@@ -44,20 +59,40 @@ function ThreadNowLine({
4459
</span>
4560
{/* Title and detail read as one line that gives way before the actions, so Stop stays
4661
reachable; when it is cut, its details button shows all of it. */}
47-
<NoticeText
48-
detailsLabel={
49-
typeof item.title === "string" ? `Show details: ${item.title}` : "Show details"
50-
}
51-
className="min-w-0 truncate"
52-
>
53-
{item.title}
54-
{item.description ? (
55-
<>
56-
{" "}
57-
<span aria-hidden>·</span> {item.description}
58-
</>
59-
) : null}
60-
</NoticeText>
62+
{item.details ? (
63+
<Popover>
64+
<PopoverTrigger
65+
openOnHover
66+
render={
67+
<button
68+
type="button"
69+
className="min-w-0 cursor-pointer truncate text-start hover:text-foreground"
70+
/>
71+
}
72+
>
73+
{text}
74+
</PopoverTrigger>
75+
<PopoverPopup
76+
aria-label={typeof item.title === "string" ? item.title : "Details"}
77+
tooltipStyle
78+
side="top"
79+
className="max-w-[min(30rem,calc(100vw-2rem))] whitespace-normal wrap-anywhere"
80+
>
81+
<ComposerBanner.Scroll className="max-h-[min(var(--available-height),24rem,40dvh)]">
82+
{item.details}
83+
</ComposerBanner.Scroll>
84+
</PopoverPopup>
85+
</Popover>
86+
) : (
87+
<NoticeText
88+
detailsLabel={
89+
typeof item.title === "string" ? `Show details: ${item.title}` : "Show details"
90+
}
91+
className="min-w-0 truncate"
92+
>
93+
{text}
94+
</NoticeText>
95+
)}
6196
{item.actions ? (
6297
<>
6398
<span aria-hidden>·</span>

‎packages/client-runtime/src/state/threadExecution.test.ts‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -422,33 +422,34 @@ describe("presentThreadTodoList", () => {
422422
plans,
423423
});
424424

425-
it("shows the latest list's progress and current step while its run works", () => {
425+
it("shows the latest list's progress, current step and steps while its run works", () => {
426426
const earlier = sessionRun("earlier", 1, "completed");
427+
const current = todoList("current", ["completed", "running", "pending"]);
427428
expect(
428429
presentThreadTodoList(
429430
projection(
430431
[earlier, sessionRun("current", 2, "running")],
431-
[
432-
todoList("current", ["completed", "running", "pending"]),
433-
todoList("earlier", ["pending"]),
434-
],
432+
[current, todoList("earlier", ["pending"])],
435433
),
436434
),
437-
).toEqual({ title: "Tasks 1/3", current: "Step 1" });
435+
).toEqual({ title: "Tasks 1/3", current: "Step 1", steps: current.steps });
438436
expect(
439437
presentThreadTodoList(
440438
projection(
441439
[earlier, sessionRun("current", 2, "running")],
442440
[todoList("current", ["completed", "completed"])],
443441
),
444442
),
445-
).toEqual({ title: "Tasks 2/2", current: null });
443+
).toMatchObject({ title: "Tasks 2/2", current: null });
446444
});
447445

448446
it("keeps unfinished tasks after the turn until they finish or another session takes over", () => {
449447
const ended = sessionRun("ended", 1, "completed");
450448
const unfinished = projection([ended], [todoList("ended", ["completed", "pending"])]);
451-
expect(presentThreadTodoList(unfinished)).toEqual({ title: "Tasks 1/2", current: "Step 1" });
449+
expect(presentThreadTodoList(unfinished)).toMatchObject({
450+
title: "Tasks 1/2",
451+
current: "Step 1",
452+
});
452453
expect(
453454
presentThreadTodoList(projection([ended], [todoList("ended", ["completed", "completed"])])),
454455
).toBeNull();

‎packages/client-runtime/src/state/threadExecution.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,14 @@ export function presentProviderGoal(
408408
};
409409
}
410410

411+
type ThreadTodoList = Extract<ThreadStructure["plans"][number], { readonly kind: "todo_list" }>;
412+
411413
export interface ThreadTodoListPresentation {
412414
readonly title: string;
413415
readonly current: string | null;
416+
readonly steps: ThreadTodoList["steps"];
414417
}
415418

416-
type ThreadTodoList = Extract<ThreadStructure["plans"][number], { readonly kind: "todo_list" }>;
417-
418419
/** The latest todo list while its run works, or after it while the same session has steps left. */
419420
export function presentThreadTodoList(
420421
projection: ThreadStructure,
@@ -446,7 +447,11 @@ export function presentThreadTodoList(
446447
const current =
447448
plan.steps.find((step) => step.status === "running") ??
448449
plan.steps.find((step) => step.status === "pending");
449-
return { title: `Tasks ${done}/${plan.steps.length}`, current: current?.text ?? null };
450+
return {
451+
title: `Tasks ${done}/${plan.steps.length}`,
452+
current: current?.text ?? null,
453+
steps: plan.steps,
454+
};
450455
}
451456

452457
export function notificationChildThreadId(

0 commit comments

Comments
 (0)