Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(web): show the jump-to-latest button in the Thread panel

jeffreyd01adca135d0
diff --git a/apps/web/src/features/rooms/chat/thread-panel.tsx b/apps/web/src/features/rooms/chat/thread-panel.tsx
index 667b5120..7e88fea4 100644
--- a/apps/web/src/features/rooms/chat/thread-panel.tsx
+++ b/apps/web/src/features/rooms/chat/thread-panel.tsx
@@ -13,6 +13,7 @@ import {
useSyncExternalStore,
} from "react";
+import { isRunWorking } from "@/features/teamhub/run-status";
import { teamHubData } from "@/features/teamhub/teamhub-api";
import { type TeamHubClient } from "@/features/teamhub/teamhub-client";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
@@ -325,6 +326,7 @@ function ThreadPanelContent({
Thread
</h2>
<ThreadTimeline
+ agentWorking={conversation.streamingRunStatuses.some(isRunWorking)}
canLoadEarlier={messagesQuery.hasNextPage}
hasPending={conversation.pendingMessages.length > 0}
loadingEarlier={messagesQuery.isFetchingNextPage}
diff --git a/apps/web/src/features/rooms/chat/thread-timeline.tsx b/apps/web/src/features/rooms/chat/thread-timeline.tsx
index c709898e..fd385758 100644
--- a/apps/web/src/features/rooms/chat/thread-timeline.tsx
+++ b/apps/web/src/features/rooms/chat/thread-timeline.tsx
@@ -8,11 +8,13 @@ import {
isRoomNotice,
messageStartsConversation,
} from "./message-grouping";
+import { JumpToLatestButton } from "./jump-to-latest-button";
import type { useRoomTimelineScroll } from "./use-room-timeline-scroll";
/** The Thread's root Message, then its replies in conversation groups, with
* pending replies passed as children. */
export function ThreadTimeline({
+ agentWorking,
canLoadEarlier,
children,
hasPending,
@@ -24,6 +26,7 @@ export function ThreadTimeline({
rootMessage,
timeline,
}: PropsWithChildren<{
+ agentWorking: boolean;
canLoadEarlier: boolean;
hasPending: boolean;
loadingEarlier: boolean;
@@ -39,65 +42,73 @@ export function ThreadTimeline({
timeline: ReturnType<typeof useRoomTimelineScroll>;
}>) {
return (
- <div
- aria-busy={opening || undefined}
- aria-label="Thread timeline"
- data-voice-scroll="thread"
- className="workspace-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pt-3 pb-10 [overflow-anchor:none]"
- data-initial-scroll-ready={timeline.initialScrollReady}
- data-thread-loading={opening || undefined}
- onScroll={(event) => timeline.recordTimelineScroll(event.currentTarget)}
- ref={timeline.timelineRef}
- >
- <ConversationTime at={rootMessage.created_at} />
- {renderMessage(rootMessage, true, false)}
- {opening ? (
- <div className="mt-4 space-y-3" data-testid="thread-panel-loading">
- <p className="text-[12px] font-medium text-app-muted">
- Opening Thread…
- </p>
- <div className="h-16 animate-pulse rounded-lg bg-app-hover" />
- <div className="h-16 animate-pulse rounded-lg bg-app-hover" />
+ <div className="relative flex min-h-0 flex-1 flex-col">
+ <div
+ aria-busy={opening || undefined}
+ aria-label="Thread timeline"
+ data-voice-scroll="thread"
+ className="workspace-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pt-3 pb-10 [overflow-anchor:none]"
+ data-initial-scroll-ready={timeline.initialScrollReady}
+ data-thread-loading={opening || undefined}
+ onScroll={(event) => timeline.recordTimelineScroll(event.currentTarget)}
+ ref={timeline.timelineRef}
+ >
+ <ConversationTime at={rootMessage.created_at} />
+ {renderMessage(rootMessage, true, false)}
+ {opening ? (
+ <div className="mt-4 space-y-3" data-testid="thread-panel-loading">
+ <p className="text-[12px] font-medium text-app-muted">
+ Opening Thread…
+ </p>
+ <div className="h-16 animate-pulse rounded-lg bg-app-hover" />
+ <div className="h-16 animate-pulse rounded-lg bg-app-hover" />
+ </div>
+ ) : null}
+ {replies.length || hasPending ? (
+ <div className="my-4 flex items-center gap-2 text-[12px] text-app-subtle">
+ <span className="h-px flex-1 bg-app-border" />
+ Replies
+ <span className="h-px flex-1 bg-app-border" />
+ </div>
+ ) : null}
+ {canLoadEarlier ? (
+ <div className="mb-3 text-center">
+ <Button loading={loadingEarlier} onClick={onLoadEarlier}>
+ Load earlier replies
+ </Button>
+ </div>
+ ) : null}
+ <div className="space-y-1">
+ {replies.map((message, index) => {
+ const previous = replies[index - 1];
+ const startsConversation = messageStartsConversation(
+ message,
+ previous,
+ );
+ return (
+ <Fragment key={message.id}>
+ {startsConversation ? (
+ <ConversationTime at={message.created_at} />
+ ) : null}
+ {renderMessage(
+ message,
+ startsConversation ||
+ previous?.author.id !== message.author.id ||
+ isRoomNotice(previous),
+ true,
+ )}
+ </Fragment>
+ );
+ })}
+ {children}
</div>
- ) : null}
- {replies.length || hasPending ? (
- <div className="my-4 flex items-center gap-2 text-[12px] text-app-subtle">
- <span className="h-px flex-1 bg-app-border" />
- Replies
- <span className="h-px flex-1 bg-app-border" />
- </div>
- ) : null}
- {canLoadEarlier ? (
- <div className="mb-3 text-center">
- <Button loading={loadingEarlier} onClick={onLoadEarlier}>
- Load earlier replies
- </Button>
- </div>
- ) : null}
- <div className="space-y-1">
- {replies.map((message, index) => {
- const previous = replies[index - 1];
- const startsConversation = messageStartsConversation(
- message,
- previous,
- );
- return (
- <Fragment key={message.id}>
- {startsConversation ? (
- <ConversationTime at={message.created_at} />
- ) : null}
- {renderMessage(
- message,
- startsConversation ||
- previous?.author.id !== message.author.id ||
- isRoomNotice(previous),
- true,
- )}
- </Fragment>
- );
- })}
- {children}
</div>
+ {timeline.awayFromLatest ? (
+ <JumpToLatestButton
+ agentWorking={agentWorking}
+ onClick={timeline.scrollToLatest}
+ />
+ ) : null}
</div>
);
}