Skip to content
Merged
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
13 changes: 6 additions & 7 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3602,13 +3602,12 @@ export default function ChatView(props: ChatViewProps) {
/>
</WorkspaceMutationIdContext>

{showScrollToBottom && !isThreadFindActive && (
<ScrollToEndButton
bottom={scrollToEndClearance + 4}
summary={scrollToEndSummary}
onScrollToEnd={() => scrollToEnd(true)}
/>
)}
<ScrollToEndButton
visible={showScrollToBottom && !isThreadFindActive}
bottom={scrollToEndClearance + 4}
summary={scrollToEndSummary}
onScrollToEnd={() => scrollToEnd(true)}
/>
</div>

{/* Input bar — docked at the bottom; an empty draft centers its headline above it. */}
Expand Down
43 changes: 18 additions & 25 deletions apps/web/src/components/chat/MessagesTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ import {
MessageSquareIcon,
MessagesSquareIcon,
} from "lucide-react";
import { ChevronDown, ChevronRight } from "lucide";
import { MorphIcon } from "~/components/MorphIcon";
import { Skeleton } from "../ui/skeleton";
import { ExpandedImagePreview } from "./ExpandedImagePreview";
import {
Expand Down Expand Up @@ -676,8 +674,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
});
const onToggleWorkGroup = useStableCallback((groupId: string, anchorKey: string) => {
preserveDisclosurePosition(anchorKey);
const wakeUps = rows.find((row) => row.kind === "background-activity" && row.id === groupId);
if (wakeUps?.kind === "background-activity") revealFoldRows(!wakeUps.expanded);
revealFoldRows(!expandedWorkGroupIds.has(groupId));
setExpandedWorkGroupIds((existing) => {
const next = new Set(existing);
if (next.has(groupId)) {
Expand Down Expand Up @@ -1641,8 +1638,8 @@ const TimelineRowContent = memo(function TimelineRowContent({ row }: { row: Time
row.kind === "work-toggle" ||
row.kind === "thinking";
const isExpandedToolGroupHeader =
(row.kind === "work-toggle" || row.kind === "work-live" || row.kind === "thinking") &&
row.expanded === true;
row.kind === "work-toggle" ||
((row.kind === "work-live" || row.kind === "thinking") && row.expanded === true);

return (
<div
Expand Down Expand Up @@ -1934,25 +1931,21 @@ function AttemptFoldTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "at

return (
<div>
<button
type="button"
aria-expanded={row.expanded}
data-scroll-anchor-ignore
data-superseded-attempt-id={row.attemptId}
onClick={toggle}
aria-busy={loading}
className="flex w-full cursor-pointer select-none items-center gap-2 rounded-card border border-transparent surface-card px-2.5 py-2 text-left transition-colors hover:surface-ghost-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70"
>
<MorphIcon
className="size-3.5 shrink-0 text-muted-foreground"
icon={row.expanded ? ChevronDown : ChevronRight}
/>
<span className="text-xs font-medium text-foreground">
{row.label}
{error ? <span className="block text-error-foreground">{error}</span> : null}
</span>
<span className="text-2xs text-muted-foreground">Cut off by a steer</span>
</button>
<div className={WORKING_BAR_CLASS_NAME}>
<WorkFoldToggle
togglable
expanded={row.expanded}
data-superseded-attempt-id={row.attemptId}
onClick={toggle}
aria-busy={loading}
>
<span>
{row.label}
{error ? <span className="block text-error-foreground">{error}</span> : null}
</span>
</WorkFoldToggle>
<span className="text-meta text-muted-foreground">Cut off by a steer</span>
</div>
{loading ? <WorkHistorySkeleton /> : null}
</div>
);
Expand Down
56 changes: 30 additions & 26 deletions apps/web/src/components/chat/TimelineOverlays.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,45 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
* what waits at the end of the timeline, which is out of view while it shows.
*/
export function ScrollToEndButton(props: {
readonly visible: boolean;
readonly bottom: number;
readonly summary: ReadonlyArray<string>;
readonly onScrollToEnd: () => void;
}) {
const button = (
<Button
data-scroll-to-end="true"
onPointerDown={(event) => event.preventDefault()}
onClick={props.onScrollToEnd}
className="pointer-events-auto"
size="xs"
variant="floating"
>
<ChevronDownIcon className="size-3.5" />
Scroll to end
</Button>
);
return (
<div
className="chat-scroll-to-bottom pointer-events-none absolute z-30 flex justify-center py-1.5"
data-visible={props.visible}
inert={!props.visible}
style={{ bottom: props.bottom }}
>
<Tooltip>
<TooltipTrigger
render={
<Button
data-scroll-to-end="true"
onPointerDown={(event) => event.preventDefault()}
onClick={props.onScrollToEnd}
className="pointer-events-auto"
size="xs"
variant="floating"
/>
}
>
<ChevronDownIcon className="size-3.5" />
Scroll to end
</TooltipTrigger>
<TooltipPopup>
{props.summary.length
? props.summary.map((part) => (
<span className="block" key={part}>
{part}
</span>
))
: "Scroll to end"}
</TooltipPopup>
</Tooltip>
{props.summary.length > 0 ? (
<Tooltip>
<TooltipTrigger render={button} />
<TooltipPopup>
{props.summary.map((part) => (
<span className="block" key={part}>
{part}
</span>
))}
</TooltipPopup>
</Tooltip>
) : (
button
)}
</div>
);
}
41 changes: 23 additions & 18 deletions apps/web/src/components/chat/TimelineWorkGroupRows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ function WorkingTimer({ createdAt, clock = false }: { createdAt: string; clock?:
}

const compactWorkEntryHeight = 24;
const expandedWorkEntryHeight = 28;

function ExpandedWorkGroupEntries({
anchorKey,
Expand Down Expand Up @@ -259,7 +260,9 @@ function ExpandedWorkGroupEntries({
}, [updateScrollFades]);

const renderEntry = ({ item }: { item: TimelineWorkEntry }) => (
<SimpleWorkEntryRow key={item.id} workEntry={item} workspaceRoot={workspaceRoot} />
<div className="min-h-7">
<SimpleWorkEntryRow key={item.id} workEntry={item} workspaceRoot={workspaceRoot} />
</div>
);

const updateExpandedContentHeight = () => {
Expand All @@ -269,7 +272,7 @@ function ExpandedWorkGroupEntries({
if (state?.indexByKey(entryId) === undefined) continue;
height += Math.max(
0,
(state.sizes.get(entryId) ?? compactWorkEntryHeight) - compactWorkEntryHeight,
(state.sizes.get(entryId) ?? expandedWorkEntryHeight) - expandedWorkEntryHeight,
);
}
setExpandedContentHeight(height);
Expand All @@ -287,7 +290,7 @@ function ExpandedWorkGroupEntries({
extraData={workspaceRoot}
keyExtractor={workEntryKey}
renderItem={renderEntry}
estimatedItemSize={compactWorkEntryHeight}
estimatedItemSize={expandedWorkEntryHeight}
drawDistance={240}
recycleItems
{...(initialScrollIndex ? { initialScrollIndex } : {})}
Expand Down Expand Up @@ -700,20 +703,22 @@ function WorkGroupHeader(props: {
onToggle: () => void;
}) {
return (
<WorkLogButton
aria-label={props.failed ? `${props.label}, tool call failed` : props.label}
aria-expanded={props.expanded}
onClick={props.onToggle}
icon={
<ToolActivityIconView
icon={props.toolIcon}
fallbackName={props.iconName}
className="size-3.5 shrink-0 stroke-2 text-muted-foreground"
muted
/>
}
label={<span className="block truncate text-secondary-label">{props.label}</span>}
/>
<div className="pb-2">
<WorkLogButton
aria-label={props.failed ? `${props.label}, tool call failed` : props.label}
aria-expanded={props.expanded}
onClick={props.onToggle}
icon={
<ToolActivityIconView
icon={props.toolIcon}
fallbackName={props.iconName}
className="size-3.5 shrink-0 stroke-2 text-muted-foreground"
muted
/>
}
label={<span className="block truncate text-secondary-label">{props.label}</span>}
/>
</div>
);
}

Expand Down Expand Up @@ -827,7 +832,7 @@ function WorkingWindowText({
const textRef = useCarriedTextFade(item.message.id);
if (text.trim().length === 0) return null;
return (
<div ref={textRef} className="min-w-0 py-2">
<div ref={textRef} className="min-w-0 px-1 py-2">
<AssistantCitationSource
messageId={item.message.id}
{...(ctx.threadRef ? { threadRef: ctx.threadRef } : {})}
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/chat/V2ItemInspector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@ export const V2ItemInspector = memo(function V2ItemInspector(props: V2ItemInspec
{item.type === "file_change" ? (
<div className="space-y-2">
<div className="flex flex-wrap items-center gap-2">
<span className="font-mono text-dim-foreground">
{formatWorkspaceRelativePath(item.fileName, props.workspaceRoot)}
</span>
{item.additions !== undefined || item.deletions !== undefined ? (
<span>
<span className="text-diff-addition-foreground">
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/WorkLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function WorkLogBlock({
}

export function WorkLogList({ children }: { children: ReactNode }) {
return <div className="flex min-w-0 flex-col gap-1">{children}</div>;
return <div className="flex min-w-0 flex-col gap-1 ps-4">{children}</div>;
}

type RowContent = {
Expand Down
13 changes: 6 additions & 7 deletions apps/web/src/components/guest/GuestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,12 @@ function GuestThread({
}
/>
</HostImageUrlContext>
{follow.showScrollToBottom ? (
<ScrollToEndButton
summary={[]}
bottom={4}
onScrollToEnd={() => follow.scrollToEnd(true)}
/>
) : null}
<ScrollToEndButton
visible={follow.showScrollToBottom}
summary={[]}
bottom={4}
onScrollToEnd={() => follow.scrollToEnd(true)}
/>
</div>
<div className={cn(LANE, "shrink-0 pb-4")}>
<GuestComposer shareId={shareId} model={model} onSent={() => follow.scrollToEnd(true)} />
Expand Down
24 changes: 24 additions & 0 deletions apps/web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5958,3 +5958,27 @@ body {
[data-layout-strip] [data-layout-pane-id] :is(pre, .overflow-x-auto, .overflow-x-scroll) {
overscroll-behavior-x: contain;
}

.chat-scroll-to-bottom {
opacity: 1;
transition:
opacity 150ms ease-out,
display 150ms allow-discrete;
}

.chat-scroll-to-bottom[data-visible="false"] {
display: none;
opacity: 0;
}

@starting-style {
.chat-scroll-to-bottom {
opacity: 0;
}
}

@media (prefers-reduced-motion: reduce) {
.chat-scroll-to-bottom {
transition: none;
}
}
Loading