Skip to content

Commit 050cc0a

Browse files
committed
make side chat timetravel (which nobody will ever use) less ugly
1 parent 988eb31 commit 050cc0a

File tree

2 files changed

+47
-39
lines changed

2 files changed

+47
-39
lines changed

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

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -106,32 +106,33 @@ export default function SideChat({ project_id, path, style }: Props) {
106106
borderBottom: "1px solid lightgrey",
107107
}}
108108
>
109-
<Tooltip title="Show TimeTravel change history of this side chat.">
110-
<Button
111-
style={{
112-
float: "right",
113-
marginTop: "-5px",
114-
background: "rgb(91, 192, 222)",
115-
}}
116-
onClick={() => {
117-
actions.showTimeTravelInNewTab();
118-
}}
119-
>
120-
<Icon name="history" />
121-
</Button>
122-
</Tooltip>
123-
<VideoChatButton
124-
style={{ float: "right", marginTop: "-5px" }}
125-
project_id={project_id}
126-
path={path}
127-
sendChat={(value) => {
128-
const actions = redux.getEditorActions(
129-
project_id,
130-
path,
131-
) as ChatActions;
132-
actions.send_chat({ input: value });
109+
<Space.Compact
110+
style={{
111+
float: "right",
112+
marginTop: "-5px",
133113
}}
134-
/>{" "}
114+
>
115+
<VideoChatButton
116+
project_id={project_id}
117+
path={path}
118+
sendChat={(value) => {
119+
const actions = redux.getEditorActions(
120+
project_id,
121+
path,
122+
) as ChatActions;
123+
actions.send_chat({ input: value });
124+
}}
125+
/>
126+
<Tooltip title="Show TimeTravel change history of this side chat.">
127+
<Button
128+
onClick={() => {
129+
actions.showTimeTravelInNewTab();
130+
}}
131+
>
132+
<Icon name="history" />
133+
</Button>
134+
</Tooltip>
135+
</Space.Compact>
135136
<CollabList
136137
addCollab={addCollab}
137138
project={project}

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

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default function VideoChatButton({
3636
// to know if somebody else has video chat opened for this file
3737
// @ts-ignore
3838
const file_use = useTypedRedux("file_use", "file_use");
39+
const [open, setOpen] = useState<boolean>(false);
3940

4041
// so we can exclude ourselves
4142
const account_id: string = useTypedRedux("account", "account_id");
@@ -86,15 +87,14 @@ export default function VideoChatButton({
8687
if (video_chat.current.we_are_chatting()) {
8788
return (
8889
<span>
89-
Click to <b>leave</b> this video chatroom.
90+
<b>Leave</b> this video chatroom.
9091
</span>
9192
);
9293
} else {
9394
if (num_users_chatting < VIDEO_CHAT_LIMIT) {
9495
return (
9596
<span>
96-
Click to{" "}
97-
{num_users_chatting == 0 ? "start a new " : "join the current"}{" "}
97+
{num_users_chatting == 0 ? "Start a new " : "Join the current"}{" "}
9898
video chat.
9999
</span>
100100
);
@@ -125,26 +125,33 @@ export default function VideoChatButton({
125125
</>
126126
);
127127

128+
const btn = <Button style={{ ...style, ...style0 }}>{body}</Button>;
129+
128130
return (
129131
<Popconfirm
132+
onOpenChange={setOpen}
130133
title={`${
131134
num_users_chatting ? "Join the current" : "Start a new"
132135
} video chat session about this document?`}
133136
onConfirm={click_video_button}
134137
okText={`${num_users_chatting ? "Join" : "Start"} video chat`}
135138
cancelText={<CancelText />}
136139
>
137-
<Popover
138-
mouseEnterDelay={0.8}
139-
title={() => (
140-
<span>
141-
{render_join(num_users_chatting)}
142-
{render_num_chatting(num_users_chatting)}
143-
</span>
144-
)}
145-
>
146-
<Button style={{ ...style, ...style0 }}>{body}</Button>
147-
</Popover>
140+
{open ? (
141+
btn
142+
) : (
143+
<Popover
144+
mouseEnterDelay={0.8}
145+
title={() => (
146+
<span>
147+
{render_join(num_users_chatting)}
148+
{render_num_chatting(num_users_chatting)}
149+
</span>
150+
)}
151+
>
152+
{btn}
153+
</Popover>
154+
)}
148155
</Popconfirm>
149156
);
150157
}

0 commit comments

Comments
 (0)