Skip to content

Commit e2ce835

Browse files
refactor(ui): shorten transcript helper names
1 parent 24a42f4 commit e2ce835

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

‎ui/src/pages/chat/components/chat-transcript-controller.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ import {
2828
resolveChatTranscriptInteractionRow,
2929
} from "./chat-transcript-interaction-anchor.ts";
3030
import { extractTranscriptRange, previewTranscriptRowKeys } from "./chat-transcript-range.ts";
31-
import {
32-
initialChatTranscriptScrollMargin,
33-
syncChatTranscriptScrollMargin,
34-
} from "./chat-transcript-scroll-margin.ts";
31+
import { initialScrollMargin, syncScrollMargin } from "./chat-transcript-scroll-margin.ts";
3532

3633
export type TranscriptRow<T = unknown> =
3734
| { kind: "item"; key: string; item: T }
@@ -240,7 +237,7 @@ class ChatSessionVirtualizerHost implements ReactiveControllerHost, ChatTranscri
240237
getItemKey: () => "",
241238
initialRect: initialTranscriptRect(host),
242239
initialOffset: initialOffset ?? Number.MAX_SAFE_INTEGER,
243-
scrollMargin: initialChatTranscriptScrollMargin(host),
240+
scrollMargin: initialScrollMargin(host),
244241
anchorTo: "end",
245242
followOnAppend: false,
246243
observeElementRect: (instance, callback) =>
@@ -265,7 +262,7 @@ class ChatSessionVirtualizerHost implements ReactiveControllerHost, ChatTranscri
265262
CHAT_TRANSCRIPT_END_THRESHOLD_PX;
266263
this.observedWidth = rect.width;
267264
this.observedHeight = rect.height;
268-
syncChatTranscriptScrollMargin(instance.scrollElement, instance);
265+
syncScrollMargin(instance.scrollElement, instance);
269266
callback(rect);
270267
if (wasAtEndBeforeResize) {
271268
instance.scrollToEnd({ behavior: "auto" });

‎ui/src/pages/chat/components/chat-transcript-scroll-margin.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ function transcriptScrollMargin(element: Element | null): number {
99
return Number.isFinite(margin) ? margin : 0;
1010
}
1111

12-
export function initialChatTranscriptScrollMargin(host: ReactiveControllerHost): number {
12+
export function initialScrollMargin(host: ReactiveControllerHost): number {
1313
return host instanceof HTMLElement
1414
? transcriptScrollMargin(host.querySelector(".chat-thread"))
1515
: 0;
1616
}
1717

18-
export function syncChatTranscriptScrollMargin(
18+
export function syncScrollMargin(
1919
scrollElement: HTMLDivElement | null,
2020
virtualizer: Virtualizer<HTMLDivElement, HTMLElement>,
2121
): void {

0 commit comments

Comments
 (0)