fix(ui): add core state and logic for scroll control

This commit is contained in:
Shakker
2026-02-02 16:17:01 +00:00
parent 822388fe92
commit 2af977f947
3 changed files with 16 additions and 1 deletions

View File

@@ -56,6 +56,8 @@ export type AppViewState = {
chatQueue: ChatQueueItem[];
nodesLoading: boolean;
nodes: Array<Record<string, unknown>>;
chatNewMessagesBelow: boolean;
scrollToBottom: () => void;
devicesLoading: boolean;
devicesError: string | null;
devicesList: DevicePairingList | null;

View File

@@ -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<typeof resetChatScrollInternal>[0]);
}
scrollToBottom() {
resetChatScrollInternal(this as unknown as Parameters<typeof resetChatScrollInternal>[0]);
scheduleChatScrollInternal(this as unknown as Parameters<typeof scheduleChatScrollInternal>[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);
}
}

View File

@@ -106,6 +106,12 @@ export const icons = {
check: html`
<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg>
`,
arrowDown: html`
<svg viewBox="0 0 24 24">
<path d="M12 5v14" />
<path d="m19 12-7 7-7-7" />
</svg>
`,
copy: html`
<svg viewBox="0 0 24 24">
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />