Path: blob/master/src/packages/frontend/chat/store.ts
1496 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Store } from "@cocalc/frontend/app-framework";6import type { ChatMessages } from "./types";78export interface ChatState {9project_id?: string;10path?: string;11height: number; // 0 means not rendered; otherwise is the height of the chat editor12message_plain_text: string; // What the user sees in the chat box eg. stripped of internal mention markup13messages?: ChatMessages;14drafts?: Map<string, any>;15offset?: number; // information about where on screen the chat editor is located16position?: number; // more info about where chat editor is located17saved_position?: number;18search: string;19add_collab: boolean;20}2122export function getInitialState() {23return {24height: 0,25message_plain_text: "",26messages: undefined,27drafts: undefined,28offset: undefined,29position: undefined,30saved_position: undefined,31search: "",32add_collab: false,33};34}3536export class ChatStore extends Store<ChatState> {37getInitialState = () => getInitialState();38}394041