30 lines
1.9 KiB
TypeScript
30 lines
1.9 KiB
TypeScript
import { render } from "preact";
|
|
import { useMemo } from "preact/hooks";
|
|
import type { Message } from "../src/lib/api";
|
|
import type { AgentRoomHookResult } from "../src/hooks/use-agent-room";
|
|
import { AgentConversation } from "../src/components/agent/agent-conversation";
|
|
import "../src/index.css";
|
|
|
|
const createdAt = "2026-11-08T12:00:00.000Z";
|
|
const paragraph = "Synthetic transcript content for composer resize and scroll anchoring. ".repeat(5);
|
|
function message(index: number, content: string): Message {
|
|
return { id: `layout-${index}`, createdAt: new Date(Date.parse(createdAt) + index * 1000).toISOString(),
|
|
role: index % 2 ? "assistant" : "user", content, name: null, metadata: { kind: "message", status: "complete" } };
|
|
}
|
|
|
|
function Fixture() {
|
|
const history = useMemo(() => Array.from({ length: 24 }, (_, i) => message(i, `${paragraph}${paragraph}`)), []);
|
|
const messages = [...history, message(24, `${paragraph}${paragraph}`)];
|
|
const uploadQueue = { snapshot: () => [], add: () => undefined, remove: () => undefined, ready: () => [],
|
|
reselect: async () => undefined, retry: () => undefined, clear: () => undefined };
|
|
const room = { messages, activity: null, unreadCount: 0, connection: "connected", error: null, isLoading: false,
|
|
isLoadingOlder: false, olderError: null, hasOlder: false, historyBeforeCursor: null, attachmentCapability: undefined,
|
|
uploadQueue, uploadAttachment: async () => { throw new Error("not used"); }, downloadAttachment: async () => new Blob(),
|
|
isTyping: false, sendMessage: async () => ({ status: "queued" }), retryMessage: async () => undefined,
|
|
markRead: () => undefined, retry: () => undefined, loadOlder: () => undefined, unreadCountIsPartial: false,
|
|
} as unknown as AgentRoomHookResult;
|
|
return <AgentConversation room={room} onOpenSidebar={() => undefined} />;
|
|
}
|
|
|
|
render(<Fixture />, document.getElementById("root")!);
|