Skip to content

Commit ebc618b

Browse files
committed
Merge branch 'master' into fs2
2 parents adbb4eb + 654505e commit ebc618b

File tree

4 files changed

+79
-30
lines changed

4 files changed

+79
-30
lines changed

src/packages/frontend/chat/chatroom.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,15 @@ export function ChatRoom({
356356
defaultMessage={"Preview"}
357357
/>
358358
</Button>
359+
<div style={{ height: "5px" }} />
360+
<Button
361+
style={{ height: "47.5px" }}
362+
onClick={() => {
363+
actions?.frameTreeActions?.getVideoChat().startChatting();
364+
}}
365+
>
366+
<Icon name="video-camera" /> Video
367+
</Button>
359368
</div>
360369
</div>
361370
</div>

src/packages/frontend/chat/message.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
// cSpell:ignore blankcolumn
77

8-
import { Badge, Button, Col, Popconfirm, Row, Space } from "antd";
8+
import { Badge, Button, Col, Popconfirm, Row, Space, Tooltip } from "antd";
99
import { List, Map } from "immutable";
1010
import { CSSProperties, useEffect, useLayoutEffect } from "react";
1111
import { useIntl } from "react-intl";
12-
1312
import { Avatar } from "@cocalc/frontend/account/avatar/avatar";
1413
import {
1514
CSS,
@@ -831,14 +830,16 @@ export default function Message({
831830
>
832831
<CancelText />
833832
</Button>
834-
<Button
835-
onClick={() => {
836-
sendReply();
837-
}}
838-
type="primary"
839-
>
840-
<Icon name="reply" /> Reply (shift+enter)
841-
</Button>
833+
<Tooltip title="Send Reply (shift+enter)">
834+
<Button
835+
onClick={() => {
836+
sendReply();
837+
}}
838+
type="primary"
839+
>
840+
<Icon name="reply" /> Reply
841+
</Button>
842+
</Tooltip>
842843
{costEstimate?.get("date") == replyDate && (
843844
<LLMCostEstimationChat
844845
costEstimate={costEstimate?.toJS()}

src/packages/frontend/chat/side-chat.tsx

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -167,41 +167,68 @@ export default function SideChat({
167167

168168
<div>
169169
{input.trim() ? (
170-
<Flex vertical={false} align="center" justify="space-between">
171-
<Tooltip title="Send message (shift+enter)">
172-
<Space>
173-
{lastVisible && (
170+
<Flex
171+
vertical={false}
172+
align="center"
173+
justify="space-between"
174+
style={{ margin: "5px" }}
175+
>
176+
<Space>
177+
{lastVisible && (
178+
<Tooltip title="Reply to the current thread (shift+enter)">
174179
<Button
175-
disabled={!input.trim()}
180+
disabled={!input.trim() || actions == null}
176181
type="primary"
177182
onClick={() => {
178183
sendChat({ reply_to: new Date(lastVisible) });
179184
}}
180185
>
181-
<Icon name="reply" /> Reply (shift+enter)
186+
<Icon name="reply" /> Reply
182187
</Button>
183-
)}
188+
</Tooltip>
189+
)}
190+
<Tooltip
191+
title={
192+
lastVisible
193+
? "Start a new thread"
194+
: "Start a new thread (shift+enter)"
195+
}
196+
>
184197
<Button
185198
type={!lastVisible ? "primary" : undefined}
186-
style={{ margin: "5px 0 5px 5px" }}
199+
style={{ marginLeft: "5px" }}
187200
onClick={() => {
188201
sendChat();
189202
user_activity("side_chat", "send_chat", "click");
190203
}}
191-
disabled={!input?.trim()}
204+
disabled={!input?.trim() || actions == null}
192205
>
193206
<Icon name="paper-plane" />
194-
Start New Thread
207+
New Thread
195208
</Button>
196-
</Space>
197-
</Tooltip>
198-
{costEstimate?.get("date") == 0 && (
199-
<LLMCostEstimationChat
200-
compact
201-
costEstimate={costEstimate?.toJS()}
202-
style={{ margin: "5px" }}
203-
/>
204-
)}
209+
</Tooltip>
210+
</Space>
211+
<div style={{ flex: 1 }} />
212+
<Space>
213+
<Tooltip title={"Launch video chat specific to this document"}>
214+
<Button
215+
disabled={actions == null}
216+
onClick={() => {
217+
actions?.frameTreeActions?.getVideoChat().startChatting();
218+
}}
219+
>
220+
<Icon name="video-camera" />
221+
Video
222+
</Button>
223+
</Tooltip>
224+
{costEstimate?.get("date") == 0 && (
225+
<LLMCostEstimationChat
226+
compact
227+
costEstimate={costEstimate?.toJS()}
228+
style={{ margin: "5px" }}
229+
/>
230+
)}
231+
</Space>
205232
</Flex>
206233
) : undefined}
207234
<ChatInput

src/packages/frontend/chat/video/video-chat.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { webapp_client } from "@cocalc/frontend/webapp-client";
33
import { len, trunc_middle } from "@cocalc/util/misc";
44
import { redux } from "@cocalc/frontend/app-framework";
55
import { open_new_tab } from "../../misc/open-browser-tab";
6+
import { getSideChatActions } from "@cocalc/frontend/frame-editors/generic/chat";
67

78
const VIDEO_CHAT_SERVER = "https://meet.jit.si";
89
const VIDEO_UPDATE_INTERVAL_MS = 30 * 1000;
@@ -83,8 +84,19 @@ export class VideoChat {
8384
};
8485

8586
startChatting = () => {
86-
redux.getActions("file_use")?.mark_file(this.project_id, this.path, "chat");
8787
this.openVideoChatWindow();
88+
redux.getActions("file_use")?.mark_file(this.project_id, this.path, "chat");
89+
const sideChatActions =
90+
getSideChatActions({
91+
project_id: this.project_id,
92+
path: this.path,
93+
}) ??
94+
redux.getEditorActions(this.project_id, this.path)?.getChatActions();
95+
sideChatActions?.sendChat({
96+
input: `[${this.getUserName()} joined Video Chat](${this.url()})`,
97+
});
98+
setTimeout(() => sideChatActions?.scrollToBottom(), 100);
99+
setTimeout(() => sideChatActions?.scrollToBottom(), 1000);
88100
};
89101

90102
// The canonical secret chatroom id.

0 commit comments

Comments
 (0)