feat(chat): Meet now button in group chats like Teams
- group chat header shows "Meet now", its menu only offers Audio call - 1:1 call menu shows the Alt+Shift+V / Alt+Shift+A shortcuts - call-e2e.mjs hides the "Native client test" meeting chats after every run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -4,8 +4,10 @@ use gpui_kit::component::{
4
4
h_flex,
5
5
menu::{DropdownMenu as _, PopupMenuItem},
6
6
};
7
use gpui_kit::prelude::FluentBuilder as _;
7
8
use gpui_kit::*;
8
9
10
use super::shortcuts::{StartAudioCall, StartVideoCall};
9
11
use super::widgets::{icon, menu_icon};
10
12
use crate::app_state::{AppState, Selection};
11
13
use crate::call::{is_echo_chat, plan_for_chat};
@@ -21,11 +23,14 @@ pub const HEADER_CALL_OPTIONS_TAG: &str = "header-call-options";
21
23
const VIDEO_CALL_LABEL: &str = "Video call";
22
24
const AUDIO_CALL_LABEL: &str = "Audio call";
23
25
const CALL_OPTIONS_LABEL: &str = "Call options";
26
const MEET_NOW_LABEL: &str = "Meet now";
27
const GROUP_KIND: &str = "group";
24
28
25
29
pub fn header_call_controls(
26
30
app: &Entity<AppState>,
27
31
state: &AppState,
28
32
selection: &Selection,
33
compact: bool,
29
34
) -> Vec<AnyElement> {
30
35
let conversation_id = selection.conversation_id().to_owned();
31
36
let mut controls = Vec::new();
@@ -55,17 +60,16 @@ pub fn header_call_controls(
55
60
.into_any_element(),
56
61
);
57
62
}
58
let callable = matches!(selection, Selection::Chat(chat_id)
59
if state
60
.sidebar
61
.chats
62
.iter()
63
.find(|chat| &chat.id == chat_id)
64
.is_some_and(|chat| {
65
is_echo_chat(chat) || plan_for_chat(chat, state.directory.me.as_ref()).is_some()
66
}));
67
if callable {
68
controls.push(video_split_button(app));
63
let chat = match selection {
64
Selection::Chat(chat_id) => state.sidebar.chats.iter().find(|chat| &chat.id == chat_id),
65
Selection::Channel(_) => None,
66
};
67
let callable = chat.is_some_and(|chat| {
68
is_echo_chat(chat) || plan_for_chat(chat, state.directory.me.as_ref()).is_some()
69
});
70
if let Some(chat) = chat.filter(|_| callable) {
71
let meet_now = chat.kind == GROUP_KIND && !is_echo_chat(chat);
72
controls.push(video_split_button(app, meet_now, compact));
69
73
}
70
74
controls
71
75
}
@@ -82,20 +86,35 @@ fn start_call(app: &Entity<AppState>, with_video: bool, cx: &mut App) {
82
86
});
83
87
}
84
88
85
fn video_split_button(app: &Entity<AppState>) -> AnyElement {
89
fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) -> AnyElement {
86
90
let video_app = app.clone();
87
91
let menu_app = app.clone();
92
let labelled = meet_now && !compact;
88
93
h_flex()
89
94
.flex_none()
90
95
.items_center()
91
96
.child(
92
97
Button::new(HEADER_VIDEO_CALL_TAG)
93
98
.ghost()
94
.p_0()
95
.size(px(BUTTON_SIZE))
96
.tooltip(VIDEO_CALL_LABEL)
99
.h(px(BUTTON_SIZE))
100
.map(|button| if labelled { button.px(px(8.)) } else { button.p_0().w(px(BUTTON_SIZE)) })
101
.tooltip(if meet_now { MEET_NOW_LABEL } else { VIDEO_CALL_LABEL })
97
102
.debug_selector(|| HEADER_VIDEO_CALL_TAG.into())
98
.child(icon(IconName::Video, GLYPH_SIZE, theme::text_soft()))
103
.child(
104
h_flex()
105
.gap(px(6.))
106
.items_center()
107
.child(icon(IconName::Video, GLYPH_SIZE, theme::text_soft()))
108
.when(labelled, |row| {
109
row.child(
110
div()
111
.text_size(px(14.))
112
.font_weight(FontWeight::SEMIBOLD)
113
.text_color(theme::text())
114
.child(MEET_NOW_LABEL),
115
)
116
}),
117
)
99
118
.on_click(move |_, _, cx| start_call(&video_app, true, cx)),
100
119
)
101
120
.child(
@@ -109,17 +128,22 @@ fn video_split_button(app: &Entity<AppState>) -> AnyElement {
109
128
.child(icon(IconName::ChevronDown, CHEVRON_GLYPH, theme::text_soft()))
110
129
.dropdown_menu(move |popup, _, _| {
111
130
let (video, audio) = (menu_app.clone(), menu_app.clone());
112
popup
113
.item(
131
let popup = if meet_now {
132
popup
133
} else {
134
popup.item(
114
135
PopupMenuItem::new(VIDEO_CALL_LABEL)
115
136
.icon(menu_icon(IconName::Video))
137
.action(Box::new(StartVideoCall))
116
138
.on_click(move |_, _, cx| start_call(&video, true, cx)),
117
139
)
118
.item(
119
PopupMenuItem::new(AUDIO_CALL_LABEL)
120
.icon(menu_icon(IconName::Phone))
121
.on_click(move |_, _, cx| start_call(&audio, false, cx)),
122
)
140
};
141
popup.item(
142
PopupMenuItem::new(AUDIO_CALL_LABEL)
143
.icon(menu_icon(IconName::Phone))
144
.action(Box::new(StartAudioCall))
145
.on_click(move |_, _, cx| start_call(&audio, false, cx)),
146
)
123
147
}),
124
148
)
125
149
.into_any_element()
@@ -4,8 +4,10 @@ use gpui_kit::component::{4
h_flex,4
h_flex,5
menu::{DropdownMenu as _, PopupMenuItem},5
menu::{DropdownMenu as _, PopupMenuItem},6
};6
};7
use gpui_kit::prelude::FluentBuilder as _;7
use gpui_kit::*;8
use gpui_kit::*;8
9
10
use super::shortcuts::{StartAudioCall, StartVideoCall};9
use super::widgets::{icon, menu_icon};11
use super::widgets::{icon, menu_icon};10
use crate::app_state::{AppState, Selection};12
use crate::app_state::{AppState, Selection};11
use crate::call::{is_echo_chat, plan_for_chat};13
use crate::call::{is_echo_chat, plan_for_chat};@@ -21,11 +23,14 @@ pub const HEADER_CALL_OPTIONS_TAG: &str = "header-call-options";21
const VIDEO_CALL_LABEL: &str = "Video call";23
const VIDEO_CALL_LABEL: &str = "Video call";22
const AUDIO_CALL_LABEL: &str = "Audio call";24
const AUDIO_CALL_LABEL: &str = "Audio call";23
const CALL_OPTIONS_LABEL: &str = "Call options";25
const CALL_OPTIONS_LABEL: &str = "Call options";26
const MEET_NOW_LABEL: &str = "Meet now";27
const GROUP_KIND: &str = "group";24
28
25
pub fn header_call_controls(29
pub fn header_call_controls(26
app: &Entity<AppState>,30
app: &Entity<AppState>,27
state: &AppState,31
state: &AppState,28
selection: &Selection,32
selection: &Selection,33
compact: bool,29
) -> Vec<AnyElement> {34
) -> Vec<AnyElement> {30
let conversation_id = selection.conversation_id().to_owned();35
let conversation_id = selection.conversation_id().to_owned();31
let mut controls = Vec::new();36
let mut controls = Vec::new();@@ -55,17 +60,16 @@ pub fn header_call_controls(55
.into_any_element(),60
.into_any_element(),56
);61
);57
}62
}58
let callable = matches!(selection, Selection::Chat(chat_id)63
let chat = match selection {59
if state64
Selection::Chat(chat_id) => state.sidebar.chats.iter().find(|chat| &chat.id == chat_id),60
.sidebar65
Selection::Channel(_) => None,61
.chats66
};62
.iter()67
let callable = chat.is_some_and(|chat| {63
.find(|chat| &chat.id == chat_id)68
is_echo_chat(chat) || plan_for_chat(chat, state.directory.me.as_ref()).is_some()64
.is_some_and(|chat| {69
});65
is_echo_chat(chat) || plan_for_chat(chat, state.directory.me.as_ref()).is_some()70
if let Some(chat) = chat.filter(|_| callable) {66
}));71
let meet_now = chat.kind == GROUP_KIND && !is_echo_chat(chat);67
if callable {72
controls.push(video_split_button(app, meet_now, compact));68
controls.push(video_split_button(app));69
}73
}70
controls74
controls71
}75
}@@ -82,20 +86,35 @@ fn start_call(app: &Entity<AppState>, with_video: bool, cx: &mut App) {82
});86
});83
}87
}84
88
85
fn video_split_button(app: &Entity<AppState>) -> AnyElement {89
fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) -> AnyElement {86
let video_app = app.clone();90
let video_app = app.clone();87
let menu_app = app.clone();91
let menu_app = app.clone();92
let labelled = meet_now && !compact;88
h_flex()93
h_flex()89
.flex_none()94
.flex_none()90
.items_center()95
.items_center()91
.child(96
.child(92
Button::new(HEADER_VIDEO_CALL_TAG)97
Button::new(HEADER_VIDEO_CALL_TAG)93
.ghost()98
.ghost()94
.p_0()99
.h(px(BUTTON_SIZE))95
.size(px(BUTTON_SIZE))100
.map(|button| if labelled { button.px(px(8.)) } else { button.p_0().w(px(BUTTON_SIZE)) })96
.tooltip(VIDEO_CALL_LABEL)101
.tooltip(if meet_now { MEET_NOW_LABEL } else { VIDEO_CALL_LABEL })97
.debug_selector(|| HEADER_VIDEO_CALL_TAG.into())102
.debug_selector(|| HEADER_VIDEO_CALL_TAG.into())98
.child(icon(IconName::Video, GLYPH_SIZE, theme::text_soft()))103
.child(104
h_flex()105
.gap(px(6.))106
.items_center()107
.child(icon(IconName::Video, GLYPH_SIZE, theme::text_soft()))108
.when(labelled, |row| {109
row.child(110
div()111
.text_size(px(14.))112
.font_weight(FontWeight::SEMIBOLD)113
.text_color(theme::text())114
.child(MEET_NOW_LABEL),115
)116
}),117
)99
.on_click(move |_, _, cx| start_call(&video_app, true, cx)),118
.on_click(move |_, _, cx| start_call(&video_app, true, cx)),100
)119
)101
.child(120
.child(@@ -109,17 +128,22 @@ fn video_split_button(app: &Entity<AppState>) -> AnyElement {109
.child(icon(IconName::ChevronDown, CHEVRON_GLYPH, theme::text_soft()))128
.child(icon(IconName::ChevronDown, CHEVRON_GLYPH, theme::text_soft()))110
.dropdown_menu(move |popup, _, _| {129
.dropdown_menu(move |popup, _, _| {111
let (video, audio) = (menu_app.clone(), menu_app.clone());130
let (video, audio) = (menu_app.clone(), menu_app.clone());112
popup131
let popup = if meet_now {113
.item(132
popup133
} else {134
popup.item(114
PopupMenuItem::new(VIDEO_CALL_LABEL)135
PopupMenuItem::new(VIDEO_CALL_LABEL)115
.icon(menu_icon(IconName::Video))136
.icon(menu_icon(IconName::Video))137
.action(Box::new(StartVideoCall))116
.on_click(move |_, _, cx| start_call(&video, true, cx)),138
.on_click(move |_, _, cx| start_call(&video, true, cx)),117
)139
)118
.item(140
};119
PopupMenuItem::new(AUDIO_CALL_LABEL)141
popup.item(120
.icon(menu_icon(IconName::Phone))142
PopupMenuItem::new(AUDIO_CALL_LABEL)121
.on_click(move |_, _, cx| start_call(&audio, false, cx)),143
.icon(menu_icon(IconName::Phone))122
)144
.action(Box::new(StartAudioCall))145
.on_click(move |_, _, cx| start_call(&audio, false, cx)),146
)123
}),147
}),124
)148
)125
.into_any_element()149
.into_any_element()@@ -3743,7 +3743,7 @@ impl ConversationView {
3743
3743
let call_controls = if self.pinned && !self.popped_out {
3744
3744
Vec::new()
3745
3745
} else {
3746
header_call_controls(&self.app, app, ¤t.selection)
3746
header_call_controls(&self.app, app, ¤t.selection, self.header_overflows())
3747
3747
};
3748
3748
let sync = ¤t.sync;
3749
3749
let loading_window = current.window_request.is_some();
@@ -3743,7 +3743,7 @@ impl ConversationView {3743
let call_controls = if self.pinned && !self.popped_out {3743
let call_controls = if self.pinned && !self.popped_out {3744
Vec::new()3744
Vec::new()3745
} else {3745
} else {3746
header_call_controls(&self.app, app, ¤t.selection)3746
header_call_controls(&self.app, app, ¤t.selection, self.header_overflows())3747
};3747
};3748
let sync = ¤t.sync;3748
let sync = ¤t.sync;3749
let loading_window = current.window_request.is_some();3749
let loading_window = current.window_request.is_some();@@ -482,6 +482,11 @@ try {
482
482
restoreCapture();
483
483
log('default mic restored');
484
484
browser.socket.close();
485
try {
486
log(execFileSync('python3', ['-I', REPO_DIR + 'scripts/cleanup-test-chats.py']).toString().trim());
487
} catch (error) {
488
log('test chat cleanup failed: ' + error.message);
489
}
485
490
}
486
491
const scenariosPass = Object.values(report.scenarios ?? {}).every((entry) => entry.pass);
487
492
report.pass = Boolean(report.appToWeb?.pass && report.webToApp?.pass && scenariosPass);
@@ -482,6 +482,11 @@ try {482
restoreCapture();482
restoreCapture();483
log('default mic restored');483
log('default mic restored');484
browser.socket.close();484
browser.socket.close();485
try {486
log(execFileSync('python3', ['-I', REPO_DIR + 'scripts/cleanup-test-chats.py']).toString().trim());487
} catch (error) {488
log('test chat cleanup failed: ' + error.message);489
}485
}490
}486
const scenariosPass = Object.values(report.scenarios ?? {}).every((entry) => entry.pass);491
const scenariosPass = Object.values(report.scenarios ?? {}).every((entry) => entry.pass);487
report.pass = Boolean(report.appToWeb?.pass && report.webToApp?.pass && scenariosPass);492
report.pass = Boolean(report.appToWeb?.pass && report.webToApp?.pass && scenariosPass);