Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions apps/web/src/components/chat/MessagesTimeline.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,23 @@ function buildUserTimelineEntry(text: string) {
};
}

function buildAssistantTimelineEntry(text: string) {
return {
id: "entry-2",
kind: "message" as const,
createdAt: MESSAGE_CREATED_AT,
message: {
id: MessageId.make("message-2"),
role: "assistant" as const,
text,
turnId: null,
createdAt: MESSAGE_CREATED_AT,
updatedAt: MESSAGE_CREATED_AT,
streaming: false,
},
};
}

describe("MessagesTimeline", () => {
it("uses LegendList isNearEnd when deciding whether the live edge is visible", async () => {
const {
Expand Down Expand Up @@ -407,6 +424,22 @@ describe("MessagesTimeline", () => {
expect(markup).toContain('data-user-message-footer="true"');
});

it("keeps message actions visible when their row is not hovered", async () => {
const { MessagesTimeline } = await import("./MessagesTimeline");
const markup = renderToStaticMarkup(
<MessagesTimeline
{...buildProps()}
timelineEntries={[
buildUserTimelineEntry("Please check this."),
buildAssistantTimelineEntry("Done."),
]}
/>,
);

expect(markup.match(/opacity-60 transition-opacity duration-200/g)).toHaveLength(2);
expect(markup).not.toContain("tabular-nums opacity-0 transition-opacity duration-200");
});

it("renders context compaction entries in the normal work log", async () => {
const { MessagesTimeline } = await import("./MessagesTimeline");
const markup = renderToStaticMarkup(
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/chat/MessagesTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
markdownCwd={ctx.markdownCwd}
/>
</div>
<div className="flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-0 transition-opacity duration-200 focus-within:opacity-100 group-hover:opacity-100">
<div className="flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-60 transition-opacity duration-200 focus-within:opacity-100 group-hover:opacity-100">
<div className="flex shrink-0 items-center gap-2">
<Tooltip>
<TooltipTrigger render={<p className="text-muted-foreground text-xs tabular-nums" />}>
Expand Down Expand Up @@ -995,7 +995,7 @@ function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "mess
onOpenTurnDiff={ctx.onOpenTurnDiff}
/>
{row.showAssistantMeta ? (
<div className="mt-1.5 flex items-center gap-2 text-xs tabular-nums opacity-0 transition-opacity duration-200 focus-within:opacity-100 group-hover/assistant:opacity-100">
<div className="mt-1.5 flex items-center gap-2 text-xs tabular-nums opacity-60 transition-opacity duration-200 focus-within:opacity-100 group-hover/assistant:opacity-100">
<AssistantCopyButton row={row} />
{!row.message.streaming && (
<Tooltip>
Expand Down
Loading