From 2af977f947c9f3c9964e0d0fe1b8f371392cfbf1 Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 2 Feb 2026 16:17:01 +0000 Subject: [PATCH] fix(ui): add core state and logic for scroll control --- ui/src/ui/app-view-state.ts | 2 ++ ui/src/ui/app.ts | 9 ++++++++- ui/src/ui/icons.ts | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ui/src/ui/app-view-state.ts b/ui/src/ui/app-view-state.ts index 9e8d44a0a4..494644d31a 100644 --- a/ui/src/ui/app-view-state.ts +++ b/ui/src/ui/app-view-state.ts @@ -56,6 +56,8 @@ export type AppViewState = { chatQueue: ChatQueueItem[]; nodesLoading: boolean; nodes: Array>; + chatNewMessagesBelow: boolean; + scrollToBottom: () => void; devicesLoading: boolean; devicesError: string | null; devicesList: DevicePairingList | null; diff --git a/ui/src/ui/app.ts b/ui/src/ui/app.ts index 001b5bdd77..8a81b21dff 100644 --- a/ui/src/ui/app.ts +++ b/ui/src/ui/app.ts @@ -1,6 +1,7 @@ import { LitElement } from "lit"; import { customElement, state } from "lit/decorators.js"; import type { EventLogEntry } from "./app-events"; +import type { AppViewState } from "./app-view-state"; import type { DevicePairingList } from "./controllers/devices"; import type { ExecApprovalRequest } from "./controllers/exec-approval"; import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "./controllers/exec-approvals"; @@ -57,6 +58,7 @@ import { handleChatScroll as handleChatScrollInternal, handleLogsScroll as handleLogsScrollInternal, resetChatScroll as resetChatScrollInternal, + scheduleChatScroll as scheduleChatScrollInternal, } from "./app-scroll"; import { applySettings as applySettingsInternal, @@ -319,6 +321,11 @@ export class OpenClawApp extends LitElement { resetChatScrollInternal(this as unknown as Parameters[0]); } + scrollToBottom() { + resetChatScrollInternal(this as unknown as Parameters[0]); + scheduleChatScrollInternal(this as unknown as Parameters[0], true); + } + async loadAssistantIdentity() { await loadAssistantIdentityInternal(this); } @@ -480,6 +487,6 @@ export class OpenClawApp extends LitElement { } render() { - return renderApp(this); + return renderApp(this as unknown as AppViewState); } } diff --git a/ui/src/ui/icons.ts b/ui/src/ui/icons.ts index 9b6ac275b3..1682dcfa9d 100644 --- a/ui/src/ui/icons.ts +++ b/ui/src/ui/icons.ts @@ -106,6 +106,12 @@ export const icons = { check: html` `, + arrowDown: html` + + + + + `, copy: html`