Skip to content

Commit 295929b

Browse files
committed
chat: adding video chat menu/button support; work in progress
1 parent c6da41c commit 295929b

File tree

7 files changed

+39
-15
lines changed

7 files changed

+39
-15
lines changed

src/packages/frontend/chat/video/launch-button.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Button, Popconfirm, Popover } from "antd";
1+
import { Button, Popover } from "antd";
22
import { debounce } from "lodash";
33
import type { CSSProperties, ReactNode } from "react";
44
import { useInterval } from "react-interval-hook";
@@ -10,7 +10,6 @@ import {
1010
useTypedRedux,
1111
} from "@cocalc/frontend/app-framework";
1212
import { Icon } from "@cocalc/frontend/components";
13-
import { CancelText } from "@cocalc/frontend/i18n/components";
1413
import { user_activity } from "@cocalc/frontend/tracker";
1514
import { VideoChat } from "./video-chat";
1615

@@ -36,7 +35,6 @@ export default function VideoChatButton({
3635
// to know if somebody else has video chat opened for this file
3736
// @ts-ignore
3837
const file_use = useTypedRedux("file_use", "file_use");
39-
const [open, setOpen] = useState<boolean>(false);
4038

4139
// so we can exclude ourselves
4240
const account_id: string = useTypedRedux("account", "account_id");
@@ -125,9 +123,23 @@ export default function VideoChatButton({
125123
</>
126124
);
127125

128-
return (
126+
const btn = (
129127
<Button onClick={click_video_button} style={{ ...style, ...style0 }}>
130128
{body}
131129
</Button>
132130
);
131+
132+
return (
133+
<Popover
134+
mouseEnterDelay={0.8}
135+
title={() => (
136+
<span>
137+
{render_join(num_users_chatting)}
138+
{render_num_chatting(num_users_chatting)}
139+
</span>
140+
)}
141+
>
142+
{btn}
143+
</Popover>
144+
);
133145
}

src/packages/frontend/frame-editors/chat-editor/editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const chatroom: EditorDescription = {
5858
"decrease_font_size",
5959
"increase_font_size",
6060
"scrollToBottom",
61+
"videoChat",
6162
]),
6263
} as const;
6364

src/packages/frontend/frame-editors/code-editor/actions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,4 +3052,8 @@ export class Actions<
30523052
settings = () => {
30533053
this.redux.getActions("page").settings("editor-settings");
30543054
};
3055+
3056+
videoChat = () => {
3057+
console.log("video chat");
3058+
};
30553059
}

src/packages/frontend/frame-editors/frame-tree/commands/button-bar.tsx

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/packages/frontend/frame-editors/frame-tree/commands/generic-commands.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,12 +1085,12 @@ addCommands({
10851085
// we have a side chat menu item... except for in a chatroom or side chat.
10861086
isVisible: ({ props }) =>
10871087
!props.path?.endsWith(".sage-chat") && props.type != "chat",
1088-
pos: 5,
1089-
group: "help-link",
1088+
pos: -1,
1089+
group: "show-frames",
10901090
icon: "comment",
10911091
label: defineMessage({
10921092
id: "command.generic.chat.label",
1093-
defaultMessage: "Side Chat with Collaborators or AI",
1093+
defaultMessage: "Chat with Collaborators or AI",
10941094
description:
10951095
"Opens a chatroom next to the document to chat with other users (collaborators) or an AI chatbot",
10961096
}),
@@ -1106,6 +1106,15 @@ addCommands({
11061106
redux.getProjectActions(props.project_id).open_chat({ path: props.path });
11071107
},
11081108
},
1109+
videoChat: {
1110+
alwaysShow: true,
1111+
pos: 0,
1112+
icon: "video-camera",
1113+
group: "show-frames",
1114+
label: "Video Chat",
1115+
button: "Video",
1116+
title: "Video chat with collaborators on this project",
1117+
},
11091118
support: {
11101119
alwaysShow: true,
11111120
pos: 6,

src/packages/frontend/frame-editors/frame-tree/commands/manage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import type { Command } from "./types";
2424

2525
const MAX_TITLE_WIDTH = 20;
2626
const MAX_SEARCH_RESULTS = 10;
27-
const ICON_WIDTH = "24px";
27+
const ICON_WIDTH = "28px";
2828

2929
export class ManageCommands {
3030
// TODO: setting this to FrameTitleBarProps causes type issues in frame-editors/jupyter-editor/editor.ts
@@ -482,11 +482,11 @@ export class ManageCommands {
482482
{icon ?? <Icon name="square" />}
483483
<div
484484
style={{
485-
fontSize: "10px",
485+
fontSize: "11px",
486486
color: "#666",
487-
marginTop: "-5px",
487+
marginTop: "-10px",
488488
// special case: button='' explicitly means no label
489-
width: cmd.button === "" ? undefined : "46px",
489+
width: cmd.button === "" ? undefined : "50px",
490490
overflow: "hidden",
491491
textOverflow: "ellipsis",
492492
}}

src/scripts/g

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ unset PGHOST
77
export DEBUG="cocalc:*"
88
#export DEBUG_CONSOLE="yes"
99
unset DEBUG_CONSOLE
10+
export COCALC_NOCACHE=yes
1011

1112
#export COCALC_DISABLE_API_VALIDATION=yes
13+
1214
pnpm hub

0 commit comments

Comments
 (0)