feat(call): calls and meetings in their own window like Teams
- A call or meeting opens its own window (title bar, stage, controls); the main window stays free for chats - Closing the call window leaves the call; minimizing it shows the mini monitor - A window share minimizes the call window, capture exclusion follows it - Selecting a chat no longer hides the call; chats in the main window get marked read during a call - Still open: prejoin runs in the main window; layout and gallery pages follow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -942,7 +942,6 @@ impl AppState {
942
942
}
943
943
944
944
pub fn open_quick_view(&mut self, view: QuickView, cx: &mut Context<Self>) {
945
self.show_call(false, cx);
946
945
self.cancel_prejoin(cx);
947
946
self.new_chat = false;
948
947
self.quick_view = Some(view);
@@ -963,7 +962,6 @@ impl AppState {
963
962
pub fn start_new_chat(&mut self, cx: &mut Context<Self>) {
964
963
self.quick_view = None;
965
964
self.new_chat = true;
966
self.show_call(false, cx);
967
965
cx.emit(AppEvent::Selection);
968
966
cx.notify();
969
967
}
@@ -978,7 +976,6 @@ impl AppState {
978
976
}
979
977
980
978
pub fn select(&mut self, selection: Selection, cx: &mut Context<Self>) {
981
self.show_call(false, cx);
982
979
self.cancel_prejoin(cx);
983
980
self.call_end = None;
984
981
let was_drafting = std::mem::take(&mut self.new_chat);
@@ -942,7 +942,6 @@ impl AppState {942
}942
}943
943
944
pub fn open_quick_view(&mut self, view: QuickView, cx: &mut Context<Self>) {944
pub fn open_quick_view(&mut self, view: QuickView, cx: &mut Context<Self>) {945
self.show_call(false, cx);946
self.cancel_prejoin(cx);945
self.cancel_prejoin(cx);947
self.new_chat = false;946
self.new_chat = false;948
self.quick_view = Some(view);947
self.quick_view = Some(view);@@ -963,7 +962,6 @@ impl AppState {963
pub fn start_new_chat(&mut self, cx: &mut Context<Self>) {962
pub fn start_new_chat(&mut self, cx: &mut Context<Self>) {964
self.quick_view = None;963
self.quick_view = None;965
self.new_chat = true;964
self.new_chat = true;966
self.show_call(false, cx);967
cx.emit(AppEvent::Selection);965
cx.emit(AppEvent::Selection);968
cx.notify();966
cx.notify();969
}967
}@@ -978,7 +976,6 @@ impl AppState {978
}976
}979
977
980
pub fn select(&mut self, selection: Selection, cx: &mut Context<Self>) {978
pub fn select(&mut self, selection: Selection, cx: &mut Context<Self>) {981
self.show_call(false, cx);982
self.cancel_prejoin(cx);979
self.cancel_prejoin(cx);983
self.call_end = None;980
self.call_end = None;984
let was_drafting = std::mem::take(&mut self.new_chat);981
let was_drafting = std::mem::take(&mut self.new_chat);@@ -18,6 +18,9 @@ use crate::app_state::AppState;
18
18
use crate::notify::platform::{self, NativeHandle, ScreenRect, ShareGeometry, WorkArea};
19
19
use crate::views::call_mini_window::MiniWindowView;
20
20
use crate::views::call_pop_out::{POP_OUT_SIZE, POP_OUT_TITLE, SharePopOutView};
21
use crate::views::call_window::{
22
CALL_WINDOW_MIN_SIZE, CALL_WINDOW_SIZE, CallWindowView, call_window_title,
23
};
21
24
use crate::views::call_share_gallery::ShareGalleryView;
22
25
use crate::views::share_bar::{ShareBarView, ShareBorderView};
23
26
@@ -88,8 +91,12 @@ struct ShareSession {
88
91
89
92
pub struct CallWindows {
90
93
app: Entity<AppState>,
91
main_window: AnyWindowHandle,
92
94
main_native: Option<NativeHandle>,
95
stage: Option<AnyWindowHandle>,
96
stage_native: Option<NativeHandle>,
97
stage_opening: bool,
98
stage_closed_by_user: bool,
99
seen_viewing: Option<bool>,
93
100
work_area: Option<WorkArea>,
94
101
minimized: bool,
95
102
windows: HashMap<Role, Placed>,
@@ -164,8 +171,12 @@ impl CallWindows {
164
171
let gallery_saved = saved_position(GALLERY_POSITION_KEY, cx);
165
172
let windows = CallWindows {
166
173
app,
167
main_window: window.window_handle(),
168
174
main_native: platform::native_handle(window),
175
stage: None,
176
stage_native: None,
177
stage_opening: false,
178
stage_closed_by_user: false,
179
seen_viewing: None,
169
180
work_area: None,
170
181
minimized: false,
171
182
windows: HashMap::new(),
@@ -255,17 +266,126 @@ impl CallWindows {
255
266
}
256
267
257
268
pub fn return_to_call(&mut self, cx: &mut Context<Self>) {
258
if let Some(native) = self.main_native {
269
self.raise_stage(cx);
270
self.app.update(cx, |state, cx| state.show_call(true, cx));
271
}
272
273
fn raise_stage(&mut self, cx: &mut Context<Self>) {
274
if let Some(native) = self.stage_native {
259
275
platform::restore_and_raise(native);
260
276
}
261
self.main_window
262
.update(cx, |_, window, _| window.activate_window())
263
.ok();
264
self.app.update(cx, |state, cx| state.show_call(true, cx));
277
if let Some(stage) = self.stage {
278
stage.update(cx, |_, window, _| window.activate_window()).ok();
279
}
280
}
281
282
fn stage_wanted(&self, cx: &App) -> bool {
283
let state = self.app.read(cx);
284
state.call.is_some() || state.call_end.is_some()
285
}
286
287
fn sync_stage(&mut self, cx: &mut Context<Self>) {
288
let wanted = self.stage_wanted(cx);
289
if self.stage_closed_by_user {
290
if !wanted {
291
self.stage_closed_by_user = false;
292
} else if self.app.read(cx).call.is_none() {
293
self.app.update(cx, |state, cx| state.dismiss_call_end(cx));
294
}
295
return;
296
}
297
match (wanted, self.stage) {
298
(true, None) => self.open_stage(cx),
299
(false, Some(stage)) => {
300
self.forget_stage();
301
stage.update(cx, |_, window, _| window.remove_window()).ok();
302
}
303
(true, Some(stage)) => {
304
if stage.update(cx, |_, _, _| ()).is_err() {
305
self.forget_stage();
306
self.stage_closed_by_user = true;
307
}
308
}
309
(false, None) => {}
310
}
311
}
312
313
fn forget_stage(&mut self) {
314
self.stage = None;
315
self.stage_native = None;
316
self.minimized = false;
317
self.minimized_for_share = false;
318
self.main_excluded = false;
319
self.seen_viewing = None;
320
}
321
322
fn open_stage(&mut self, cx: &mut Context<Self>) {
323
if self.stage_opening {
324
return;
325
}
326
self.stage_opening = true;
327
let controller = cx.entity();
328
let app = self.app.clone();
329
let mut options = gpui_kit::component::TitleBar::window_options();
330
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(
331
None,
332
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),
333
cx,
334
)));
335
options.window_min_size = Some(size(px(CALL_WINDOW_MIN_SIZE.0), px(CALL_WINDOW_MIN_SIZE.1)));
336
if let Some(titlebar) = options.titlebar.as_mut() {
337
titlebar.title = Some(call_window_title(self.app.read(cx)).into());
338
}
339
// open_window draws right away, and the view reads the app entity while rendering.
340
cx.defer(move |cx| {
341
let opened = gpui_kit::open_window(options, cx, move |window, cx| {
342
cx.new(|cx| CallWindowView::new(app, window, cx))
343
});
344
let stage = opened.ok().map(|(handle, _)| handle);
345
let native = stage.and_then(|stage| {
346
stage
347
.update(cx, |_, window, _| platform::native_handle(window))
348
.ok()
349
.flatten()
350
});
351
controller.update(cx, |this, _| {
352
this.stage_opening = false;
353
this.stage = stage;
354
this.stage_native = native;
355
});
356
});
357
}
358
359
fn sync_viewing(&mut self, cx: &mut Context<Self>) {
360
let Some(viewing) = self.app.read(cx).call.as_ref().map(|call| call.viewing) else {
361
return;
362
};
363
let Some(stage) = self.stage else {
364
return;
365
};
366
match self.seen_viewing {
367
Some(seen) if seen == viewing => {
368
if self.stage_native.is_some() && viewing == self.minimized {
369
self.seen_viewing = Some(!viewing);
370
self.app.update(cx, |state, cx| state.show_call(!viewing, cx));
371
}
372
}
373
_ => {
374
self.seen_viewing = Some(viewing);
375
if viewing && self.minimized {
376
self.raise_stage(cx);
377
} else if !viewing && !self.minimized {
378
stage.update(cx, |_, window, _| window.minimize_window()).ok();
379
}
380
}
381
}
265
382
}
266
383
267
384
fn idle(&self, cx: &App) -> bool {
268
self.app.read(cx).call.is_none()
385
!self.stage_wanted(cx)
386
&& self.stage.is_none()
387
&& !self.stage_opening
388
&& !self.stage_closed_by_user
269
389
&& self.share.is_none()
270
390
&& self.windows.is_empty()
271
391
&& self.opening.is_empty()
@@ -278,7 +398,9 @@ impl CallWindows {
278
398
}
279
399
self.ticks = self.ticks.wrapping_add(1);
280
400
let slow = self.ticks % SLOW_TICK_EVERY == 0;
281
self.refresh_main_window();
401
self.sync_stage(cx);
402
self.refresh_stage_window();
403
self.sync_viewing(cx);
282
404
self.sync_share(slow, cx);
283
405
self.sync_capture_exclusion();
284
406
self.sync_pop_out(cx);
@@ -290,11 +412,11 @@ impl CallWindows {
290
412
TICK
291
413
}
292
414
293
fn refresh_main_window(&mut self) {
294
let Some(native) = self.main_native else {
415
fn refresh_stage_window(&mut self) {
416
let Some(native) = self.stage_native.or(self.main_native) else {
295
417
return;
296
418
};
297
let minimized = platform::window_minimized(native);
419
let minimized = self.stage_native.is_some_and(platform::window_minimized);
298
420
if self.minimized && !minimized {
299
421
self.minimized_for_share = false;
300
422
}
@@ -405,7 +527,7 @@ impl CallWindows {
405
527
}
406
528
407
529
fn minimize_for_share(&mut self, shared: Option<ScreenRect>, cx: &mut Context<Self>) {
408
let Some(native) = self.main_native.filter(|_| !self.minimized) else {
530
let Some(native) = self.stage_native.filter(|_| !self.minimized) else {
409
531
return;
410
532
};
411
533
if !minimize_on_share_start(
@@ -416,13 +538,13 @@ impl CallWindows {
416
538
return;
417
539
}
418
540
self.minimized_for_share = true;
419
self.main_window
420
.update(cx, |_, window, _| window.minimize_window())
421
.ok();
541
if let Some(stage) = self.stage {
542
stage.update(cx, |_, window, _| window.minimize_window()).ok();
543
}
422
544
}
423
545
424
546
fn sync_capture_exclusion(&mut self) {
425
let Some(native) = self.main_native else {
547
let Some(native) = self.stage_native else {
426
548
return;
427
549
};
428
550
let wanted = excluded_from_capture(Surface::Main, self.local_share_mode());
@@ -18,6 +18,9 @@ use crate::app_state::AppState;18
use crate::notify::platform::{self, NativeHandle, ScreenRect, ShareGeometry, WorkArea};18
use crate::notify::platform::{self, NativeHandle, ScreenRect, ShareGeometry, WorkArea};19
use crate::views::call_mini_window::MiniWindowView;19
use crate::views::call_mini_window::MiniWindowView;20
use crate::views::call_pop_out::{POP_OUT_SIZE, POP_OUT_TITLE, SharePopOutView};20
use crate::views::call_pop_out::{POP_OUT_SIZE, POP_OUT_TITLE, SharePopOutView};21
use crate::views::call_window::{22
CALL_WINDOW_MIN_SIZE, CALL_WINDOW_SIZE, CallWindowView, call_window_title,23
};21
use crate::views::call_share_gallery::ShareGalleryView;24
use crate::views::call_share_gallery::ShareGalleryView;22
use crate::views::share_bar::{ShareBarView, ShareBorderView};25
use crate::views::share_bar::{ShareBarView, ShareBorderView};23
26
@@ -88,8 +91,12 @@ struct ShareSession {88
91
89
pub struct CallWindows {92
pub struct CallWindows {90
app: Entity<AppState>,93
app: Entity<AppState>,91
main_window: AnyWindowHandle,92
main_native: Option<NativeHandle>,94
main_native: Option<NativeHandle>,95
stage: Option<AnyWindowHandle>,96
stage_native: Option<NativeHandle>,97
stage_opening: bool,98
stage_closed_by_user: bool,99
seen_viewing: Option<bool>,93
work_area: Option<WorkArea>,100
work_area: Option<WorkArea>,94
minimized: bool,101
minimized: bool,95
windows: HashMap<Role, Placed>,102
windows: HashMap<Role, Placed>,@@ -164,8 +171,12 @@ impl CallWindows {164
let gallery_saved = saved_position(GALLERY_POSITION_KEY, cx);171
let gallery_saved = saved_position(GALLERY_POSITION_KEY, cx);165
let windows = CallWindows {172
let windows = CallWindows {166
app,173
app,167
main_window: window.window_handle(),168
main_native: platform::native_handle(window),174
main_native: platform::native_handle(window),175
stage: None,176
stage_native: None,177
stage_opening: false,178
stage_closed_by_user: false,179
seen_viewing: None,169
work_area: None,180
work_area: None,170
minimized: false,181
minimized: false,171
windows: HashMap::new(),182
windows: HashMap::new(),@@ -255,17 +266,126 @@ impl CallWindows {255
}266
}256
267
257
pub fn return_to_call(&mut self, cx: &mut Context<Self>) {268
pub fn return_to_call(&mut self, cx: &mut Context<Self>) {258
if let Some(native) = self.main_native {269
self.raise_stage(cx);270
self.app.update(cx, |state, cx| state.show_call(true, cx));271
}272
273
fn raise_stage(&mut self, cx: &mut Context<Self>) {274
if let Some(native) = self.stage_native {259
platform::restore_and_raise(native);275
platform::restore_and_raise(native);260
}276
}261
self.main_window277
if let Some(stage) = self.stage {262
.update(cx, |_, window, _| window.activate_window())278
stage.update(cx, |_, window, _| window.activate_window()).ok();263
.ok();279
}264
self.app.update(cx, |state, cx| state.show_call(true, cx));280
}281
282
fn stage_wanted(&self, cx: &App) -> bool {283
let state = self.app.read(cx);284
state.call.is_some() || state.call_end.is_some()285
}286
287
fn sync_stage(&mut self, cx: &mut Context<Self>) {288
let wanted = self.stage_wanted(cx);289
if self.stage_closed_by_user {290
if !wanted {291
self.stage_closed_by_user = false;292
} else if self.app.read(cx).call.is_none() {293
self.app.update(cx, |state, cx| state.dismiss_call_end(cx));294
}295
return;296
}297
match (wanted, self.stage) {298
(true, None) => self.open_stage(cx),299
(false, Some(stage)) => {300
self.forget_stage();301
stage.update(cx, |_, window, _| window.remove_window()).ok();302
}303
(true, Some(stage)) => {304
if stage.update(cx, |_, _, _| ()).is_err() {305
self.forget_stage();306
self.stage_closed_by_user = true;307
}308
}309
(false, None) => {}310
}311
}312
313
fn forget_stage(&mut self) {314
self.stage = None;315
self.stage_native = None;316
self.minimized = false;317
self.minimized_for_share = false;318
self.main_excluded = false;319
self.seen_viewing = None;320
}321
322
fn open_stage(&mut self, cx: &mut Context<Self>) {323
if self.stage_opening {324
return;325
}326
self.stage_opening = true;327
let controller = cx.entity();328
let app = self.app.clone();329
let mut options = gpui_kit::component::TitleBar::window_options();330
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(331
None,332
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),333
cx,334
)));335
options.window_min_size = Some(size(px(CALL_WINDOW_MIN_SIZE.0), px(CALL_WINDOW_MIN_SIZE.1)));336
if let Some(titlebar) = options.titlebar.as_mut() {337
titlebar.title = Some(call_window_title(self.app.read(cx)).into());338
}339
// open_window draws right away, and the view reads the app entity while rendering.340
cx.defer(move |cx| {341
let opened = gpui_kit::open_window(options, cx, move |window, cx| {342
cx.new(|cx| CallWindowView::new(app, window, cx))343
});344
let stage = opened.ok().map(|(handle, _)| handle);345
let native = stage.and_then(|stage| {346
stage347
.update(cx, |_, window, _| platform::native_handle(window))348
.ok()349
.flatten()350
});351
controller.update(cx, |this, _| {352
this.stage_opening = false;353
this.stage = stage;354
this.stage_native = native;355
});356
});357
}358
359
fn sync_viewing(&mut self, cx: &mut Context<Self>) {360
let Some(viewing) = self.app.read(cx).call.as_ref().map(|call| call.viewing) else {361
return;362
};363
let Some(stage) = self.stage else {364
return;365
};366
match self.seen_viewing {367
Some(seen) if seen == viewing => {368
if self.stage_native.is_some() && viewing == self.minimized {369
self.seen_viewing = Some(!viewing);370
self.app.update(cx, |state, cx| state.show_call(!viewing, cx));371
}372
}373
_ => {374
self.seen_viewing = Some(viewing);375
if viewing && self.minimized {376
self.raise_stage(cx);377
} else if !viewing && !self.minimized {378
stage.update(cx, |_, window, _| window.minimize_window()).ok();379
}380
}381
}265
}382
}266
383
267
fn idle(&self, cx: &App) -> bool {384
fn idle(&self, cx: &App) -> bool {268
self.app.read(cx).call.is_none()385
!self.stage_wanted(cx)386
&& self.stage.is_none()387
&& !self.stage_opening388
&& !self.stage_closed_by_user269
&& self.share.is_none()389
&& self.share.is_none()270
&& self.windows.is_empty()390
&& self.windows.is_empty()271
&& self.opening.is_empty()391
&& self.opening.is_empty()@@ -278,7 +398,9 @@ impl CallWindows {278
}398
}279
self.ticks = self.ticks.wrapping_add(1);399
self.ticks = self.ticks.wrapping_add(1);280
let slow = self.ticks % SLOW_TICK_EVERY == 0;400
let slow = self.ticks % SLOW_TICK_EVERY == 0;281
self.refresh_main_window();401
self.sync_stage(cx);402
self.refresh_stage_window();403
self.sync_viewing(cx);282
self.sync_share(slow, cx);404
self.sync_share(slow, cx);283
self.sync_capture_exclusion();405
self.sync_capture_exclusion();284
self.sync_pop_out(cx);406
self.sync_pop_out(cx);@@ -290,11 +412,11 @@ impl CallWindows {290
TICK412
TICK291
}413
}292
414
293
fn refresh_main_window(&mut self) {415
fn refresh_stage_window(&mut self) {294
let Some(native) = self.main_native else {416
let Some(native) = self.stage_native.or(self.main_native) else {295
return;417
return;296
};418
};297
let minimized = platform::window_minimized(native);419
let minimized = self.stage_native.is_some_and(platform::window_minimized);298
if self.minimized && !minimized {420
if self.minimized && !minimized {299
self.minimized_for_share = false;421
self.minimized_for_share = false;300
}422
}@@ -405,7 +527,7 @@ impl CallWindows {405
}527
}406
528
407
fn minimize_for_share(&mut self, shared: Option<ScreenRect>, cx: &mut Context<Self>) {529
fn minimize_for_share(&mut self, shared: Option<ScreenRect>, cx: &mut Context<Self>) {408
let Some(native) = self.main_native.filter(|_| !self.minimized) else {530
let Some(native) = self.stage_native.filter(|_| !self.minimized) else {409
return;531
return;410
};532
};411
if !minimize_on_share_start(533
if !minimize_on_share_start(@@ -416,13 +538,13 @@ impl CallWindows {416
return;538
return;417
}539
}418
self.minimized_for_share = true;540
self.minimized_for_share = true;419
self.main_window541
if let Some(stage) = self.stage {420
.update(cx, |_, window, _| window.minimize_window())542
stage.update(cx, |_, window, _| window.minimize_window()).ok();421
.ok();543
}422
}544
}423
545
424
fn sync_capture_exclusion(&mut self) {546
fn sync_capture_exclusion(&mut self) {425
let Some(native) = self.main_native else {547
let Some(native) = self.stage_native else {426
return;548
return;427
};549
};428
let wanted = excluded_from_capture(Surface::Main, self.local_share_mode());550
let wanted = excluded_from_capture(Surface::Main, self.local_share_mode());@@ -189,6 +189,7 @@ mod frames {
189
189
POST_ANNOUNCEMENT_TAG, POST_ANNOUNCEMENT_TOGGLE_TAG, POST_AUDIENCE_TAG, POST_CARD_DIVIDER_TAG, POST_CARD_FOOTER_TAG, POST_CARD_HEADER_TAG, POST_CARD_SEND_TAG,
190
190
POST_CARD_SUBJECT_TAG,
191
191
};
192
use crate::views::call_window::CALL_WINDOW_TAG;
192
193
use crate::views::conversation::{
193
194
CHANNEL_DETAILS_BUTTON, CHANNEL_DETAILS_PINNED_TAG, CHANNEL_DETAILS_SHARED_TAG,
194
195
CHANNEL_DETAILS_TAG,
@@ -215,7 +216,7 @@ mod frames {
215
216
use crate::views::reaction_proposal_pill::REACTION_PILL;
216
217
use crate::views::recap_tab::RECAP_REGION;
217
218
use crate::views::shell::{
218
AppShell, Startup, bind_keys, install_globals, sidebar_hidden_in_call,
219
AppShell, Startup, bind_keys, install_globals,
219
220
};
220
221
use crate::views::shortcuts::{
221
222
ClearChatFilters, FilterMutedChats, FindInChat, OpenActivity, OpenAgents, OpenCallsTab,
@@ -695,6 +696,29 @@ mod frames {
695
696
(consult, held)
696
697
}
697
698
699
/// The meeting window the call controller opens once a call is set.
700
fn call_window_context(visual: &mut VisualTestContext) -> VisualTestContext {
701
for _ in 0..SETTLE_LIMIT {
702
let main = visual.update(|window, _| window.window_handle());
703
let candidates = visual.update(|_, cx| cx.windows());
704
for handle in candidates.into_iter().filter(|handle| *handle != main) {
705
let alive = visual.update(|_, cx| handle.update(cx, |_, _, _| ()).is_ok());
706
if !alive {
707
continue;
708
}
709
let mut candidate = VisualTestContext::from_window(handle, visual);
710
candidate.update(|window, cx| window.render_frame(cx));
711
if candidate.debug_bounds(CALL_WINDOW_TAG).is_some() {
712
return candidate;
713
}
714
}
715
visual.executor().advance_clock(SETTLE_STEP);
716
std::thread::sleep(SETTLE_STEP);
717
visual.run_until_parked();
718
}
719
panic!("the call window never opened");
720
}
721
698
722
fn mount(cx: &mut TestAppContext) -> (gpui_kit::AnyWindowHandle, Entity<AppState>) {
699
723
mount_with(cx, false)
700
724
}
@@ -964,14 +988,17 @@ mod frames {
964
988
screen_name,
965
989
"call" | "call-people" | "call-transcript" | "call-share" | "call-consult"
966
990
);
967
let tags = collect(&mut visual, status_menu.then_some(MENU));
991
let tags = if is_call {
992
let mut call_visual = call_window_context(&mut visual);
993
call_visual.simulate_resize(size(px(width), px(height)));
994
collect(&mut call_visual, None)
995
} else {
996
collect(&mut visual, status_menu.then_some(MENU))
997
};
968
998
let mut expected = GUARDED.to_vec();
969
999
if is_call {
1000
expected = vec!["shell/islands/main"];
970
1001
expected.extend(CALL_GUARDED);
971
let panel_open = matches!(screen_name, "call-people" | "call-transcript");
972
if sidebar_hidden_in_call(width, panel_open) {
973
expected.retain(|path| *path != "shell/islands/sidebar");
974
}
975
1002
}
976
1003
if screen_name == "call-transcript" {
977
1004
expected.push(CALL_TRANSCRIPT);
@@ -1241,14 +1268,16 @@ mod frames {
1241
1268
cx.notify();
1242
1269
})
1243
1270
});
1244
collect(&mut visual, Some(CHAT_PANEL_TAG));
1245
let panel = visual
1271
let mut call_visual = call_window_context(&mut visual);
1272
call_visual.simulate_resize(size(px(width), px(height)));
1273
collect(&mut call_visual, Some(CHAT_PANEL_TAG));
1274
let panel = call_visual
1246
1275
.debug_bounds(CHAT_PANEL_TAG)
1247
1276
.expect("chat panel rendered");
1248
1277
let bubbles: Vec<(usize, Bounds<Pixels>)> = BUBBLE_TAGS
1249
1278
.iter()
1250
1279
.enumerate()
1251
.filter_map(|(index, tag)| visual.debug_bounds(tag).map(|bounds| (index, bounds)))
1280
.filter_map(|(index, tag)| call_visual.debug_bounds(tag).map(|bounds| (index, bounds)))
1252
1281
.collect();
1253
1282
assert!(!bubbles.is_empty(), "no bubbles rendered in the call chat");
1254
1283
let found: Vec<String> = bubbles
@@ -2816,11 +2845,6 @@ const OUTLINE_ALLOWLIST: &[(&str, &str, &str)] = &[
2816
2845
"theme::accent()",
2817
2846
"input field",
2818
2847
),
2819
(
2820
"views/call_mini.rs",
2821
"border)",
2822
"state signal (speaking, sharing, drag, drop, failed), not a resting outline",
2823
),
2824
2848
(
2825
2849
"views/sidebar.rs",
2826
2850
"theme::accent()",
@@ -189,6 +189,7 @@ mod frames {189
POST_ANNOUNCEMENT_TAG, POST_ANNOUNCEMENT_TOGGLE_TAG, POST_AUDIENCE_TAG, POST_CARD_DIVIDER_TAG, POST_CARD_FOOTER_TAG, POST_CARD_HEADER_TAG, POST_CARD_SEND_TAG,189
POST_ANNOUNCEMENT_TAG, POST_ANNOUNCEMENT_TOGGLE_TAG, POST_AUDIENCE_TAG, POST_CARD_DIVIDER_TAG, POST_CARD_FOOTER_TAG, POST_CARD_HEADER_TAG, POST_CARD_SEND_TAG,190
POST_CARD_SUBJECT_TAG,190
POST_CARD_SUBJECT_TAG,191
};191
};192
use crate::views::call_window::CALL_WINDOW_TAG;192
use crate::views::conversation::{193
use crate::views::conversation::{193
CHANNEL_DETAILS_BUTTON, CHANNEL_DETAILS_PINNED_TAG, CHANNEL_DETAILS_SHARED_TAG,194
CHANNEL_DETAILS_BUTTON, CHANNEL_DETAILS_PINNED_TAG, CHANNEL_DETAILS_SHARED_TAG,194
CHANNEL_DETAILS_TAG,195
CHANNEL_DETAILS_TAG,@@ -215,7 +216,7 @@ mod frames {215
use crate::views::reaction_proposal_pill::REACTION_PILL;216
use crate::views::reaction_proposal_pill::REACTION_PILL;216
use crate::views::recap_tab::RECAP_REGION;217
use crate::views::recap_tab::RECAP_REGION;217
use crate::views::shell::{218
use crate::views::shell::{218
AppShell, Startup, bind_keys, install_globals, sidebar_hidden_in_call,219
AppShell, Startup, bind_keys, install_globals,219
};220
};220
use crate::views::shortcuts::{221
use crate::views::shortcuts::{221
ClearChatFilters, FilterMutedChats, FindInChat, OpenActivity, OpenAgents, OpenCallsTab,222
ClearChatFilters, FilterMutedChats, FindInChat, OpenActivity, OpenAgents, OpenCallsTab,@@ -695,6 +696,29 @@ mod frames {695
(consult, held)696
(consult, held)696
}697
}697
698
699
/// The meeting window the call controller opens once a call is set.700
fn call_window_context(visual: &mut VisualTestContext) -> VisualTestContext {701
for _ in 0..SETTLE_LIMIT {702
let main = visual.update(|window, _| window.window_handle());703
let candidates = visual.update(|_, cx| cx.windows());704
for handle in candidates.into_iter().filter(|handle| *handle != main) {705
let alive = visual.update(|_, cx| handle.update(cx, |_, _, _| ()).is_ok());706
if !alive {707
continue;708
}709
let mut candidate = VisualTestContext::from_window(handle, visual);710
candidate.update(|window, cx| window.render_frame(cx));711
if candidate.debug_bounds(CALL_WINDOW_TAG).is_some() {712
return candidate;713
}714
}715
visual.executor().advance_clock(SETTLE_STEP);716
std::thread::sleep(SETTLE_STEP);717
visual.run_until_parked();718
}719
panic!("the call window never opened");720
}721
698
fn mount(cx: &mut TestAppContext) -> (gpui_kit::AnyWindowHandle, Entity<AppState>) {722
fn mount(cx: &mut TestAppContext) -> (gpui_kit::AnyWindowHandle, Entity<AppState>) {699
mount_with(cx, false)723
mount_with(cx, false)700
}724
}@@ -964,14 +988,17 @@ mod frames {964
screen_name,988
screen_name,965
"call" | "call-people" | "call-transcript" | "call-share" | "call-consult"989
"call" | "call-people" | "call-transcript" | "call-share" | "call-consult"966
);990
);967
let tags = collect(&mut visual, status_menu.then_some(MENU));991
let tags = if is_call {992
let mut call_visual = call_window_context(&mut visual);993
call_visual.simulate_resize(size(px(width), px(height)));994
collect(&mut call_visual, None)995
} else {996
collect(&mut visual, status_menu.then_some(MENU))997
};968
let mut expected = GUARDED.to_vec();998
let mut expected = GUARDED.to_vec();969
if is_call {999
if is_call {1000
expected = vec!["shell/islands/main"];970
expected.extend(CALL_GUARDED);1001
expected.extend(CALL_GUARDED);971
let panel_open = matches!(screen_name, "call-people" | "call-transcript");972
if sidebar_hidden_in_call(width, panel_open) {973
expected.retain(|path| *path != "shell/islands/sidebar");974
}975
}1002
}976
if screen_name == "call-transcript" {1003
if screen_name == "call-transcript" {977
expected.push(CALL_TRANSCRIPT);1004
expected.push(CALL_TRANSCRIPT);@@ -1241,14 +1268,16 @@ mod frames {1241
cx.notify();1268
cx.notify();1242
})1269
})1243
});1270
});1244
collect(&mut visual, Some(CHAT_PANEL_TAG));1271
let mut call_visual = call_window_context(&mut visual);1245
let panel = visual1272
call_visual.simulate_resize(size(px(width), px(height)));1273
collect(&mut call_visual, Some(CHAT_PANEL_TAG));1274
let panel = call_visual1246
.debug_bounds(CHAT_PANEL_TAG)1275
.debug_bounds(CHAT_PANEL_TAG)1247
.expect("chat panel rendered");1276
.expect("chat panel rendered");1248
let bubbles: Vec<(usize, Bounds<Pixels>)> = BUBBLE_TAGS1277
let bubbles: Vec<(usize, Bounds<Pixels>)> = BUBBLE_TAGS1249
.iter()1278
.iter()1250
.enumerate()1279
.enumerate()1251
.filter_map(|(index, tag)| visual.debug_bounds(tag).map(|bounds| (index, bounds)))1280
.filter_map(|(index, tag)| call_visual.debug_bounds(tag).map(|bounds| (index, bounds)))1252
.collect();1281
.collect();1253
assert!(!bubbles.is_empty(), "no bubbles rendered in the call chat");1282
assert!(!bubbles.is_empty(), "no bubbles rendered in the call chat");1254
let found: Vec<String> = bubbles1283
let found: Vec<String> = bubbles@@ -2816,11 +2845,6 @@ const OUTLINE_ALLOWLIST: &[(&str, &str, &str)] = &[2816
"theme::accent()",2845
"theme::accent()",2817
"input field",2846
"input field",2818
),2847
),2819
(2820
"views/call_mini.rs",2821
"border)",2822
"state signal (speaking, sharing, drag, drop, failed), not a resting outline",2823
),2824
(2848
(2825
"views/sidebar.rs",2849
"views/sidebar.rs",2826
"theme::accent()",2850
"theme::accent()",@@ -1,162 +0,0 @@
1
use std::time::Instant;
2
3
use gpui_kit::assets::IconName;
4
use gpui_kit::component::h_flex;
5
use gpui_kit::*;
6
7
use super::call_mini_window::{
8
ControlIds, WINDOW_RADIUS, chip, controls_row, self_view, speaker_layer, speaker_name_chip,
9
speaker_speaking, tinted_chip,
10
};
11
use super::call_view::status_line;
12
use super::toolbar_placement::TimelineBounds;
13
use super::widgets::icon;
14
use crate::app_state::AppState;
15
use crate::theme;
16
use app_ui_kit::layout::ROW_PADDING;
17
18
const MINI_WIDTH: f32 = 256.;
19
const MINI_HEIGHT: f32 = 144.;
20
const MINI_RIGHT: f32 = 16.;
21
const MINI_BOTTOM: f32 = 40.;
22
23
pub struct CallMiniView {
24
app: Entity<AppState>,
25
timeline: TimelineBounds,
26
_app_subscription: Subscription,
27
_media_subscription: Option<Subscription>,
28
}
29
30
impl CallMiniView {
31
pub fn new(app: Entity<AppState>, timeline: TimelineBounds, cx: &mut Context<Self>) -> Self {
32
let app_subscription = cx.observe(&app, |_, _, cx| cx.notify());
33
let media_subscription = app
34
.read(cx)
35
.call_media
36
.clone()
37
.map(|media| cx.observe(&media, |_, _, cx| cx.notify()));
38
CallMiniView {
39
app,
40
timeline,
41
_app_subscription: app_subscription,
42
_media_subscription: media_subscription,
43
}
44
}
45
}
46
47
fn stop_sharing_pill(app: &Entity<AppState>) -> Stateful<Div> {
48
let stop_app = app.clone();
49
div()
50
.id("call-mini-stop-sharing")
51
.absolute()
52
.top(px(8.))
53
.right(px(8.))
54
.h(px(24.))
55
.px(px(10.))
56
.flex()
57
.items_center()
58
.gap(px(4.))
59
.rounded_full()
60
.bg(theme::red())
61
.text_color(theme::white())
62
.text_size(px(12.))
63
.font_weight(FontWeight::SEMIBOLD)
64
.cursor_pointer()
65
.hover(|button| button.opacity(0.85))
66
.child(icon(IconName::ScreenShare, 14., theme::white()))
67
.child("Stop")
68
.on_click(move |_, _, cx| {
69
cx.stop_propagation();
70
stop_app.update(cx, |state, cx| state.stop_call_share(cx));
71
})
72
}
73
74
impl Render for CallMiniView {
75
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
76
let state = self.app.read(cx);
77
let Some(call) = state.call.as_ref().filter(|call| !call.viewing) else {
78
return div().into_any_element();
79
};
80
let model = &call.model;
81
let now = Instant::now();
82
let (status, _) = status_line(model, now);
83
let viewport = window.viewport_size();
84
let (right, bottom) = self.timeline.get().map_or(
85
(px(MINI_RIGHT), px(MINI_BOTTOM)),
86
|timeline| {
87
(
88
viewport.width - timeline.right() + px(ROW_PADDING),
89
viewport.height - timeline.bottom() + px(MINI_RIGHT),
90
)
91
},
92
);
93
let sharing = model.local_share.is_some();
94
let open_app = self.app.clone();
95
let back_app = self.app.clone();
96
let speaker_name = speaker_name_chip(state, model, now);
97
let border = if sharing {
98
theme::red()
99
} else if speaker_speaking(model) {
100
theme::green()
101
} else {
102
theme::border_strong()
103
};
104
let top_left = if sharing {
105
tinted_chip("Sharing".to_owned(), theme::red())
106
} else {
107
chip(status)
108
};
109
div()
110
.id("call-mini")
111
.group("call-mini")
112
.occlude()
113
.absolute()
114
.right(right)
115
.bottom(bottom)
116
.w(px(MINI_WIDTH))
117
.h(px(MINI_HEIGHT))
118
.overflow_hidden()
119
.rounded(px(WINDOW_RADIUS))
120
.bg(theme::surface())
121
.border_2()
122
.border_color(border)
123
.text_color(theme::text())
124
.shadow(theme::flyout_shadow())
125
.cursor_pointer()
126
.on_click(move |_, _, cx| {
127
open_app.update(cx, |state, cx| state.show_call(true, cx));
128
})
129
.child(speaker_layer(state, model, now))
130
.child(
131
div()
132
.absolute()
133
.top(px(8.))
134
.left(px(8.))
135
.child(top_left),
136
)
137
.children(speaker_name.map(|name| {
138
h_flex()
139
.absolute()
140
.bottom(px(6.))
141
.left(px(8.))
142
.child(name)
143
}))
144
.children(if sharing {
145
Some(stop_sharing_pill(&self.app).into_any_element())
146
} else {
147
self_view(state, model, now)
148
})
149
.child(controls_row(
150
&self.app,
151
model,
152
ControlIds {
153
mute: "call-mini-mute",
154
back: "call-mini-back",
155
leave: "call-mini-leave",
156
},
157
"call-mini",
158
move |cx| back_app.update(cx, |state, cx| state.show_call(true, cx)),
159
))
160
.into_any_element()
161
}
162
}
@@ -1,162 +0,0 @@1
use std::time::Instant;2
3
use gpui_kit::assets::IconName;4
use gpui_kit::component::h_flex;5
use gpui_kit::*;6
7
use super::call_mini_window::{8
ControlIds, WINDOW_RADIUS, chip, controls_row, self_view, speaker_layer, speaker_name_chip,9
speaker_speaking, tinted_chip,10
};11
use super::call_view::status_line;12
use super::toolbar_placement::TimelineBounds;13
use super::widgets::icon;14
use crate::app_state::AppState;15
use crate::theme;16
use app_ui_kit::layout::ROW_PADDING;17
18
const MINI_WIDTH: f32 = 256.;19
const MINI_HEIGHT: f32 = 144.;20
const MINI_RIGHT: f32 = 16.;21
const MINI_BOTTOM: f32 = 40.;22
23
pub struct CallMiniView {24
app: Entity<AppState>,25
timeline: TimelineBounds,26
_app_subscription: Subscription,27
_media_subscription: Option<Subscription>,28
}29
30
impl CallMiniView {31
pub fn new(app: Entity<AppState>, timeline: TimelineBounds, cx: &mut Context<Self>) -> Self {32
let app_subscription = cx.observe(&app, |_, _, cx| cx.notify());33
let media_subscription = app34
.read(cx)35
.call_media36
.clone()37
.map(|media| cx.observe(&media, |_, _, cx| cx.notify()));38
CallMiniView {39
app,40
timeline,41
_app_subscription: app_subscription,42
_media_subscription: media_subscription,43
}44
}45
}46
47
fn stop_sharing_pill(app: &Entity<AppState>) -> Stateful<Div> {48
let stop_app = app.clone();49
div()50
.id("call-mini-stop-sharing")51
.absolute()52
.top(px(8.))53
.right(px(8.))54
.h(px(24.))55
.px(px(10.))56
.flex()57
.items_center()58
.gap(px(4.))59
.rounded_full()60
.bg(theme::red())61
.text_color(theme::white())62
.text_size(px(12.))63
.font_weight(FontWeight::SEMIBOLD)64
.cursor_pointer()65
.hover(|button| button.opacity(0.85))66
.child(icon(IconName::ScreenShare, 14., theme::white()))67
.child("Stop")68
.on_click(move |_, _, cx| {69
cx.stop_propagation();70
stop_app.update(cx, |state, cx| state.stop_call_share(cx));71
})72
}73
74
impl Render for CallMiniView {75
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {76
let state = self.app.read(cx);77
let Some(call) = state.call.as_ref().filter(|call| !call.viewing) else {78
return div().into_any_element();79
};80
let model = &call.model;81
let now = Instant::now();82
let (status, _) = status_line(model, now);83
let viewport = window.viewport_size();84
let (right, bottom) = self.timeline.get().map_or(85
(px(MINI_RIGHT), px(MINI_BOTTOM)),86
|timeline| {87
(88
viewport.width - timeline.right() + px(ROW_PADDING),89
viewport.height - timeline.bottom() + px(MINI_RIGHT),90
)91
},92
);93
let sharing = model.local_share.is_some();94
let open_app = self.app.clone();95
let back_app = self.app.clone();96
let speaker_name = speaker_name_chip(state, model, now);97
let border = if sharing {98
theme::red()99
} else if speaker_speaking(model) {100
theme::green()101
} else {102
theme::border_strong()103
};104
let top_left = if sharing {105
tinted_chip("Sharing".to_owned(), theme::red())106
} else {107
chip(status)108
};109
div()110
.id("call-mini")111
.group("call-mini")112
.occlude()113
.absolute()114
.right(right)115
.bottom(bottom)116
.w(px(MINI_WIDTH))117
.h(px(MINI_HEIGHT))118
.overflow_hidden()119
.rounded(px(WINDOW_RADIUS))120
.bg(theme::surface())121
.border_2()122
.border_color(border)123
.text_color(theme::text())124
.shadow(theme::flyout_shadow())125
.cursor_pointer()126
.on_click(move |_, _, cx| {127
open_app.update(cx, |state, cx| state.show_call(true, cx));128
})129
.child(speaker_layer(state, model, now))130
.child(131
div()132
.absolute()133
.top(px(8.))134
.left(px(8.))135
.child(top_left),136
)137
.children(speaker_name.map(|name| {138
h_flex()139
.absolute()140
.bottom(px(6.))141
.left(px(8.))142
.child(name)143
}))144
.children(if sharing {145
Some(stop_sharing_pill(&self.app).into_any_element())146
} else {147
self_view(state, model, now)148
})149
.child(controls_row(150
&self.app,151
model,152
ControlIds {153
mute: "call-mini-mute",154
back: "call-mini-back",155
leave: "call-mini-leave",156
},157
"call-mini",158
move |cx| back_app.update(cx, |state, cx| state.show_call(true, cx)),159
))160
.into_any_element()161
}162
}@@ -324,16 +324,3 @@ pub fn render_stage_overlay(app: &Entity<AppState>, state: &AppState) -> Option<
324
324
.into_any_element(),
325
325
)
326
326
}
327
328
pub fn render_call_overlay(view: AnyElement) -> AnyElement {
329
v_flex()
330
.id("call-fullscreen-overlay")
331
.occlude()
332
.absolute()
333
.top_0()
334
.left_0()
335
.size_full()
336
.bg(theme::background())
337
.child(view)
338
.into_any_element()
339
}
@@ -324,16 +324,3 @@ pub fn render_stage_overlay(app: &Entity<AppState>, state: &AppState) -> Option<324
.into_any_element(),324
.into_any_element(),325
)325
)326
}326
}327
328
pub fn render_call_overlay(view: AnyElement) -> AnyElement {329
v_flex()330
.id("call-fullscreen-overlay")331
.occlude()332
.absolute()333
.top_0()334
.left_0()335
.size_full()336
.bg(theme::background())337
.child(view)338
.into_any_element()339
}@@ -0,0 +1,231 @@
1
use app_ui_kit::layout::ISLAND_GAP;
2
use gpui_kit::component::{TitleBar, elevation, h_flex, v_flex};
3
use gpui_kit::prelude::FluentBuilder as _;
4
use gpui_kit::*;
5
6
use super::call_end_view::render_call_end;
7
use super::call_pop_out::zoom_listener;
8
use super::call_stage::render_stage_overlay;
9
use super::call_view::render_call_view;
10
use super::conversation::ConversationView;
11
use super::actions::ToggleCallMute;
12
use super::shortcuts::{
13
HangUpCall, OpenLobbyList, PushToTalk, ToggleCallCamera, ToggleCallFullscreen, ToggleCallHand,
14
ToggleCallShare, ZoomShareIn, ZoomShareOut, ZoomShareReset,
15
};
16
use super::title_bar::{TITLE_BAR_HEIGHT, app_icon_image};
17
use crate::app_state::{AppState, Selection};
18
use crate::call::ZoomStep;
19
use crate::theme;
20
21
pub const CALL_WINDOW_TAG: &str = "call-window";
22
pub const CALL_WINDOW_SIZE: (f32, f32) = (1180., 760.);
23
pub const CALL_WINDOW_MIN_SIZE: (f32, f32) = (560., 420.);
24
const FALLBACK_TITLE: &str = "Call";
25
const KEY_CONTEXT: &str = "CallWindow";
26
const APP_ICON_SIZE: f32 = 18.;
27
28
pub fn call_window_title(state: &AppState) -> String {
29
state
30
.call
31
.as_ref()
32
.map(|call| call.model.title.clone())
33
.filter(|title| !title.is_empty())
34
.unwrap_or_else(|| FALLBACK_TITLE.to_owned())
35
}
36
37
/// The meeting window: like Teams, a call or meeting runs in its own window and the main window stays free for chats.
38
pub struct CallWindowView {
39
app: Entity<AppState>,
40
focus: FocusHandle,
41
call_chat: Option<(String, Entity<ConversationView>)>,
42
fullscreen: bool,
43
was_fullscreen: bool,
44
_app_subscription: Subscription,
45
_media_subscription: Option<Subscription>,
46
}
47
48
impl CallWindowView {
49
pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
50
let app_subscription = cx.observe(&app, |_, _, cx| cx.notify());
51
let media_subscription = app
52
.read(cx)
53
.call_media
54
.clone()
55
.map(|media| cx.observe(&media, |_, _, cx| cx.notify()));
56
let closing_app = app.clone();
57
window.on_window_should_close(cx, move |_, cx| {
58
leave_or_dismiss(&closing_app, cx);
59
true
60
});
61
let focus = cx.focus_handle();
62
window.focus(&focus, cx);
63
CallWindowView {
64
app,
65
focus,
66
call_chat: None,
67
fullscreen: false,
68
was_fullscreen: false,
69
_app_subscription: app_subscription,
70
_media_subscription: media_subscription,
71
}
72
}
73
74
fn sync_call_chat(&mut self, thread: Option<String>, window: &mut Window, cx: &mut Context<Self>) {
75
match (thread, &self.call_chat) {
76
(Some(wanted), Some((open, _))) if &wanted == open => {}
77
(Some(wanted), _) => {
78
let selection = Selection::Chat(wanted.clone());
79
let app = self.app.clone();
80
let view = cx.new(|cx| ConversationView::pinned_to(app, selection, window, cx));
81
self.call_chat = Some((wanted, view));
82
}
83
(None, _) => self.call_chat = None,
84
}
85
}
86
87
fn sync_fullscreen(&mut self, wanted: bool, window: &mut Window) {
88
if wanted == self.fullscreen {
89
return;
90
}
91
self.fullscreen = wanted;
92
if wanted {
93
self.was_fullscreen = window.is_fullscreen();
94
}
95
if wanted != window.is_fullscreen() && (wanted || !self.was_fullscreen) {
96
window.toggle_fullscreen();
97
}
98
}
99
100
fn title_bar(&self, title: String, cx: &App) -> impl IntoElement {
101
let app_icon = crate::active_appearance::current(cx).app_icon;
102
let app = self.app.clone();
103
TitleBar::new()
104
.h(px(TITLE_BAR_HEIGHT))
105
.border_b_0()
106
.bg(theme::background())
107
.on_close_window(move |_, window, cx| {
108
leave_or_dismiss(&app, cx);
109
window.remove_window();
110
})
111
.child(
112
h_flex()
113
.debug_selector(|| "call-window/title-bar".into())
114
.flex_1()
115
.min_w_0()
116
.h_full()
117
.gap(px(12.))
118
.items_center()
119
.child(img(app_icon_image(app_icon)).size(px(APP_ICON_SIZE)).flex_none())
120
.child(
121
div()
122
.min_w_0()
123
.truncate()
124
.text_size(px(13.))
125
.font_weight(FontWeight::SEMIBOLD)
126
.text_color(theme::text())
127
.child(title),
128
),
129
)
130
}
131
}
132
133
fn call_action<A: Action>(
134
app: &Entity<AppState>,
135
action: fn(&mut AppState, &mut Context<AppState>),
136
) -> impl Fn(&A, &mut Window, &mut App) + 'static {
137
let app = app.clone();
138
move |_, _, cx| app.update(cx, |state, cx| action(state, cx))
139
}
140
141
fn leave_or_dismiss(app: &Entity<AppState>, cx: &mut App) {
142
app.update(cx, |state, cx| {
143
if state.call.is_some() {
144
state.leave_call(cx);
145
} else {
146
state.dismiss_call_end(cx);
147
}
148
});
149
}
150
151
impl Focusable for CallWindowView {
152
fn focus_handle(&self, _: &App) -> FocusHandle {
153
self.focus.clone()
154
}
155
}
156
157
impl Render for CallWindowView {
158
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
159
let chat_thread = self.app.read(cx).call_chat_thread();
160
self.sync_call_chat(chat_thread, window, cx);
161
let state = self.app.read(cx);
162
let fullscreen = state.call_fullscreen();
163
let open_dialogs = [
164
state.transfer_picker.is_some(),
165
state.call.as_ref().is_some_and(|call| call.options_dialog.is_some()),
166
state.call.as_ref().is_some_and(|call| call.model.consent_required),
167
]
168
.into_iter()
169
.filter(|open| *open)
170
.count();
171
let title = call_window_title(state);
172
window.set_window_title(&title);
173
let window_width = f32::from(window.viewport_size().width);
174
let stage_width = window_width - 2. * ISLAND_GAP;
175
let chat_panel = self.call_chat.as_ref().map(|(_, view)| view.clone().into());
176
let stage = render_call_view(&self.app, state, chat_panel, fullscreen, stage_width)
177
.or_else(|| render_call_end(&self.app, state));
178
let stage_overlay = render_stage_overlay(&self.app, state);
179
elevation::set_app_modal_layers(window, open_dialogs, cx);
180
self.sync_fullscreen(fullscreen, window);
181
let title_bar = (!fullscreen).then(|| self.title_bar(title, cx));
182
let release_app = self.app.clone();
183
let modifier_app = self.app.clone();
184
let escape_app = self.app.clone();
185
v_flex()
186
.id(CALL_WINDOW_TAG)
187
.debug_selector(|| CALL_WINDOW_TAG.into())
188
.key_context(KEY_CONTEXT)
189
.track_focus(&self.focus)
190
.size_full()
191
.bg(theme::background())
192
.text_color(theme::text())
193
.text_size(px(14.))
194
.on_action(call_action::<ToggleCallMute>(&self.app, AppState::toggle_call_mute))
195
.on_action(call_action::<PushToTalk>(&self.app, AppState::press_push_to_talk))
196
.on_action(call_action::<HangUpCall>(&self.app, AppState::leave_call))
197
.on_action(call_action::<ToggleCallCamera>(&self.app, AppState::toggle_call_camera))
198
.on_action(call_action::<ToggleCallShare>(&self.app, AppState::toggle_call_share))
199
.on_action(call_action::<ToggleCallHand>(&self.app, AppState::toggle_call_hand))
200
.on_action(call_action::<OpenLobbyList>(&self.app, AppState::open_call_lobby_list))
201
.on_action(call_action::<ToggleCallFullscreen>(&self.app, AppState::toggle_call_fullscreen))
202
.on_action(zoom_listener::<ZoomShareIn>(&self.app, ZoomStep::In))
203
.on_action(zoom_listener::<ZoomShareOut>(&self.app, ZoomStep::Out))
204
.on_action(zoom_listener::<ZoomShareReset>(&self.app, ZoomStep::Reset))
205
.on_key_down(move |event: &KeyDownEvent, _, cx| {
206
if event.keystroke.key == "escape" {
207
escape_app.update(cx, |state, cx| state.escape_call_fullscreen(cx));
208
}
209
})
210
.on_key_up(move |event: &KeyUpEvent, _, cx| {
211
if event.keystroke.key == "space" {
212
release_app.update(cx, |state, cx| state.release_push_to_talk(cx));
213
}
214
})
215
.on_modifiers_changed(move |event: &ModifiersChangedEvent, _, cx| {
216
if !event.modifiers.control {
217
modifier_app.update(cx, |state, cx| state.release_push_to_talk(cx));
218
}
219
})
220
.children(title_bar)
221
.child(
222
h_flex()
223
.flex_1()
224
.min_h_0()
225
.w_full()
226
.when(!fullscreen, |row| row.px(px(ISLAND_GAP)).pb(px(ISLAND_GAP)))
227
.children(stage),
228
)
229
.children(stage_overlay)
230
}
231
}
@@ -0,0 +1,231 @@1
use app_ui_kit::layout::ISLAND_GAP;2
use gpui_kit::component::{TitleBar, elevation, h_flex, v_flex};3
use gpui_kit::prelude::FluentBuilder as _;4
use gpui_kit::*;5
6
use super::call_end_view::render_call_end;7
use super::call_pop_out::zoom_listener;8
use super::call_stage::render_stage_overlay;9
use super::call_view::render_call_view;10
use super::conversation::ConversationView;11
use super::actions::ToggleCallMute;12
use super::shortcuts::{13
HangUpCall, OpenLobbyList, PushToTalk, ToggleCallCamera, ToggleCallFullscreen, ToggleCallHand,14
ToggleCallShare, ZoomShareIn, ZoomShareOut, ZoomShareReset,15
};16
use super::title_bar::{TITLE_BAR_HEIGHT, app_icon_image};17
use crate::app_state::{AppState, Selection};18
use crate::call::ZoomStep;19
use crate::theme;20
21
pub const CALL_WINDOW_TAG: &str = "call-window";22
pub const CALL_WINDOW_SIZE: (f32, f32) = (1180., 760.);23
pub const CALL_WINDOW_MIN_SIZE: (f32, f32) = (560., 420.);24
const FALLBACK_TITLE: &str = "Call";25
const KEY_CONTEXT: &str = "CallWindow";26
const APP_ICON_SIZE: f32 = 18.;27
28
pub fn call_window_title(state: &AppState) -> String {29
state30
.call31
.as_ref()32
.map(|call| call.model.title.clone())33
.filter(|title| !title.is_empty())34
.unwrap_or_else(|| FALLBACK_TITLE.to_owned())35
}36
37
/// The meeting window: like Teams, a call or meeting runs in its own window and the main window stays free for chats.38
pub struct CallWindowView {39
app: Entity<AppState>,40
focus: FocusHandle,41
call_chat: Option<(String, Entity<ConversationView>)>,42
fullscreen: bool,43
was_fullscreen: bool,44
_app_subscription: Subscription,45
_media_subscription: Option<Subscription>,46
}47
48
impl CallWindowView {49
pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {50
let app_subscription = cx.observe(&app, |_, _, cx| cx.notify());51
let media_subscription = app52
.read(cx)53
.call_media54
.clone()55
.map(|media| cx.observe(&media, |_, _, cx| cx.notify()));56
let closing_app = app.clone();57
window.on_window_should_close(cx, move |_, cx| {58
leave_or_dismiss(&closing_app, cx);59
true60
});61
let focus = cx.focus_handle();62
window.focus(&focus, cx);63
CallWindowView {64
app,65
focus,66
call_chat: None,67
fullscreen: false,68
was_fullscreen: false,69
_app_subscription: app_subscription,70
_media_subscription: media_subscription,71
}72
}73
74
fn sync_call_chat(&mut self, thread: Option<String>, window: &mut Window, cx: &mut Context<Self>) {75
match (thread, &self.call_chat) {76
(Some(wanted), Some((open, _))) if &wanted == open => {}77
(Some(wanted), _) => {78
let selection = Selection::Chat(wanted.clone());79
let app = self.app.clone();80
let view = cx.new(|cx| ConversationView::pinned_to(app, selection, window, cx));81
self.call_chat = Some((wanted, view));82
}83
(None, _) => self.call_chat = None,84
}85
}86
87
fn sync_fullscreen(&mut self, wanted: bool, window: &mut Window) {88
if wanted == self.fullscreen {89
return;90
}91
self.fullscreen = wanted;92
if wanted {93
self.was_fullscreen = window.is_fullscreen();94
}95
if wanted != window.is_fullscreen() && (wanted || !self.was_fullscreen) {96
window.toggle_fullscreen();97
}98
}99
100
fn title_bar(&self, title: String, cx: &App) -> impl IntoElement {101
let app_icon = crate::active_appearance::current(cx).app_icon;102
let app = self.app.clone();103
TitleBar::new()104
.h(px(TITLE_BAR_HEIGHT))105
.border_b_0()106
.bg(theme::background())107
.on_close_window(move |_, window, cx| {108
leave_or_dismiss(&app, cx);109
window.remove_window();110
})111
.child(112
h_flex()113
.debug_selector(|| "call-window/title-bar".into())114
.flex_1()115
.min_w_0()116
.h_full()117
.gap(px(12.))118
.items_center()119
.child(img(app_icon_image(app_icon)).size(px(APP_ICON_SIZE)).flex_none())120
.child(121
div()122
.min_w_0()123
.truncate()124
.text_size(px(13.))125
.font_weight(FontWeight::SEMIBOLD)126
.text_color(theme::text())127
.child(title),128
),129
)130
}131
}132
133
fn call_action<A: Action>(134
app: &Entity<AppState>,135
action: fn(&mut AppState, &mut Context<AppState>),136
) -> impl Fn(&A, &mut Window, &mut App) + 'static {137
let app = app.clone();138
move |_, _, cx| app.update(cx, |state, cx| action(state, cx))139
}140
141
fn leave_or_dismiss(app: &Entity<AppState>, cx: &mut App) {142
app.update(cx, |state, cx| {143
if state.call.is_some() {144
state.leave_call(cx);145
} else {146
state.dismiss_call_end(cx);147
}148
});149
}150
151
impl Focusable for CallWindowView {152
fn focus_handle(&self, _: &App) -> FocusHandle {153
self.focus.clone()154
}155
}156
157
impl Render for CallWindowView {158
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {159
let chat_thread = self.app.read(cx).call_chat_thread();160
self.sync_call_chat(chat_thread, window, cx);161
let state = self.app.read(cx);162
let fullscreen = state.call_fullscreen();163
let open_dialogs = [164
state.transfer_picker.is_some(),165
state.call.as_ref().is_some_and(|call| call.options_dialog.is_some()),166
state.call.as_ref().is_some_and(|call| call.model.consent_required),167
]168
.into_iter()169
.filter(|open| *open)170
.count();171
let title = call_window_title(state);172
window.set_window_title(&title);173
let window_width = f32::from(window.viewport_size().width);174
let stage_width = window_width - 2. * ISLAND_GAP;175
let chat_panel = self.call_chat.as_ref().map(|(_, view)| view.clone().into());176
let stage = render_call_view(&self.app, state, chat_panel, fullscreen, stage_width)177
.or_else(|| render_call_end(&self.app, state));178
let stage_overlay = render_stage_overlay(&self.app, state);179
elevation::set_app_modal_layers(window, open_dialogs, cx);180
self.sync_fullscreen(fullscreen, window);181
let title_bar = (!fullscreen).then(|| self.title_bar(title, cx));182
let release_app = self.app.clone();183
let modifier_app = self.app.clone();184
let escape_app = self.app.clone();185
v_flex()186
.id(CALL_WINDOW_TAG)187
.debug_selector(|| CALL_WINDOW_TAG.into())188
.key_context(KEY_CONTEXT)189
.track_focus(&self.focus)190
.size_full()191
.bg(theme::background())192
.text_color(theme::text())193
.text_size(px(14.))194
.on_action(call_action::<ToggleCallMute>(&self.app, AppState::toggle_call_mute))195
.on_action(call_action::<PushToTalk>(&self.app, AppState::press_push_to_talk))196
.on_action(call_action::<HangUpCall>(&self.app, AppState::leave_call))197
.on_action(call_action::<ToggleCallCamera>(&self.app, AppState::toggle_call_camera))198
.on_action(call_action::<ToggleCallShare>(&self.app, AppState::toggle_call_share))199
.on_action(call_action::<ToggleCallHand>(&self.app, AppState::toggle_call_hand))200
.on_action(call_action::<OpenLobbyList>(&self.app, AppState::open_call_lobby_list))201
.on_action(call_action::<ToggleCallFullscreen>(&self.app, AppState::toggle_call_fullscreen))202
.on_action(zoom_listener::<ZoomShareIn>(&self.app, ZoomStep::In))203
.on_action(zoom_listener::<ZoomShareOut>(&self.app, ZoomStep::Out))204
.on_action(zoom_listener::<ZoomShareReset>(&self.app, ZoomStep::Reset))205
.on_key_down(move |event: &KeyDownEvent, _, cx| {206
if event.keystroke.key == "escape" {207
escape_app.update(cx, |state, cx| state.escape_call_fullscreen(cx));208
}209
})210
.on_key_up(move |event: &KeyUpEvent, _, cx| {211
if event.keystroke.key == "space" {212
release_app.update(cx, |state, cx| state.release_push_to_talk(cx));213
}214
})215
.on_modifiers_changed(move |event: &ModifiersChangedEvent, _, cx| {216
if !event.modifiers.control {217
modifier_app.update(cx, |state, cx| state.release_push_to_talk(cx));218
}219
})220
.children(title_bar)221
.child(222
h_flex()223
.flex_1()224
.min_h_0()225
.w_full()226
.when(!fullscreen, |row| row.px(px(ISLAND_GAP)).pb(px(ISLAND_GAP)))227
.children(stage),228
)229
.children(stage_overlay)230
}231
}@@ -503,10 +503,6 @@ impl ConversationView {
503
503
Self::build(app, None, window, cx)
504
504
}
505
505
506
pub fn timeline_bounds(&self) -> TimelineBounds {
507
self.timeline_bounds.clone()
508
}
509
510
506
pub fn pinned_to(
511
507
app: Entity<AppState>,
512
508
selection: Selection,
@@ -2269,9 +2265,6 @@ impl ConversationView {
2269
2265
return;
2270
2266
}
2271
2267
let state = self.app.read(cx);
2272
if state.viewing_call() && !self.pinned {
2273
return;
2274
}
2275
2268
let Some(selection) = self.current.as_ref().map(|c| c.selection.clone()) else {
2276
2269
return;
2277
2270
};
@@ -503,10 +503,6 @@ impl ConversationView {503
Self::build(app, None, window, cx)503
Self::build(app, None, window, cx)504
}504
}505
505
506
pub fn timeline_bounds(&self) -> TimelineBounds {507
self.timeline_bounds.clone()508
}509
510
pub fn pinned_to(506
pub fn pinned_to(511
app: Entity<AppState>,507
app: Entity<AppState>,512
selection: Selection,508
selection: Selection,@@ -2269,9 +2265,6 @@ impl ConversationView {2269
return;2265
return;2270
}2266
}2271
let state = self.app.read(cx);2267
let state = self.app.read(cx);2272
if state.viewing_call() && !self.pinned {2273
return;2274
}2275
let Some(selection) = self.current.as_ref().map(|c| c.selection.clone()) else {2268
let Some(selection) = self.current.as_ref().map(|c| c.selection.clone()) else {2276
return;2269
return;2277
};2270
};@@ -14,7 +14,6 @@ pub mod call_controls;
14
14
pub mod call_extras;
15
15
pub mod call_health;
16
16
pub mod call_layouts;
17
pub mod call_mini;
18
17
pub mod call_mini_window;
19
18
pub mod call_organizer;
20
19
pub mod call_people;
@@ -24,6 +23,7 @@ pub mod call_record;
24
23
pub mod call_stage;
25
24
pub mod call_transcript;
26
25
pub mod call_view;
26
pub mod call_window;
27
27
pub mod call_view_menu;
28
28
pub mod calendar_date_picker;
29
29
pub mod calendar_month;
@@ -14,7 +14,6 @@ pub mod call_controls;14
pub mod call_extras;14
pub mod call_extras;15
pub mod call_health;15
pub mod call_health;16
pub mod call_layouts;16
pub mod call_layouts;17
pub mod call_mini;18
pub mod call_mini_window;17
pub mod call_mini_window;19
pub mod call_organizer;18
pub mod call_organizer;20
pub mod call_people;19
pub mod call_people;@@ -24,6 +23,7 @@ pub mod call_record;24
pub mod call_stage;23
pub mod call_stage;25
pub mod call_transcript;24
pub mod call_transcript;26
pub mod call_view;25
pub mod call_view;26
pub mod call_window;27
pub mod call_view_menu;27
pub mod call_view_menu;28
pub mod calendar_date_picker;28
pub mod calendar_date_picker;29
pub mod calendar_month;29
pub mod calendar_month;@@ -6,10 +6,6 @@ use gpui_kit::component::{elevation, h_flex, v_flex};
6
6
use gpui_kit::*;
7
7
8
8
use super::activity_panel::{ActivityPanel, ActivityPanelEvent};
9
use super::call_mini::CallMiniView;
10
use super::call_stage::{render_call_overlay, render_stage_overlay};
11
use super::call_end_view::render_call_end;
12
use super::call_view::{CHAT_PANEL_WIDTH, OVERLAY_BELOW as CALL_COLUMN_MIN, render_call_view};
13
9
use super::actions::{NewChat, OpenSwitcher, ReplyToHovered, ToggleCallMute};
14
10
use super::calendar_view::CalendarView;
15
11
use super::conversation::ConversationView;
@@ -27,7 +23,7 @@ use super::shortcuts::{
27
23
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,
28
24
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,
29
25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, OpenCalendar, PreviousConversation, PushToTalk,
30
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera,
31
27
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,
32
28
ZoomShareReset,
33
29
};
@@ -37,7 +33,7 @@ use super::chat_pop_out;
37
33
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};
38
34
use super::sidebar::{SidebarEvent, SidebarTab, SidebarView};
39
35
use app_ui_kit::render::hooks::RenderHooks;
40
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
36
use app_ui_kit::layout::{ISLAND_GAP, SIDEBAR_WIDTH};
41
37
use super::connection_banner::render_connection_banner;
42
38
use super::notice_toast::NoticeToasts;
43
39
use super::status_menu::{own_status_button, settings_more_button};
@@ -84,14 +80,6 @@ pub struct Startup {
84
80
pub launched_by_autostart: bool,
85
81
}
86
82
87
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;
88
89
pub fn sidebar_hidden_in_call(window_width: f32, panel_open: bool) -> bool {
90
let panel_width = if panel_open { CHAT_PANEL_WIDTH + ISLAND_GAP } else { 0. };
91
window_width < SIDEBAR_HIDDEN_BELOW
92
|| window_width - RAIL_WIDTH - SIDEBAR_WIDTH - 2. * ISLAND_GAP - panel_width < CALL_COLUMN_MIN
93
}
94
95
83
pub struct UserInputHandle(pub Arc<UserInput>);
96
84
97
85
impl Global for UserInputHandle {}
@@ -182,7 +170,6 @@ pub struct AppShell {
182
170
calls_page: Entity<CallsPage>,
183
171
shown_quick_view: Option<QuickView>,
184
172
conversation: Entity<ConversationView>,
185
call_chat: Option<(String, Entity<ConversationView>)>,
186
173
prejoin: Option<Entity<PrejoinView>>,
187
174
switcher: Option<Entity<Switcher>>,
188
175
notifications: Entity<NotificationCenter>,
@@ -195,15 +182,11 @@ pub struct AppShell {
195
182
settings_dialog: Option<Entity<SettingsDialog>>,
196
183
profile_card: Option<Entity<ProfileCard>>,
197
184
focus_handle: FocusHandle,
198
call_window_fullscreen: bool,
199
window_was_fullscreen: bool,
200
185
open_target: Option<OpenTarget>,
201
186
update: UpdateStatus,
202
187
toasts: NoticeToasts,
203
188
user_input: Arc<UserInput>,
204
189
_subscription: Subscription,
205
call_mini: Entity<CallMiniView>,
206
_call_media_observation: Subscription,
207
190
_panel_subscriptions: [Subscription; 2],
208
191
_sidebar_subscription: Subscription,
209
192
_agents_subscription: Option<Subscription>,
@@ -220,24 +203,6 @@ impl AppShell {
220
203
cx.notify();
221
204
}
222
205
223
fn sync_call_chat(
224
&mut self,
225
thread: Option<String>,
226
window: &mut Window,
227
cx: &mut Context<Self>,
228
) {
229
match (thread, &self.call_chat) {
230
(Some(wanted), Some((open, _))) if &wanted == open => {}
231
(Some(wanted), _) => {
232
let app = self.state.clone();
233
let selection = Selection::Chat(wanted.clone());
234
let view = cx.new(|cx| ConversationView::pinned_to(app, selection, window, cx));
235
self.call_chat = Some((wanted, view));
236
}
237
(None, _) => self.call_chat = None,
238
}
239
}
240
241
206
fn focus_opened_quick_view(&mut self, window: &mut Window, cx: &mut Context<Self>) {
242
207
let quick_view = self.state.read(cx).quick_view;
243
208
if std::mem::replace(&mut self.shown_quick_view, quick_view) != quick_view
@@ -284,11 +249,6 @@ impl AppShell {
284
249
) -> Self {
285
250
let call_media = cx.new(|_| CallMedia);
286
251
state.update(cx, |state, _| state.call_media = Some(call_media.clone()));
287
let call_media_observation = cx.observe(&call_media, |this, _, cx| {
288
if this.state.read(cx).viewing_call() {
289
cx.notify();
290
}
291
});
292
252
let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
293
253
let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
294
254
let quick_pane = cx.new(|cx| QuickViewPane::new(state.clone(), activity.clone(), cx));
@@ -370,8 +330,6 @@ impl AppShell {
370
330
let calendar = cx.new(|cx| CalendarView::new(state.clone(), cx));
371
331
let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
372
332
let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
373
let timeline = conversation.read(cx).timeline_bounds();
374
let call_mini = cx.new(|cx| CallMiniView::new(state.clone(), timeline, cx));
375
333
let subscription =
376
334
cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {
377
335
if matches!(event, AppEvent::Sidebar | AppEvent::Status) {
@@ -436,7 +394,6 @@ impl AppShell {
436
394
calls_page,
437
395
shown_quick_view: None,
438
396
conversation,
439
call_chat: None,
440
397
prejoin: None,
441
398
switcher: None,
442
399
notifications,
@@ -449,15 +406,11 @@ impl AppShell {
449
406
settings_dialog: None,
450
407
profile_card: None,
451
408
focus_handle,
452
call_window_fullscreen: false,
453
window_was_fullscreen: false,
454
409
open_target,
455
410
update: UpdateStatus::UpToDate,
456
411
toasts: NoticeToasts::default(),
457
412
user_input,
458
413
_subscription: subscription,
459
call_mini,
460
_call_media_observation: call_media_observation,
461
414
_panel_subscriptions: panel_subscriptions,
462
415
_sidebar_subscription: sidebar_subscription,
463
416
_agents_subscription: agents_subscription,
@@ -858,19 +811,6 @@ impl AppShell {
858
811
});
859
812
}
860
813
861
fn sync_window_fullscreen(&mut self, wanted: bool, window: &mut Window) {
862
if wanted == self.call_window_fullscreen {
863
return;
864
}
865
self.call_window_fullscreen = wanted;
866
if wanted {
867
self.window_was_fullscreen = window.is_fullscreen();
868
}
869
if wanted != window.is_fullscreen() && (wanted || !self.window_was_fullscreen) {
870
window.toggle_fullscreen();
871
}
872
}
873
874
814
fn close_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
875
815
if self.image_viewer.take().is_some() {
876
816
window.focus(&self.focus_handle, cx);
@@ -927,7 +867,6 @@ impl AppShell {
927
867
impl AppShell {
928
868
fn islands(
929
869
&self,
930
call_view: Option<AnyElement>,
931
870
show_sidebar: bool,
932
871
calendar_open: bool,
933
872
quick_view_open: bool,
@@ -957,27 +896,26 @@ impl AppShell {
957
896
)
958
897
}),
959
898
)
960
.child(match (call_view, self.prejoin.clone()) {
961
(Some(call_view), _) => call_view,
962
(None, Some(prejoin)) => prejoin
899
.child(match self.prejoin.clone() {
900
Some(prejoin) => prejoin
963
901
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())
964
902
.into_any_element(),
965
(None, None) if calls_open => self
903
None if calls_open => self
966
904
.calls_page
967
905
.clone()
968
906
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())
969
907
.into_any_element(),
970
(None, None) if quick_view_open => self
908
None if quick_view_open => self
971
909
.quick_pane
972
910
.clone()
973
911
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())
974
912
.into_any_element(),
975
(None, None) if calendar_open => self
913
None if calendar_open => self
976
914
.calendar
977
915
.clone()
978
916
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())
979
917
.into_any_element(),
980
(None, None) => self
918
None => self
981
919
.conversation
982
920
.clone()
983
921
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())
@@ -988,12 +926,6 @@ impl AppShell {
988
926
989
927
impl Render for AppShell {
990
928
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
991
let viewed_call = self
992
.state
993
.read(cx)
994
.call
995
.as_ref()
996
.filter(|call| call.viewing);
997
929
let open_dialogs = [
998
930
self.state.read(cx).task_dialog.is_some(),
999
931
self.forward_dialog.is_some(),
@@ -1001,9 +933,6 @@ impl Render for AppShell {
1001
933
self.shortcuts_dialog.is_some(),
1002
934
self.agent_dialog.is_some(),
1003
935
self.settings_dialog.is_some(),
1004
viewed_call.is_some() && self.state.read(cx).transfer_picker.is_some(),
1005
viewed_call.is_some_and(|call| call.options_dialog.is_some()),
1006
viewed_call.is_some_and(|call| call.model.consent_required),
1007
936
]
1008
937
.into_iter()
1009
938
.filter(|open| *open)
@@ -1032,8 +961,6 @@ impl Render for AppShell {
1032
961
});
1033
962
});
1034
963
}
1035
let chat_thread = self.state.read(cx).call_chat_thread();
1036
self.sync_call_chat(chat_thread, window, cx);
1037
964
self.sync_prejoin(window, cx);
1038
965
let notice = self.state.read(cx).notice.clone();
1039
966
self.toasts.sync(&self.state, notice.as_ref(), window, cx);
@@ -1042,43 +969,14 @@ impl Render for AppShell {
1042
969
_ => None,
1043
970
};
1044
971
self.toasts.update_failed(update_failure.as_deref(), window, cx);
1045
let chat_panel = self.call_chat.as_ref().map(|(_, view)| view.clone().into());
1046
972
let calendar_tab = self.sidebar.read(cx).tab() == SidebarTab::Calendar;
1047
973
let chats_tab = self.sidebar.read(cx).tab() == SidebarTab::Chats;
1048
974
let calls_tab = self.sidebar.read(cx).tab() == SidebarTab::Calls;
1049
975
let state = self.state.read(cx);
1050
let call_fullscreen = state.call_fullscreen();
1051
let window_width = f32::from(window.viewport_size().width);
1052
let panel_open = state
1053
.call
1054
.as_ref()
1055
.is_some_and(|call| call.chat_open || call.people_open || call.transcript_open);
1056
let calendar_open = calendar_tab && !state.viewing_call();
976
let calendar_open = calendar_tab;
1057
977
let quick_view_open = chats_tab && state.quick_view.is_some();
1058
let calls_open = calls_tab && !state.viewing_call();
1059
let show_sidebar = !calendar_open
1060
&& !calls_open
1061
&& !(state.viewing_call()
1062
&& !call_fullscreen
1063
&& sidebar_hidden_in_call(window_width, panel_open));
1064
let island_width = window_width
1065
- RAIL_WIDTH
1066
- if show_sidebar { SIDEBAR_WIDTH + ISLAND_GAP } else { 0. }
1067
- ISLAND_GAP;
1068
let call_view = render_call_view(&self.state, state, chat_panel, call_fullscreen, island_width)
1069
.filter(|_| state.viewing_call())
1070
.or_else(|| render_call_end(&self.state, state));
1071
let (call_view, call_overlay) = match call_view {
1072
Some(view) if call_fullscreen => (None, Some(render_call_overlay(view))),
1073
view => (view, None),
1074
};
1075
self.sync_window_fullscreen(call_fullscreen, window);
1076
let call_mini = state
1077
.call
1078
.as_ref()
1079
.is_some_and(|call| !call.viewing)
1080
.then(|| self.call_mini.clone());
1081
let stage_overlay = render_stage_overlay(&self.state, state);
978
let calls_open = calls_tab;
979
let show_sidebar = !calendar_open && !calls_open;
1082
980
let banner = state.connection_banner_text().map(|banner| {
1083
981
render_connection_banner(
1084
982
banner,
@@ -1257,14 +1155,6 @@ impl Render for AppShell {
1257
1155
.on_action(cx.listener(|this, _: &StartVideoCall, _, cx| {
1258
1156
this.start_call_in_open_chat(true, cx);
1259
1157
}))
1260
.on_action(cx.listener(|this, _: &ToggleCallFullscreen, _, cx| {
1261
if this.image_viewer.is_some() || !this.state.read(cx).viewing_call() {
1262
cx.propagate();
1263
return;
1264
}
1265
this.state
1266
.update(cx, |state, cx| state.toggle_call_fullscreen(cx));
1267
}))
1268
1158
.on_action(cx.listener(|this, _: &ZoomIn, _, cx| change_zoom(&this.state, WindowZoom::In, cx)))
1269
1159
.on_action(cx.listener(|this, _: &ZoomOut, _, cx| change_zoom(&this.state, WindowZoom::Out, cx)))
1270
1160
.on_action(cx.listener(|this, _: &ZoomReset, _, cx| change_zoom(&this.state, WindowZoom::Reset, cx)))
@@ -1272,7 +1162,7 @@ impl Render for AppShell {
1272
1162
.on_action(zoom_listener::<ZoomShareOut>(&self.state, ZoomStep::Out))
1273
1163
.on_action(zoom_listener::<ZoomShareReset>(&self.state, ZoomStep::Reset))
1274
1164
.on_action(cx.listener(|this, _: &JumpToLastReadOrNewest, _, cx| {
1275
if this.image_viewer.is_some() || this.state.read(cx).viewing_call() {
1165
if this.image_viewer.is_some() {
1276
1166
cx.propagate();
1277
1167
return;
1278
1168
}
@@ -1299,11 +1189,8 @@ impl Render for AppShell {
1299
1189
.size_full()
1300
1190
.child(title_bar)
1301
1191
.children(banner)
1302
.child(self.islands(call_view, show_sidebar, calendar_open, quick_view_open, calls_open)),
1192
.child(self.islands(show_sidebar, calendar_open, quick_view_open, calls_open)),
1303
1193
)
1304
.children(call_mini)
1305
.children(call_overlay)
1306
.children(stage_overlay)
1307
1194
.children(self.image_viewer.clone())
1308
1195
.children(self.switcher.clone())
1309
1196
.children(render_task_dialog(self.state.read(cx), cx))
@@ -6,10 +6,6 @@ use gpui_kit::component::{elevation, h_flex, v_flex};6
use gpui_kit::*;6
use gpui_kit::*;7
7
8
use super::activity_panel::{ActivityPanel, ActivityPanelEvent};8
use super::activity_panel::{ActivityPanel, ActivityPanelEvent};9
use super::call_mini::CallMiniView;10
use super::call_stage::{render_call_overlay, render_stage_overlay};11
use super::call_end_view::render_call_end;12
use super::call_view::{CHAT_PANEL_WIDTH, OVERLAY_BELOW as CALL_COLUMN_MIN, render_call_view};13
use super::actions::{NewChat, OpenSwitcher, ReplyToHovered, ToggleCallMute};9
use super::actions::{NewChat, OpenSwitcher, ReplyToHovered, ToggleCallMute};14
use super::calendar_view::CalendarView;10
use super::calendar_view::CalendarView;15
use super::conversation::ConversationView;11
use super::conversation::ConversationView;@@ -27,7 +23,7 @@ use super::shortcuts::{27
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,23
ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,28
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,24
FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,29
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, OpenCalendar, PreviousConversation, PushToTalk,25
OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, OpenCalendar, PreviousConversation, PushToTalk,30
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,26
Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera,31
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,27
ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,32
ZoomShareReset,28
ZoomShareReset,33
};29
};@@ -37,7 +33,7 @@ use super::chat_pop_out;37
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};33
use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};38
use super::sidebar::{SidebarEvent, SidebarTab, SidebarView};34
use super::sidebar::{SidebarEvent, SidebarTab, SidebarView};39
use app_ui_kit::render::hooks::RenderHooks;35
use app_ui_kit::render::hooks::RenderHooks;40
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};36
use app_ui_kit::layout::{ISLAND_GAP, SIDEBAR_WIDTH};41
use super::connection_banner::render_connection_banner;37
use super::connection_banner::render_connection_banner;42
use super::notice_toast::NoticeToasts;38
use super::notice_toast::NoticeToasts;43
use super::status_menu::{own_status_button, settings_more_button};39
use super::status_menu::{own_status_button, settings_more_button};@@ -84,14 +80,6 @@ pub struct Startup {84
pub launched_by_autostart: bool,80
pub launched_by_autostart: bool,85
}81
}86
82
87
pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;88
89
pub fn sidebar_hidden_in_call(window_width: f32, panel_open: bool) -> bool {90
let panel_width = if panel_open { CHAT_PANEL_WIDTH + ISLAND_GAP } else { 0. };91
window_width < SIDEBAR_HIDDEN_BELOW92
|| window_width - RAIL_WIDTH - SIDEBAR_WIDTH - 2. * ISLAND_GAP - panel_width < CALL_COLUMN_MIN93
}94
95
pub struct UserInputHandle(pub Arc<UserInput>);83
pub struct UserInputHandle(pub Arc<UserInput>);96
84
97
impl Global for UserInputHandle {}85
impl Global for UserInputHandle {}@@ -182,7 +170,6 @@ pub struct AppShell {182
calls_page: Entity<CallsPage>,170
calls_page: Entity<CallsPage>,183
shown_quick_view: Option<QuickView>,171
shown_quick_view: Option<QuickView>,184
conversation: Entity<ConversationView>,172
conversation: Entity<ConversationView>,185
call_chat: Option<(String, Entity<ConversationView>)>,186
prejoin: Option<Entity<PrejoinView>>,173
prejoin: Option<Entity<PrejoinView>>,187
switcher: Option<Entity<Switcher>>,174
switcher: Option<Entity<Switcher>>,188
notifications: Entity<NotificationCenter>,175
notifications: Entity<NotificationCenter>,@@ -195,15 +182,11 @@ pub struct AppShell {195
settings_dialog: Option<Entity<SettingsDialog>>,182
settings_dialog: Option<Entity<SettingsDialog>>,196
profile_card: Option<Entity<ProfileCard>>,183
profile_card: Option<Entity<ProfileCard>>,197
focus_handle: FocusHandle,184
focus_handle: FocusHandle,198
call_window_fullscreen: bool,199
window_was_fullscreen: bool,200
open_target: Option<OpenTarget>,185
open_target: Option<OpenTarget>,201
update: UpdateStatus,186
update: UpdateStatus,202
toasts: NoticeToasts,187
toasts: NoticeToasts,203
user_input: Arc<UserInput>,188
user_input: Arc<UserInput>,204
_subscription: Subscription,189
_subscription: Subscription,205
call_mini: Entity<CallMiniView>,206
_call_media_observation: Subscription,207
_panel_subscriptions: [Subscription; 2],190
_panel_subscriptions: [Subscription; 2],208
_sidebar_subscription: Subscription,191
_sidebar_subscription: Subscription,209
_agents_subscription: Option<Subscription>,192
_agents_subscription: Option<Subscription>,@@ -220,24 +203,6 @@ impl AppShell {220
cx.notify();203
cx.notify();221
}204
}222
205
223
fn sync_call_chat(224
&mut self,225
thread: Option<String>,226
window: &mut Window,227
cx: &mut Context<Self>,228
) {229
match (thread, &self.call_chat) {230
(Some(wanted), Some((open, _))) if &wanted == open => {}231
(Some(wanted), _) => {232
let app = self.state.clone();233
let selection = Selection::Chat(wanted.clone());234
let view = cx.new(|cx| ConversationView::pinned_to(app, selection, window, cx));235
self.call_chat = Some((wanted, view));236
}237
(None, _) => self.call_chat = None,238
}239
}240
241
fn focus_opened_quick_view(&mut self, window: &mut Window, cx: &mut Context<Self>) {206
fn focus_opened_quick_view(&mut self, window: &mut Window, cx: &mut Context<Self>) {242
let quick_view = self.state.read(cx).quick_view;207
let quick_view = self.state.read(cx).quick_view;243
if std::mem::replace(&mut self.shown_quick_view, quick_view) != quick_view208
if std::mem::replace(&mut self.shown_quick_view, quick_view) != quick_view@@ -284,11 +249,6 @@ impl AppShell {284
) -> Self {249
) -> Self {285
let call_media = cx.new(|_| CallMedia);250
let call_media = cx.new(|_| CallMedia);286
state.update(cx, |state, _| state.call_media = Some(call_media.clone()));251
state.update(cx, |state, _| state.call_media = Some(call_media.clone()));287
let call_media_observation = cx.observe(&call_media, |this, _, cx| {288
if this.state.read(cx).viewing_call() {289
cx.notify();290
}291
});292
let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));252
let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));293
let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));253
let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));294
let quick_pane = cx.new(|cx| QuickViewPane::new(state.clone(), activity.clone(), cx));254
let quick_pane = cx.new(|cx| QuickViewPane::new(state.clone(), activity.clone(), cx));@@ -370,8 +330,6 @@ impl AppShell {370
let calendar = cx.new(|cx| CalendarView::new(state.clone(), cx));330
let calendar = cx.new(|cx| CalendarView::new(state.clone(), cx));371
let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));331
let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));372
let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));332
let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));373
let timeline = conversation.read(cx).timeline_bounds();374
let call_mini = cx.new(|cx| CallMiniView::new(state.clone(), timeline, cx));375
let subscription =333
let subscription =376
cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {334
cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {377
if matches!(event, AppEvent::Sidebar | AppEvent::Status) {335
if matches!(event, AppEvent::Sidebar | AppEvent::Status) {@@ -436,7 +394,6 @@ impl AppShell {436
calls_page,394
calls_page,437
shown_quick_view: None,395
shown_quick_view: None,438
conversation,396
conversation,439
call_chat: None,440
prejoin: None,397
prejoin: None,441
switcher: None,398
switcher: None,442
notifications,399
notifications,@@ -449,15 +406,11 @@ impl AppShell {449
settings_dialog: None,406
settings_dialog: None,450
profile_card: None,407
profile_card: None,451
focus_handle,408
focus_handle,452
call_window_fullscreen: false,453
window_was_fullscreen: false,454
open_target,409
open_target,455
update: UpdateStatus::UpToDate,410
update: UpdateStatus::UpToDate,456
toasts: NoticeToasts::default(),411
toasts: NoticeToasts::default(),457
user_input,412
user_input,458
_subscription: subscription,413
_subscription: subscription,459
call_mini,460
_call_media_observation: call_media_observation,461
_panel_subscriptions: panel_subscriptions,414
_panel_subscriptions: panel_subscriptions,462
_sidebar_subscription: sidebar_subscription,415
_sidebar_subscription: sidebar_subscription,463
_agents_subscription: agents_subscription,416
_agents_subscription: agents_subscription,@@ -858,19 +811,6 @@ impl AppShell {858
});811
});859
}812
}860
813
861
fn sync_window_fullscreen(&mut self, wanted: bool, window: &mut Window) {862
if wanted == self.call_window_fullscreen {863
return;864
}865
self.call_window_fullscreen = wanted;866
if wanted {867
self.window_was_fullscreen = window.is_fullscreen();868
}869
if wanted != window.is_fullscreen() && (wanted || !self.window_was_fullscreen) {870
window.toggle_fullscreen();871
}872
}873
874
fn close_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {814
fn close_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {875
if self.image_viewer.take().is_some() {815
if self.image_viewer.take().is_some() {876
window.focus(&self.focus_handle, cx);816
window.focus(&self.focus_handle, cx);@@ -927,7 +867,6 @@ impl AppShell {927
impl AppShell {867
impl AppShell {928
fn islands(868
fn islands(929
&self,869
&self,930
call_view: Option<AnyElement>,931
show_sidebar: bool,870
show_sidebar: bool,932
calendar_open: bool,871
calendar_open: bool,933
quick_view_open: bool,872
quick_view_open: bool,@@ -957,27 +896,26 @@ impl AppShell {957
)896
)958
}),897
}),959
)898
)960
.child(match (call_view, self.prejoin.clone()) {899
.child(match self.prejoin.clone() {961
(Some(call_view), _) => call_view,900
Some(prejoin) => prejoin962
(None, Some(prejoin)) => prejoin963
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())901
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())964
.into_any_element(),902
.into_any_element(),965
(None, None) if calls_open => self903
None if calls_open => self966
.calls_page904
.calls_page967
.clone()905
.clone()968
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())906
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())969
.into_any_element(),907
.into_any_element(),970
(None, None) if quick_view_open => self908
None if quick_view_open => self971
.quick_pane909
.quick_pane972
.clone()910
.clone()973
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())911
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())974
.into_any_element(),912
.into_any_element(),975
(None, None) if calendar_open => self913
None if calendar_open => self976
.calendar914
.calendar977
.clone()915
.clone()978
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())916
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())979
.into_any_element(),917
.into_any_element(),980
(None, None) => self918
None => self981
.conversation919
.conversation982
.clone()920
.clone()983
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())921
.cached(StyleRefinement::default().flex_1().min_w_0().h_full())@@ -988,12 +926,6 @@ impl AppShell {988
926
989
impl Render for AppShell {927
impl Render for AppShell {990
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {928
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {991
let viewed_call = self992
.state993
.read(cx)994
.call995
.as_ref()996
.filter(|call| call.viewing);997
let open_dialogs = [929
let open_dialogs = [998
self.state.read(cx).task_dialog.is_some(),930
self.state.read(cx).task_dialog.is_some(),999
self.forward_dialog.is_some(),931
self.forward_dialog.is_some(),@@ -1001,9 +933,6 @@ impl Render for AppShell {1001
self.shortcuts_dialog.is_some(),933
self.shortcuts_dialog.is_some(),1002
self.agent_dialog.is_some(),934
self.agent_dialog.is_some(),1003
self.settings_dialog.is_some(),935
self.settings_dialog.is_some(),1004
viewed_call.is_some() && self.state.read(cx).transfer_picker.is_some(),1005
viewed_call.is_some_and(|call| call.options_dialog.is_some()),1006
viewed_call.is_some_and(|call| call.model.consent_required),1007
]936
]1008
.into_iter()937
.into_iter()1009
.filter(|open| *open)938
.filter(|open| *open)@@ -1032,8 +961,6 @@ impl Render for AppShell {1032
});961
});1033
});962
});1034
}963
}1035
let chat_thread = self.state.read(cx).call_chat_thread();1036
self.sync_call_chat(chat_thread, window, cx);1037
self.sync_prejoin(window, cx);964
self.sync_prejoin(window, cx);1038
let notice = self.state.read(cx).notice.clone();965
let notice = self.state.read(cx).notice.clone();1039
self.toasts.sync(&self.state, notice.as_ref(), window, cx);966
self.toasts.sync(&self.state, notice.as_ref(), window, cx);@@ -1042,43 +969,14 @@ impl Render for AppShell {1042
_ => None,969
_ => None,1043
};970
};1044
self.toasts.update_failed(update_failure.as_deref(), window, cx);971
self.toasts.update_failed(update_failure.as_deref(), window, cx);1045
let chat_panel = self.call_chat.as_ref().map(|(_, view)| view.clone().into());1046
let calendar_tab = self.sidebar.read(cx).tab() == SidebarTab::Calendar;972
let calendar_tab = self.sidebar.read(cx).tab() == SidebarTab::Calendar;1047
let chats_tab = self.sidebar.read(cx).tab() == SidebarTab::Chats;973
let chats_tab = self.sidebar.read(cx).tab() == SidebarTab::Chats;1048
let calls_tab = self.sidebar.read(cx).tab() == SidebarTab::Calls;974
let calls_tab = self.sidebar.read(cx).tab() == SidebarTab::Calls;1049
let state = self.state.read(cx);975
let state = self.state.read(cx);1050
let call_fullscreen = state.call_fullscreen();976
let calendar_open = calendar_tab;1051
let window_width = f32::from(window.viewport_size().width);1052
let panel_open = state1053
.call1054
.as_ref()1055
.is_some_and(|call| call.chat_open || call.people_open || call.transcript_open);1056
let calendar_open = calendar_tab && !state.viewing_call();1057
let quick_view_open = chats_tab && state.quick_view.is_some();977
let quick_view_open = chats_tab && state.quick_view.is_some();1058
let calls_open = calls_tab && !state.viewing_call();978
let calls_open = calls_tab;1059
let show_sidebar = !calendar_open979
let show_sidebar = !calendar_open && !calls_open;1060
&& !calls_open1061
&& !(state.viewing_call()1062
&& !call_fullscreen1063
&& sidebar_hidden_in_call(window_width, panel_open));1064
let island_width = window_width1065
- RAIL_WIDTH1066
- if show_sidebar { SIDEBAR_WIDTH + ISLAND_GAP } else { 0. }1067
- ISLAND_GAP;1068
let call_view = render_call_view(&self.state, state, chat_panel, call_fullscreen, island_width)1069
.filter(|_| state.viewing_call())1070
.or_else(|| render_call_end(&self.state, state));1071
let (call_view, call_overlay) = match call_view {1072
Some(view) if call_fullscreen => (None, Some(render_call_overlay(view))),1073
view => (view, None),1074
};1075
self.sync_window_fullscreen(call_fullscreen, window);1076
let call_mini = state1077
.call1078
.as_ref()1079
.is_some_and(|call| !call.viewing)1080
.then(|| self.call_mini.clone());1081
let stage_overlay = render_stage_overlay(&self.state, state);1082
let banner = state.connection_banner_text().map(|banner| {980
let banner = state.connection_banner_text().map(|banner| {1083
render_connection_banner(981
render_connection_banner(1084
banner,982
banner,@@ -1257,14 +1155,6 @@ impl Render for AppShell {1257
.on_action(cx.listener(|this, _: &StartVideoCall, _, cx| {1155
.on_action(cx.listener(|this, _: &StartVideoCall, _, cx| {1258
this.start_call_in_open_chat(true, cx);1156
this.start_call_in_open_chat(true, cx);1259
}))1157
}))1260
.on_action(cx.listener(|this, _: &ToggleCallFullscreen, _, cx| {1261
if this.image_viewer.is_some() || !this.state.read(cx).viewing_call() {1262
cx.propagate();1263
return;1264
}1265
this.state1266
.update(cx, |state, cx| state.toggle_call_fullscreen(cx));1267
}))1268
.on_action(cx.listener(|this, _: &ZoomIn, _, cx| change_zoom(&this.state, WindowZoom::In, cx)))1158
.on_action(cx.listener(|this, _: &ZoomIn, _, cx| change_zoom(&this.state, WindowZoom::In, cx)))1269
.on_action(cx.listener(|this, _: &ZoomOut, _, cx| change_zoom(&this.state, WindowZoom::Out, cx)))1159
.on_action(cx.listener(|this, _: &ZoomOut, _, cx| change_zoom(&this.state, WindowZoom::Out, cx)))1270
.on_action(cx.listener(|this, _: &ZoomReset, _, cx| change_zoom(&this.state, WindowZoom::Reset, cx)))1160
.on_action(cx.listener(|this, _: &ZoomReset, _, cx| change_zoom(&this.state, WindowZoom::Reset, cx)))@@ -1272,7 +1162,7 @@ impl Render for AppShell {1272
.on_action(zoom_listener::<ZoomShareOut>(&self.state, ZoomStep::Out))1162
.on_action(zoom_listener::<ZoomShareOut>(&self.state, ZoomStep::Out))1273
.on_action(zoom_listener::<ZoomShareReset>(&self.state, ZoomStep::Reset))1163
.on_action(zoom_listener::<ZoomShareReset>(&self.state, ZoomStep::Reset))1274
.on_action(cx.listener(|this, _: &JumpToLastReadOrNewest, _, cx| {1164
.on_action(cx.listener(|this, _: &JumpToLastReadOrNewest, _, cx| {1275
if this.image_viewer.is_some() || this.state.read(cx).viewing_call() {1165
if this.image_viewer.is_some() {1276
cx.propagate();1166
cx.propagate();1277
return;1167
return;1278
}1168
}@@ -1299,11 +1189,8 @@ impl Render for AppShell {1299
.size_full()1189
.size_full()1300
.child(title_bar)1190
.child(title_bar)1301
.children(banner)1191
.children(banner)1302
.child(self.islands(call_view, show_sidebar, calendar_open, quick_view_open, calls_open)),1192
.child(self.islands(show_sidebar, calendar_open, quick_view_open, calls_open)),1303
)1193
)1304
.children(call_mini)1305
.children(call_overlay)1306
.children(stage_overlay)1307
.children(self.image_viewer.clone())1194
.children(self.image_viewer.clone())1308
.children(self.switcher.clone())1195
.children(self.switcher.clone())1309
.children(render_task_dialog(self.state.read(cx), cx))1196
.children(render_task_dialog(self.state.read(cx), cx))