fix(ui): add core state and logic for scroll control
parent
822388fe92
commit
2af977f947
|
|
@ -56,6 +56,8 @@ export type AppViewState = {
|
||||||
chatQueue: ChatQueueItem[];
|
chatQueue: ChatQueueItem[];
|
||||||
nodesLoading: boolean;
|
nodesLoading: boolean;
|
||||||
nodes: Array<Record<string, unknown>>;
|
nodes: Array<Record<string, unknown>>;
|
||||||
|
chatNewMessagesBelow: boolean;
|
||||||
|
scrollToBottom: () => void;
|
||||||
devicesLoading: boolean;
|
devicesLoading: boolean;
|
||||||
devicesError: string | null;
|
devicesError: string | null;
|
||||||
devicesList: DevicePairingList | null;
|
devicesList: DevicePairingList | null;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { LitElement } from "lit";
|
import { LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators.js";
|
import { customElement, state } from "lit/decorators.js";
|
||||||
import type { EventLogEntry } from "./app-events";
|
import type { EventLogEntry } from "./app-events";
|
||||||
|
import type { AppViewState } from "./app-view-state";
|
||||||
import type { DevicePairingList } from "./controllers/devices";
|
import type { DevicePairingList } from "./controllers/devices";
|
||||||
import type { ExecApprovalRequest } from "./controllers/exec-approval";
|
import type { ExecApprovalRequest } from "./controllers/exec-approval";
|
||||||
import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "./controllers/exec-approvals";
|
import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "./controllers/exec-approvals";
|
||||||
|
|
@ -57,6 +58,7 @@ import {
|
||||||
handleChatScroll as handleChatScrollInternal,
|
handleChatScroll as handleChatScrollInternal,
|
||||||
handleLogsScroll as handleLogsScrollInternal,
|
handleLogsScroll as handleLogsScrollInternal,
|
||||||
resetChatScroll as resetChatScrollInternal,
|
resetChatScroll as resetChatScrollInternal,
|
||||||
|
scheduleChatScroll as scheduleChatScrollInternal,
|
||||||
} from "./app-scroll";
|
} from "./app-scroll";
|
||||||
import {
|
import {
|
||||||
applySettings as applySettingsInternal,
|
applySettings as applySettingsInternal,
|
||||||
|
|
@ -319,6 +321,11 @@ export class OpenClawApp extends LitElement {
|
||||||
resetChatScrollInternal(this as unknown as Parameters<typeof resetChatScrollInternal>[0]);
|
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() {
|
async loadAssistantIdentity() {
|
||||||
await loadAssistantIdentityInternal(this);
|
await loadAssistantIdentityInternal(this);
|
||||||
}
|
}
|
||||||
|
|
@ -480,6 +487,6 @@ export class OpenClawApp extends LitElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return renderApp(this);
|
return renderApp(this as unknown as AppViewState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,12 @@ export const icons = {
|
||||||
check: html`
|
check: html`
|
||||||
<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg>
|
<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`
|
copy: html`
|
||||||
<svg viewBox="0 0 24 24">
|
<svg viewBox="0 0 24 24">
|
||||||
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue