Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/chat/side-chat.tsx
5827 views
1
import { CSS } from "@cocalc/frontend/app-framework";
2
import { useActions, useRedux } from "@cocalc/frontend/app-framework";
3
import { Loading } from "@cocalc/frontend/components";
4
import type { ChatActions } from "./actions";
5
import { ChatPanel } from "./chatroom";
6
import type { ChatMessages } from "./types";
7
8
interface Props {
9
project_id: string;
10
path: string;
11
style?: CSS;
12
fontSize?: number;
13
actions?: ChatActions;
14
desc?;
15
}
16
17
export default function SideChat({
18
actions: actions0,
19
project_id,
20
path,
21
style,
22
fontSize,
23
desc,
24
}: Props) {
25
const actionsViaContext = useActions(project_id, path);
26
const actions: ChatActions = actions0 ?? actionsViaContext;
27
const messages = useRedux(["messages"], project_id, path) as
28
| ChatMessages
29
| undefined;
30
31
if (messages == null) {
32
return <Loading theme="medium" />;
33
}
34
35
return (
36
<div
37
style={{
38
height: "100%",
39
width: "100%",
40
display: "flex",
41
flexDirection: "column",
42
backgroundColor: "#efefef",
43
...style,
44
}}
45
>
46
<ChatPanel
47
actions={actions}
48
project_id={project_id}
49
path={path}
50
messages={messages}
51
fontSize={fontSize}
52
desc={desc}
53
variant="compact"
54
disableFilters
55
/>
56
</div>
57
);
58
}
59
60