import { Store } from "@cocalc/frontend/app-framework";
import type { ChatMessages } from "./types";
export interface ChatState {
project_id?: string;
path?: string;
height: number;
message_plain_text: string;
messages?: ChatMessages;
drafts?: Map<string, any>;
offset?: number;
position?: number;
saved_position?: number;
search: string;
add_collab: boolean;
}
export function getInitialState() {
return {
height: 0,
message_plain_text: "",
messages: undefined,
drafts: undefined,
offset: undefined,
position: undefined,
saved_position: undefined,
search: "",
add_collab: false,
};
}
export class ChatStore extends Store<ChatState> {
getInitialState = () => getInitialState();
}