BlueGit

ict rusty-teams

Files

rusty-teams / crates / app / src / views / shell.rs

shell.rs

shell.rs 50.6 KiB Download Raw
1mod team_keys;
2
3use std::sync::Arc;
4
5use gpui_kit::component::{elevation, h_flex, v_flex};
6use gpui_kit::*;
7
8use super::activity_panel::{ActivityPanel, ActivityPanelEvent};
9use super::call_mini::CallMiniView;
10use super::call_stage::{render_call_overlay, render_stage_overlay};
11use super::call_end_view::render_call_end;
12use super::call_view::{CHAT_PANEL_WIDTH, OVERLAY_BELOW as CALL_COLUMN_MIN, render_call_view};
13use super::actions::{NewChat, OpenSwitcher, ReplyToHovered, ToggleCallMute};
14use super::calendar_view::CalendarView;
15use super::conversation::ConversationView;
16use super::dialog_overlay::render_task_dialog;
17use super::forward_dialog::{ForwardDialog, ForwardDialogEvent};
18use super::image_viewer::{ImageViewer, ImageViewerEvent};
19use super::prejoin_view::PrejoinView;
20use super::profile_card::{ProfileCard, ProfileCardEvent};
21use gpui_kit::prelude::FluentBuilder as _;
22use super::rail::RailView;
23use crate::chat_filter::ChatFilterPill;
24use super::calls_page::CallsPage;
25use super::quick_view_pane::{QuickViewEvent, QuickViewPane};
26use super::shortcuts::{
27 ClearChatFilters, DeclineCall, FilterMeetingChats, FilterMutedChats,
28 FilterNonMeetingChats, FilterUnreadChats, FindInChat, HangUpCall, JoinMeetingFromToast, JumpToLastReadOrNewest, NextConversation, OpenActivity,
29 OpenAgents, OpenCallsTab, OpenSettings, OpenChannelsTab, OpenChatFilter, OpenChatsTab, PopOutSelectedChat, OpenLobbyList, OpenSaved, OpenCalendar, PreviousConversation, PushToTalk,
30 Scope, ShowShortcuts, StartAudioCall, StartVideoCall, ToggleCallCamera, ToggleCallFullscreen,
31 ToggleCallHand, ToggleCallShare, ZoomIn, ZoomOut, ZoomReset, ZoomShareIn, ZoomShareOut,
32 ZoomShareReset,
33};
34use super::window_zoom::{WindowZoom, change_zoom};
35use super::call_pop_out::zoom_listener;
36use super::chat_pop_out;
37use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};
38use super::sidebar::{SidebarEvent, SidebarTab, SidebarView};
39use app_ui_kit::render::hooks::RenderHooks;
40use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
41use super::connection_banner::render_connection_banner;
42use super::notice_toast::NoticeToasts;
43use super::status_menu::{own_status_button, settings_more_button};
44use super::status_message_dialog::{StatusMessageDialog, StatusMessageDialogEvent};
45use super::switcher::{Switcher, SwitcherEvent, candidates_from};
46use super::title_bar::{mode_label, render_title_bar, update_button};
47use crate::activity::ActivityCenter;
48use crate::agents::{AgentRunsEvent, StartDialog, StartDialogEvent, StartRequest};
49use crate::app_state::{AppEvent, AppState, QuickView, Selection, selection_for};
50use crate::call::{CallMedia, CallWindows, ZoomStep};
51use crate::notice::NoticeAction;
52use crate::notify::NotificationCenter;
53use crate::settings::{SettingsDialog, SettingsDialogEvent};
54use crate::settings_section::SettingsSection;
55use crate::sidebar_model::Step;
56use crate::theme;
57use crate::updater::{self, IdleInputs, UpdateStatus};
58use crate::user_activity::{self, UserInput};
59
60pub fn bind_keys(cx: &mut App) {
61 super::composer::bind_keys(cx);
62 super::shortcuts::bind_scopes(
63 cx,
64 &[
65 Scope::Global,
66 Scope::OutsideComposer,
67 Scope::GlobalOverTextFields,
68 Scope::OutsideTextFields,
69 ],
70 );
71}
72
73#[derive(Debug, Clone, Copy)]
74pub enum OpenTarget {
75 Chat(usize),
76 Channel(usize),
77}
78
79#[derive(Default)]
80pub struct Startup {
81 pub switcher_query: Option<String>,
82 pub composer_text: Option<String>,
83 pub reply_to_last: bool,
84 pub launched_by_autostart: bool,
85}
86
87pub const SIDEBAR_HIDDEN_BELOW: f32 = 960.;
88
89pub 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
95pub struct UserInputHandle(pub Arc<UserInput>);
96
97impl Global for UserInputHandle {}
98
99pub fn install_globals(state: &Entity<AppState>, user_input: Arc<UserInput>, cx: &mut App) {
100 cx.set_global(crate::app_state::AppHandle(state.clone()));
101 cx.set_global(UserInputHandle(user_input));
102 cx.set_global(RenderHooks {
103 open_profile_link: super::profile_card::open_profile_link,
104 jump_to_quoted,
105 inline_image,
106 });
107}
108
109fn inline_image(url: &str, cx: &App) -> Option<std::path::PathBuf> {
110 let handle = cx.try_global::<crate::app_state::AppHandle>()?;
111 let entry = handle.0.read(cx).directory.image(url)?;
112 Some(entry.path.clone())
113}
114
115fn jump_to_quoted(message_id: String, cx: &mut App) {
116 let Some(handle) = cx.try_global::<crate::app_state::AppHandle>() else {
117 return;
118 };
119 handle.0.clone().update(cx, |state, cx| {
120 if let Some(selection) = state.selection.clone() {
121 state.jump_to_message(selection, message_id, cx);
122 }
123 });
124}
125
126#[cfg(windows)]
127fn watch_releases(running_tag: &'static str, cx: &mut App) {
128 use app_base::release_feed;
129 cx.spawn(async move |cx| {
130 cx.background_executor()
131 .timer(release_feed::FIRST_CHECK_DELAY)
132 .await;
133 loop {
134 let Some(paths) = updater::current_paths() else {
135 return;
136 };
137 let fetch = cx.update(|cx| release_feed::fetch_update(running_tag, paths, cx));
138 match fetch.await {
139 Ok(Some(tag)) => log::info!("release {tag} downloaded for the next restart"),
140 Ok(None) => {}
141 Err(error) => log::warn!("release check failed: {error}"),
142 }
143 cx.background_executor()
144 .timer(release_feed::CHECK_INTERVAL)
145 .await;
146 }
147 })
148 .detach();
149}
150
151const DEMO_UPDATE_VARIABLE: &str = "TEAMS_DEMO_UPDATE";
152
153pub struct AppShell {
154 state: Entity<AppState>,
155 rail: Entity<RailView>,
156 sidebar: Entity<SidebarView>,
157 calendar: Entity<CalendarView>,
158 quick_pane: Entity<QuickViewPane>,
159 calls_page: Entity<CallsPage>,
160 shown_quick_view: Option<QuickView>,
161 conversation: Entity<ConversationView>,
162 call_chat: Option<(String, Entity<ConversationView>)>,
163 prejoin: Option<Entity<PrejoinView>>,
164 switcher: Option<Entity<Switcher>>,
165 notifications: Entity<NotificationCenter>,
166 _call_windows: Entity<CallWindows>,
167 forward_dialog: Option<Entity<ForwardDialog>>,
168 image_viewer: Option<Entity<ImageViewer>>,
169 status_dialog: Option<Entity<StatusMessageDialog>>,
170 shortcuts_dialog: Option<Entity<ShortcutsDialog>>,
171 agent_dialog: Option<Entity<StartDialog>>,
172 settings_dialog: Option<Entity<SettingsDialog>>,
173 profile_card: Option<Entity<ProfileCard>>,
174 focus_handle: FocusHandle,
175 call_window_fullscreen: bool,
176 window_was_fullscreen: bool,
177 open_target: Option<OpenTarget>,
178 update: UpdateStatus,
179 toasts: NoticeToasts,
180 user_input: Arc<UserInput>,
181 _subscription: Subscription,
182 call_mini: Entity<CallMiniView>,
183 _call_media_observation: Subscription,
184 _panel_subscriptions: [Subscription; 2],
185 _sidebar_subscription: Subscription,
186 _agents_subscription: Option<Subscription>,
187 _agent_subscription: Option<Subscription>,
188 _escape_observation: Subscription,
189 _activation_observation: Subscription,
190 _appearance_observation: Subscription,
191}
192
193impl AppShell {
194 #[cfg(test)]
195 pub(crate) fn set_update_status(&mut self, update: UpdateStatus, cx: &mut Context<Self>) {
196 self.update = update;
197 cx.notify();
198 }
199
200 fn sync_call_chat(
201 &mut self,
202 thread: Option<String>,
203 window: &mut Window,
204 cx: &mut Context<Self>,
205 ) {
206 match (thread, &self.call_chat) {
207 (Some(wanted), Some((open, _))) if &wanted == open => {}
208 (Some(wanted), _) => {
209 let app = self.state.clone();
210 let selection = Selection::Chat(wanted.clone());
211 let view = cx.new(|cx| ConversationView::pinned_to(app, selection, window, cx));
212 self.call_chat = Some((wanted, view));
213 }
214 (None, _) => self.call_chat = None,
215 }
216 }
217
218 fn focus_opened_quick_view(&mut self, window: &mut Window, cx: &mut Context<Self>) {
219 let quick_view = self.state.read(cx).quick_view;
220 if std::mem::replace(&mut self.shown_quick_view, quick_view) != quick_view
221 && quick_view.is_some()
222 {
223 self.restore_focus(window, cx);
224 }
225 }
226
227 fn leave_calendar_on_selection(&mut self, cx: &mut Context<Self>) {
228 if self.sidebar.read(cx).tab() != SidebarTab::Calendar {
229 return;
230 }
231 let selection = self.state.read(cx).selection.clone();
232 let sidebar = self.sidebar.clone();
233 cx.defer(move |cx| {
234 sidebar.update(cx, |sidebar, cx| match selection {
235 Some(Selection::Channel(_)) => sidebar.show_channels(cx),
236 Some(Selection::Chat(_)) => sidebar.show_chats(cx),
237 None => {}
238 })
239 });
240 }
241
242 fn sync_prejoin(&mut self, window: &mut Window, cx: &mut Context<Self>) {
243 let wanted = self.state.read(cx).prejoin.clone();
244 let open = self.prejoin.as_ref().map(|view| view.read(cx).pending_id());
245 match (wanted, open) {
246 (Some(pending), Some(id)) if pending.id == id => {}
247 (Some(pending), _) => {
248 let app = self.state.clone();
249 self.prejoin = Some(cx.new(|cx| PrejoinView::new(app, &pending, window, cx)));
250 }
251 (None, _) => self.prejoin = None,
252 }
253 }
254
255 pub fn new(
256 state: Entity<AppState>,
257 open_target: Option<OpenTarget>,
258 startup: Startup,
259 window: &mut Window,
260 cx: &mut Context<Self>,
261 ) -> Self {
262 let call_media = cx.new(|_| CallMedia);
263 state.update(cx, |state, _| state.call_media = Some(call_media.clone()));
264 let call_media_observation = cx.observe(&call_media, |this, _, cx| {
265 if this.state.read(cx).viewing_call() {
266 cx.notify();
267 }
268 });
269 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
270 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
271 let quick_pane = cx.new(|cx| QuickViewPane::new(state.clone(), activity.clone(), cx));
272 let calls_page = cx.new(|cx| CallsPage::new(state.clone(), window, cx));
273 let agents_panel = crate::agents::runs_handle(cx)
274 .map(|runs| cx.new(|cx| crate::agents::AgentsPanel::new(runs, cx)));
275 let agents_subscription = agents_panel.as_ref().map(|panel| {
276 cx.subscribe(
277 panel,
278 |this, _, event: &crate::agents::AgentsPanelEvent, cx| {
279 let crate::agents::AgentsPanelEvent::Open {
280 conversation_id,
281 message_id,
282 } = event;
283 this.open_message(conversation_id, message_id, cx);
284 },
285 )
286 });
287 let panel_subscriptions = [
288 cx.subscribe(
289 &activity_panel,
290 |this, _, event: &ActivityPanelEvent, cx| match event {
291 ActivityPanelEvent::OpenSettings => this.state.update(cx, |state, cx| {
292 state.open_settings(SettingsSection::Notifications, cx)
293 }),
294 ActivityPanelEvent::Open {
295 conversation_id,
296 message_id,
297 link,
298 } => {
299 if !this.open_message(conversation_id, message_id, cx)
300 && let Some(link) = link
301 {
302 cx.open_url(link);
303 }
304 }
305 },
306 ),
307 cx.subscribe(&quick_pane, |this, _, event: &QuickViewEvent, cx| {
308 let QuickViewEvent::Open {
309 conversation_id,
310 message_id,
311 } = event;
312 this.state
313 .update(cx, |state, cx| state.close_quick_view(cx));
314 this.open_message(conversation_id, message_id.as_deref().unwrap_or_default(), cx);
315 }),
316 ];
317 let agent_subscription = crate::agents::runs_handle(cx).map(|runs| {
318 cx.subscribe_in(
319 &runs,
320 window,
321 |this, _, event: &AgentRunsEvent, window, cx| match event {
322 AgentRunsEvent::StartRequested(request) => {
323 this.open_agent_dialog(request.clone(), window, cx)
324 }
325 AgentRunsEvent::OpenSettings => {
326 this.open_settings(SettingsSection::Agents, window, cx)
327 }
328 AgentRunsEvent::Finished(_) => {}
329 },
330 )
331 });
332 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, agents_panel, cx));
333 let sidebar_subscription = cx.subscribe_in(&sidebar, window, |this, _, event: &SidebarEvent, window, cx| {
334 match event {
335 SidebarEvent::RestoreFocus => this.restore_focus(window, cx),
336 SidebarEvent::TabChanged => {
337 if this.sidebar.read(cx).tab() == SidebarTab::Calendar {
338 this.restore_focus(window, cx);
339 }
340 cx.notify();
341 }
342 SidebarEvent::NewChannelPost => this
343 .conversation
344 .update(cx, |conversation, cx| conversation.start_channel_post(window, cx)),
345 }
346 });
347 let calendar = cx.new(|cx| CalendarView::new(state.clone(), cx));
348 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
349 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
350 let timeline = conversation.read(cx).timeline_bounds();
351 let call_mini = cx.new(|cx| CallMiniView::new(state.clone(), timeline, cx));
352 let subscription =
353 cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {
354 if matches!(event, AppEvent::Sidebar | AppEvent::Status) {
355 this.apply_open_target(cx);
356 }
357 if matches!(event, AppEvent::Sidebar) {
358 this.focus_opened_quick_view(window, cx);
359 }
360 if matches!(event, AppEvent::Selection) {
361 this.leave_calendar_on_selection(cx);
362 }
363 if matches!(event, AppEvent::Forward) {
364 this.open_forward_dialog(window, cx);
365 }
366 if matches!(event, AppEvent::ImageViewer) {
367 this.open_image_viewer(window, cx);
368 }
369 if matches!(event, AppEvent::StatusMessage) {
370 this.open_status_dialog(window, cx);
371 }
372 if let AppEvent::Settings(section) = event {
373 this.open_settings(*section, window, cx);
374 }
375 if matches!(event, AppEvent::Profile) {
376 this.open_profile_card(window, cx);
377 }
378 cx.notify();
379 });
380 let focus_handle = cx.focus_handle();
381 window.focus(&focus_handle, cx);
382 let notifications =
383 cx.new(|cx| NotificationCenter::new(state.clone(), activity.clone(), window, cx));
384 let call_windows = cx.new(|cx| CallWindows::new(state.clone(), window, cx));
385 let user_input = cx.global::<UserInputHandle>().0.clone();
386 let escape_observation = cx.observe_keystrokes(|this, event, _, cx| {
387 this.user_input.touch();
388 if event.keystroke.key == "escape" && event.action.is_none() {
389 this.state
390 .update(cx, |state, cx| state.escape_call_fullscreen(cx));
391 }
392 });
393 let appearance_observation = cx.observe_window_appearance(window, |_, window, cx| {
394 crate::active_appearance::system_appearance_changed(window.appearance(), cx);
395 });
396 let activation_observation = cx.observe_window_activation(window, |this, window, cx| {
397 if window.is_window_active() {
398 this.state
399 .update(cx, |state, cx| state.refresh_calendar(cx));
400 } else {
401 this.state
402 .update(cx, |state, cx| state.release_push_to_talk(cx));
403 }
404 });
405 let closing = notifications.clone();
406 window.on_window_should_close(cx, move |_, cx| !closing.read(cx).intercept_close(cx));
407 let mut shell = AppShell {
408 state,
409 rail,
410 sidebar,
411 calendar,
412 quick_pane,
413 calls_page,
414 shown_quick_view: None,
415 conversation,
416 call_chat: None,
417 prejoin: None,
418 switcher: None,
419 notifications,
420 _call_windows: call_windows,
421 forward_dialog: None,
422 image_viewer: None,
423 status_dialog: None,
424 shortcuts_dialog: None,
425 agent_dialog: None,
426 settings_dialog: None,
427 profile_card: None,
428 focus_handle,
429 call_window_fullscreen: false,
430 window_was_fullscreen: false,
431 open_target,
432 update: UpdateStatus::UpToDate,
433 toasts: NoticeToasts::default(),
434 user_input,
435 _subscription: subscription,
436 call_mini,
437 _call_media_observation: call_media_observation,
438 _panel_subscriptions: panel_subscriptions,
439 _sidebar_subscription: sidebar_subscription,
440 _agents_subscription: agents_subscription,
441 _agent_subscription: agent_subscription,
442 _escape_observation: escape_observation,
443 _activation_observation: activation_observation,
444 _appearance_observation: appearance_observation,
445 };
446 shell.apply_open_target(cx);
447 shell
448 .state
449 .update(cx, |state, cx| state.refresh_connection_banner(cx));
450 if shell.state.read(cx).mode.demo && std::env::var_os(DEMO_UPDATE_VARIABLE).is_some() {
451 shell.update = UpdateStatus::Ready;
452 }
453 let Startup {
454 switcher_query,
455 composer_text,
456 reply_to_last,
457 launched_by_autostart,
458 } = startup;
459 if shell
460 .notifications
461 .read(cx)
462 .startup()
463 .starts_hidden(launched_by_autostart)
464 {
465 cx.defer_in(window, |this, window, cx| {
466 this.notifications.read(cx).start_in_background(window)
467 });
468 }
469 if let Some(query) = switcher_query {
470 shell.toggle_switcher(&query, window, cx);
471 }
472 if composer_text.is_some() || reply_to_last {
473 cx.defer_in(window, move |this, window, cx| {
474 this.conversation.update(cx, |conversation, cx| {
475 if reply_to_last {
476 conversation.reply_to_latest_from_others(window, cx);
477 }
478 if let Some(text) = composer_text {
479 conversation.set_composer_text(&text, window, cx);
480 }
481 });
482 });
483 }
484 #[cfg(windows)]
485 cx.spawn_in(window, async move |this, cx| {
486 loop {
487 cx.background_executor().timer(updater::POLL_INTERVAL).await;
488 if this
489 .update_in(cx, |this, window, cx| this.poll_update(window, cx))
490 .is_err()
491 {
492 break;
493 }
494 }
495 })
496 .detach();
497 #[cfg(windows)]
498 if let Some(running_tag) = app_base::version::release_tag() {
499 watch_releases(running_tag, cx);
500 }
501 shell
502 }
503
504 #[cfg_attr(not(windows), allow(dead_code))]
505 fn poll_update(&mut self, window: &mut Window, cx: &mut Context<Self>) {
506 if matches!(
507 self.update,
508 UpdateStatus::Failed(_) | UpdateStatus::Installing
509 ) {
510 return;
511 }
512 let Some(paths) = updater::current_paths() else {
513 return;
514 };
515 if self.update == UpdateStatus::UpToDate {
516 if !updater::check(&paths) {
517 return;
518 }
519 self.update = UpdateStatus::Ready;
520 let update_exe = paths.update_exe.clone();
521 cx.background_spawn(async move { updater::prescan(&update_exe) })
522 .detach();
523 }
524 let conversation = self.conversation.read(cx);
525 let idle = updater::is_idle(IdleInputs {
526 window_active: window.is_window_active(),
527 composer_empty: conversation.composer_is_empty(cx),
528 send_in_flight: conversation.send_in_flight(),
529 });
530 if idle {
531 self.restart_into_update(cx);
532 }
533 cx.notify();
534 }
535
536 fn restart_into_update(&mut self, cx: &mut Context<Self>) {
537 if self.update == UpdateStatus::Installing {
538 return;
539 }
540 let Some(paths) = updater::current_paths() else {
541 return;
542 };
543 self.update = UpdateStatus::Installing;
544 cx.notify();
545 cx.spawn(async move |this, cx| {
546 let result = cx
547 .background_spawn(async move { updater::install_and_relaunch(&paths) })
548 .await;
549 let _ = this.update(cx, |this, cx| {
550 match result {
551 Ok(()) => cx.quit(),
552 Err(message) => this.update = UpdateStatus::Failed(message),
553 }
554 cx.notify();
555 });
556 })
557 .detach();
558 }
559
560 fn apply_open_target(&mut self, cx: &mut Context<Self>) {
561 let Some(target) = self.open_target else {
562 return;
563 };
564 let sidebar = &self.state.read(cx).sidebar;
565 let selection = match target {
566 OpenTarget::Chat(index) => sidebar
567 .chats
568 .get(index)
569 .map(|chat| Selection::Chat(chat.id.clone())),
570 OpenTarget::Channel(index) => sidebar
571 .teams
572 .iter()
573 .flat_map(|team| team.channels.iter())
574 .nth(index)
575 .map(|channel| Selection::Channel(channel.id.clone())),
576 };
577 if let Some(selection) = selection {
578 self.open_target = None;
579 self.state
580 .update(cx, |state, cx| state.select(selection, cx));
581 }
582 }
583
584 fn toggle_switcher(
585 &mut self,
586 initial_query: &str,
587 window: &mut Window,
588 cx: &mut Context<Self>,
589 ) {
590 if self.switcher.take().is_some() {
591 self.restore_focus(window, cx);
592 cx.notify();
593 return;
594 }
595 self.close_image_viewer(window, cx);
596 let candidates = candidates_from(self.state.read(cx));
597 let app = self.state.clone();
598 let switcher = cx.new(|cx| Switcher::new(app, candidates, initial_query, window, cx));
599 cx.subscribe_in(
600 &switcher,
601 window,
602 |this, _, event: &SwitcherEvent, window, cx| {
603 match event {
604 SwitcherEvent::Pick(selection) => {
605 let selection = selection.clone();
606 this.state
607 .update(cx, |state, cx| state.select(selection, cx));
608 }
609 SwitcherEvent::PickMessage {
610 selection,
611 message_id,
612 } => {
613 let (selection, message_id) = (selection.clone(), message_id.clone());
614 this.state.update(cx, |state, cx| {
615 state.jump_to_message(selection, message_id, cx)
616 });
617 }
618 SwitcherEvent::PickPerson { user_id } => {
619 let user_id = user_id.clone();
620 this.state
621 .update(cx, |state, cx| state.open_chat_with(&user_id, cx));
622 }
623 SwitcherEvent::Close => {}
624 }
625 this.switcher = None;
626 this.restore_focus(window, cx);
627 cx.notify();
628 },
629 )
630 .detach();
631 self.switcher = Some(switcher);
632 cx.notify();
633 }
634
635 fn open_message(
636 &mut self,
637 conversation_id: &str,
638 message_id: &str,
639 cx: &mut Context<Self>,
640 ) -> bool {
641 let Some(selection) = selection_for(&self.state.read(cx).sidebar, conversation_id) else {
642 return false;
643 };
644 let message_id = message_id.to_owned();
645 self.state.update(cx, |state, cx| {
646 if message_id.is_empty() {
647 state.select(selection, cx)
648 } else {
649 state.jump_to_message(selection, message_id, cx)
650 }
651 });
652 true
653 }
654
655 fn open_status_dialog(&mut self, window: &mut Window, cx: &mut Context<Self>) {
656 if !self
657 .state
658 .update(cx, |state, _| state.take_status_message_request())
659 {
660 return;
661 }
662 self.close_image_viewer(window, cx);
663 self.switcher = None;
664 let app = self.state.clone();
665 let dialog = cx.new(|cx| StatusMessageDialog::new(app, window, cx));
666 cx.subscribe_in(
667 &dialog,
668 window,
669 |this, _, _: &StatusMessageDialogEvent, window, cx| {
670 this.status_dialog = None;
671 this.restore_focus(window, cx);
672 cx.notify();
673 },
674 )
675 .detach();
676 self.status_dialog = Some(dialog);
677 cx.notify();
678 }
679
680 fn open_agent_dialog(
681 &mut self,
682 request: StartRequest,
683 window: &mut Window,
684 cx: &mut Context<Self>,
685 ) {
686 let Some(runs) = crate::agents::runs_handle(cx) else {
687 return;
688 };
689 let settings = runs.read(cx).settings();
690 let Some(action) = settings
691 .actions
692 .iter()
693 .find(|action| action.id == request.action_id)
694 .cloned()
695 else {
696 return;
697 };
698 let agent_name = settings
699 .agents
700 .iter()
701 .find(|agent| agent.id == action.agent_id)
702 .map(|agent| agent.name.clone())
703 .unwrap_or_default();
704 self.switcher = None;
705 let app = self.state.clone();
706 let dialog = cx.new(|cx| StartDialog::new(app, request, action, &agent_name, window, cx));
707 cx.subscribe_in(
708 &dialog,
709 window,
710 |this, _, _: &StartDialogEvent, window, cx| {
711 this.agent_dialog = None;
712 window.focus(&this.focus_handle, cx);
713 cx.notify();
714 },
715 )
716 .detach();
717 self.agent_dialog = Some(dialog);
718 cx.notify();
719 }
720
721 fn open_settings(
722 &mut self,
723 section: SettingsSection,
724 window: &mut Window,
725 cx: &mut Context<Self>,
726 ) {
727 if let Some(dialog) = &self.settings_dialog {
728 dialog.update(cx, |dialog, cx| dialog.show(section, window, cx));
729 return;
730 }
731 self.close_image_viewer(window, cx);
732 self.switcher = None;
733 let (app, center) = (self.state.clone(), self.notifications.clone());
734 let dialog = cx.new(|cx| SettingsDialog::new(app, center, section, window, cx));
735 cx.subscribe_in(
736 &dialog,
737 window,
738 |this, _, _: &SettingsDialogEvent, window, cx| {
739 this.settings_dialog = None;
740 this.restore_focus(window, cx);
741 cx.notify();
742 },
743 )
744 .detach();
745 self.settings_dialog = Some(dialog);
746 cx.notify();
747 }
748
749 fn toggle_shortcuts_dialog(&mut self, window: &mut Window, cx: &mut Context<Self>) {
750 if self.shortcuts_dialog.take().is_some() {
751 self.restore_focus(window, cx);
752 cx.notify();
753 return;
754 }
755 self.close_image_viewer(window, cx);
756 self.switcher = None;
757 let dialog = cx.new(|cx| ShortcutsDialog::new(window, cx));
758 cx.subscribe_in(
759 &dialog,
760 window,
761 |this, _, _: &ShortcutsDialogEvent, window, cx| {
762 this.shortcuts_dialog = None;
763 this.restore_focus(window, cx);
764 cx.notify();
765 },
766 )
767 .detach();
768 self.shortcuts_dialog = Some(dialog);
769 cx.notify();
770 }
771
772 fn open_profile_card(&mut self, window: &mut Window, cx: &mut Context<Self>) {
773 let Some(request) = self
774 .state
775 .update(cx, |state, _| state.take_profile_request())
776 else {
777 return;
778 };
779 self.close_image_viewer(window, cx);
780 if let Some(card) = &self.profile_card {
781 card.update(cx, |card, cx| {
782 card.move_to(request.user_id, request.anchor, cx)
783 });
784 return;
785 }
786 let app = self.state.clone();
787 let card = cx.new(|cx| ProfileCard::new(app, request.user_id, request.anchor, window, cx));
788 cx.subscribe_in(
789 &card,
790 window,
791 |this, _, _: &ProfileCardEvent, window, cx| {
792 this.profile_card = None;
793 this.restore_focus(window, cx);
794 cx.notify();
795 },
796 )
797 .detach();
798 self.profile_card = Some(card);
799 cx.notify();
800 }
801
802 fn open_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
803 let Some(request) = self
804 .state
805 .update(cx, |state, _| state.take_image_viewer_request())
806 else {
807 return;
808 };
809 self.switcher = None;
810 let app = self.state.clone();
811 let viewer = cx.new(|cx| ImageViewer::new(app, request, window, cx));
812 cx.subscribe_in(
813 &viewer,
814 window,
815 |this, _, _: &ImageViewerEvent, window, cx| {
816 this.image_viewer = None;
817 window.focus(&this.focus_handle, cx);
818 cx.notify();
819 },
820 )
821 .detach();
822 self.image_viewer = Some(viewer);
823 cx.notify();
824 }
825
826 fn start_call_in_open_chat(&mut self, with_video: bool, cx: &mut Context<Self>) {
827 self.state.update(cx, |state, cx| {
828 if let Some(Selection::Chat(chat_id)) = state.selection.clone() {
829 if with_video {
830 state.start_chat_video_call(&chat_id, cx);
831 } else {
832 state.start_chat_call(&chat_id, cx);
833 }
834 }
835 });
836 }
837
838 fn sync_window_fullscreen(&mut self, wanted: bool, window: &mut Window) {
839 if wanted == self.call_window_fullscreen {
840 return;
841 }
842 self.call_window_fullscreen = wanted;
843 if wanted {
844 self.window_was_fullscreen = window.is_fullscreen();
845 }
846 if wanted != window.is_fullscreen() && (wanted || !self.window_was_fullscreen) {
847 window.toggle_fullscreen();
848 }
849 }
850
851 fn close_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
852 if self.image_viewer.take().is_some() {
853 window.focus(&self.focus_handle, cx);
854 cx.notify();
855 }
856 }
857
858 fn restore_focus(&self, window: &mut Window, cx: &mut Context<Self>) {
859 match &self.image_viewer {
860 Some(viewer) => {
861 let handle = viewer.read(cx).focus_handle();
862 window.focus(&handle, cx)
863 }
864 None => window.focus(&self.focus_handle, cx),
865 }
866 }
867
868 fn open_forward_dialog(&mut self, window: &mut Window, cx: &mut Context<Self>) {
869 let Some(source) = self
870 .state
871 .update(cx, |state, _| state.take_forward_request())
872 else {
873 return;
874 };
875 self.switcher = None;
876 let candidates = candidates_from(self.state.read(cx));
877 let app = self.state.clone();
878 let dialog = cx.new(|cx| ForwardDialog::new(app, source, candidates, window, cx));
879 cx.subscribe_in(
880 &dialog,
881 window,
882 |this, _, event: &ForwardDialogEvent, window, cx| {
883 this.forward_dialog = None;
884 this.restore_focus(window, cx);
885 if let ForwardDialogEvent::Sent { target, title } = event {
886 let target = target.clone();
887 let open = NoticeAction::new("Open", move |state, cx| {
888 state.select(target.clone(), cx)
889 });
890 this.state.update(cx, |state, cx| {
891 state.cancel_forward_selection(cx);
892 state.raise_notice(format!("Forwarded to {title}"), Some(open), cx)
893 });
894 }
895 cx.notify();
896 },
897 )
898 .detach();
899 self.forward_dialog = Some(dialog);
900 cx.notify();
901 }
902}
903
904impl AppShell {
905 fn islands(
906 &self,
907 call_view: Option<AnyElement>,
908 show_sidebar: bool,
909 calendar_open: bool,
910 quick_view_open: bool,
911 calls_open: bool,
912 ) -> impl IntoElement {
913 h_flex()
914 .debug_selector(|| "shell/islands".into())
915 .flex_1()
916 .min_h_0()
917 .w_full()
918 .when(show_sidebar, |islands| islands.gap(px(ISLAND_GAP)))
919 .pr(px(ISLAND_GAP))
920 .pb(px(ISLAND_GAP))
921 .child(
922 h_flex()
923 .h_full()
924 .flex_none()
925 .child(self.rail.clone())
926 .when(show_sidebar, |group| {
927 group.child(
928 self.sidebar.clone().cached(
929 StyleRefinement::default()
930 .w(px(SIDEBAR_WIDTH))
931 .h_full()
932 .flex_none(),
933 ),
934 )
935 }),
936 )
937 .child(match (call_view, self.prejoin.clone()) {
938 (Some(call_view), _) => call_view,
939 (None, Some(prejoin)) => prejoin
940 .cached(StyleRefinement::default().flex_1().min_w_0().h_full())
941 .into_any_element(),
942 (None, None) if calls_open => self
943 .calls_page
944 .clone()
945 .cached(StyleRefinement::default().flex_1().min_w_0().h_full())
946 .into_any_element(),
947 (None, None) if quick_view_open => self
948 .quick_pane
949 .clone()
950 .cached(StyleRefinement::default().flex_1().min_w_0().h_full())
951 .into_any_element(),
952 (None, None) if calendar_open => self
953 .calendar
954 .clone()
955 .cached(StyleRefinement::default().flex_1().min_w_0().h_full())
956 .into_any_element(),
957 (None, None) => self
958 .conversation
959 .clone()
960 .cached(StyleRefinement::default().flex_1().min_w_0().h_full())
961 .into_any_element(),
962 })
963 }
964}
965
966impl Render for AppShell {
967 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
968 let viewed_call = self
969 .state
970 .read(cx)
971 .call
972 .as_ref()
973 .filter(|call| call.viewing);
974 let open_dialogs = [
975 self.state.read(cx).task_dialog.is_some(),
976 self.forward_dialog.is_some(),
977 self.status_dialog.is_some(),
978 self.shortcuts_dialog.is_some(),
979 self.agent_dialog.is_some(),
980 self.settings_dialog.is_some(),
981 viewed_call.is_some() && self.state.read(cx).transfer_picker.is_some(),
982 viewed_call.is_some_and(|call| call.options_dialog.is_some()),
983 viewed_call.is_some_and(|call| call.model.consent_required),
984 ]
985 .into_iter()
986 .filter(|open| *open)
987 .count();
988 elevation::set_app_modal_layers(window, open_dialogs, cx);
989 if open_dialogs > 0 {
990 crate::inline_video::stop(cx);
991 }
992 if let Some(dialog) = self
993 .state
994 .read(cx)
995 .task_dialog
996 .as_ref()
997 .map(|dialog| (dialog.scope.clone(), dialog.card.clone()))
998 {
999 self.state.update(cx, |state, cx| {
1000 state.ensure_card_inputs(&dialog.0, &dialog.1, window, cx)
1001 });
1002 }
1003 if let Some(me) = self.state.read(cx).directory.me.clone() {
1004 let app = self.state.clone();
1005 cx.defer(move |cx| {
1006 app.update(cx, |state, cx| {
1007 state.request_avatars(vec![me.user_id.clone()], cx);
1008 state.request_presence(vec![me.user_id], cx);
1009 });
1010 });
1011 }
1012 let chat_thread = self.state.read(cx).call_chat_thread();
1013 self.sync_call_chat(chat_thread, window, cx);
1014 self.sync_prejoin(window, cx);
1015 let notice = self.state.read(cx).notice.clone();
1016 self.toasts.sync(&self.state, notice.as_ref(), window, cx);
1017 let update_failure = match &self.update {
1018 UpdateStatus::Failed(message) => Some(message.clone()),
1019 _ => None,
1020 };
1021 self.toasts.update_failed(update_failure.as_deref(), window, cx);
1022 let chat_panel = self.call_chat.as_ref().map(|(_, view)| view.clone().into());
1023 let calendar_tab = self.sidebar.read(cx).tab() == SidebarTab::Calendar;
1024 let chats_tab = self.sidebar.read(cx).tab() == SidebarTab::Chats;
1025 let calls_tab = self.sidebar.read(cx).tab() == SidebarTab::Calls;
1026 let state = self.state.read(cx);
1027 let call_fullscreen = state.call_fullscreen();
1028 let window_width = f32::from(window.viewport_size().width);
1029 let panel_open = state
1030 .call
1031 .as_ref()
1032 .is_some_and(|call| call.chat_open || call.people_open || call.transcript_open);
1033 let calendar_open = calendar_tab && !state.viewing_call();
1034 let quick_view_open = chats_tab && state.quick_view.is_some();
1035 let calls_open = calls_tab && !state.viewing_call();
1036 let show_sidebar = !calendar_open
1037 && !calls_open
1038 && !(state.viewing_call()
1039 && !call_fullscreen
1040 && sidebar_hidden_in_call(window_width, panel_open));
1041 let island_width = window_width
1042 - RAIL_WIDTH
1043 - if show_sidebar { SIDEBAR_WIDTH + ISLAND_GAP } else { 0. }
1044 - ISLAND_GAP;
1045 let call_view = render_call_view(&self.state, state, chat_panel, call_fullscreen, island_width)
1046 .filter(|_| state.viewing_call())
1047 .or_else(|| render_call_end(&self.state, state));
1048 let (call_view, call_overlay) = match call_view {
1049 Some(view) if call_fullscreen => (None, Some(render_call_overlay(view))),
1050 view => (view, None),
1051 };
1052 self.sync_window_fullscreen(call_fullscreen, window);
1053 let call_mini = state
1054 .call
1055 .as_ref()
1056 .is_some_and(|call| !call.viewing)
1057 .then(|| self.call_mini.clone());
1058 let stage_overlay = render_stage_overlay(&self.state, state);
1059 let banner = state.connection_banner_text().map(|banner| {
1060 render_connection_banner(
1061 banner,
1062 cx.listener(|this, _, _, cx| {
1063 this.state.update(cx, |state, _| state.retry_live())
1064 }),
1065 )
1066 });
1067 let title_bar = render_title_bar(
1068 crate::active_appearance::current(cx).app_icon,
1069 mode_label(state.mode),
1070 [
1071 update_button(
1072 &self.update,
1073 cx.listener(|this, _, _, cx| this.restart_into_update(cx)),
1074 ),
1075 Some(settings_more_button(&self.state)),
1076 own_status_button(&self.state, state),
1077 ]
1078 .into_iter()
1079 .flatten(),
1080 cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),
1081 );
1082 let shell = div()
1083 .id("app-shell")
1084 .key_context("AppShell")
1085 .track_focus(&self.focus_handle);
1086 self.team_keys(shell, cx)
1087 .on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {
1088 this.toggle_switcher("", window, cx);
1089 }))
1090 .on_action(cx.listener(|this, _: &NewChat, window, cx| {
1091 this.close_image_viewer(window, cx);
1092 this.state.update(cx, |state, cx| state.start_new_chat(cx));
1093 }))
1094 .on_action(cx.listener(|this, _: &ToggleCallMute, _, cx| {
1095 this.state
1096 .update(cx, |state, cx| state.toggle_call_mute(cx));
1097 }))
1098 .on_action(cx.listener(|this, _: &PushToTalk, _, cx| {
1099 this.state
1100 .update(cx, |state, cx| state.press_push_to_talk(cx));
1101 }))
1102 .on_key_up(cx.listener(|this, event: &KeyUpEvent, _, cx| {
1103 if event.keystroke.key == "space" {
1104 this.state
1105 .update(cx, |state, cx| state.release_push_to_talk(cx));
1106 }
1107 }))
1108 .on_modifiers_changed(cx.listener(|this, event: &ModifiersChangedEvent, _, cx| {
1109 if !event.modifiers.control {
1110 this.state
1111 .update(cx, |state, cx| state.release_push_to_talk(cx));
1112 }
1113 }))
1114 .on_action(cx.listener(|this, _: &OpenSettings, window, cx| {
1115 this.open_settings(SettingsSection::General, window, cx);
1116 }))
1117 .on_action(cx.listener(|this, _: &ShowShortcuts, window, cx| {
1118 this.toggle_shortcuts_dialog(window, cx);
1119 }))
1120 .on_action(cx.listener(|this, _: &OpenActivity, window, cx| {
1121 this.close_image_viewer(window, cx);
1122 this.sidebar
1123 .update(cx, |sidebar, cx| sidebar.show_activity(cx));
1124 }))
1125 .on_action(cx.listener(|this, _: &OpenSaved, window, cx| {
1126 this.close_image_viewer(window, cx);
1127 this.sidebar
1128 .update(cx, |sidebar, cx| sidebar.open_quick_view(QuickView::Saved, cx));
1129 }))
1130 .on_action(cx.listener(|this, _: &OpenCalendar, window, cx| {
1131 this.close_image_viewer(window, cx);
1132 this.sidebar
1133 .update(cx, |sidebar, cx| sidebar.show_calendar(cx));
1134 }))
1135 .on_action(cx.listener(|this, _: &OpenAgents, window, cx| {
1136 this.close_image_viewer(window, cx);
1137 this.sidebar
1138 .update(cx, |sidebar, cx| sidebar.show_agents(cx));
1139 }))
1140 .on_action(cx.listener(|this, _: &OpenChatsTab, window, cx| {
1141 this.close_image_viewer(window, cx);
1142 this.sidebar
1143 .update(cx, |sidebar, cx| sidebar.show_chats(cx));
1144 }))
1145 .on_action(cx.listener(|this, _: &FindInChat, window, cx| {
1146 this.close_image_viewer(window, cx);
1147 this.state
1148 .update(cx, |state, cx| state.close_quick_view(cx));
1149 this.conversation
1150 .update(cx, |conversation, cx| conversation.open_find(window, cx));
1151 }))
1152 .on_action(cx.listener(|this, _: &PopOutSelectedChat, _, cx| {
1153 let selected = this.state.read(cx).selection.clone();
1154 if let Some(Selection::Chat(chat_id)) = selected {
1155 chat_pop_out::pop_out_chat(&this.state, &chat_id, cx);
1156 }
1157 }))
1158 .on_action(cx.listener(|this, _: &OpenChatFilter, window, cx| {
1159 this.close_image_viewer(window, cx);
1160 this.sidebar
1161 .update(cx, |sidebar, cx| sidebar.toggle_filter_box(window, cx));
1162 }))
1163 .on_action(cx.listener(|this, _: &FilterUnreadChats, _, cx| {
1164 this.sidebar
1165 .update(cx, |sidebar, cx| sidebar.toggle_pill(ChatFilterPill::Unread, cx));
1166 }))
1167 .on_action(cx.listener(|this, _: &FilterNonMeetingChats, _, cx| {
1168 this.sidebar
1169 .update(cx, |sidebar, cx| sidebar.toggle_pill(ChatFilterPill::Chats, cx));
1170 }))
1171 .on_action(cx.listener(|this, _: &FilterMeetingChats, _, cx| {
1172 this.sidebar
1173 .update(cx, |sidebar, cx| sidebar.toggle_pill(ChatFilterPill::Meetings, cx));
1174 }))
1175 .on_action(cx.listener(|this, _: &FilterMutedChats, _, cx| {
1176 this.sidebar
1177 .update(cx, |sidebar, cx| sidebar.toggle_pill(ChatFilterPill::Muted, cx));
1178 }))
1179 .on_action(cx.listener(|this, _: &ClearChatFilters, window, cx| {
1180 this.sidebar
1181 .update(cx, |sidebar, cx| sidebar.clear_filters(window, cx));
1182 }))
1183 .on_action(cx.listener(|this, _: &OpenChannelsTab, window, cx| {
1184 this.close_image_viewer(window, cx);
1185 this.sidebar
1186 .update(cx, |sidebar, cx| sidebar.show_channels(cx));
1187 }))
1188 .on_action(cx.listener(|this, _: &OpenCallsTab, window, cx| {
1189 this.close_image_viewer(window, cx);
1190 this.sidebar
1191 .update(cx, |sidebar, cx| sidebar.show_calls(cx));
1192 }))
1193 .on_action(cx.listener(|this, _: &PreviousConversation, window, cx| {
1194 this.close_image_viewer(window, cx);
1195 this.sidebar.update(cx, |sidebar, cx| {
1196 sidebar.select_adjacent(Step::Previous, cx)
1197 });
1198 }))
1199 .on_action(cx.listener(|this, _: &NextConversation, window, cx| {
1200 this.close_image_viewer(window, cx);
1201 this.sidebar
1202 .update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));
1203 }))
1204 .on_action(cx.listener(|this, _: &DeclineCall, _, cx| {
1205 this.state
1206 .update(cx, |state, cx| state.decline_ringing_call(cx));
1207 }))
1208 .on_action(cx.listener(|this, _: &JoinMeetingFromToast, _, cx| {
1209 this.state
1210 .update(cx, |state, cx| state.join_latest_meeting_toast(cx));
1211 }))
1212 .on_action(cx.listener(|this, _: &HangUpCall, _, cx| {
1213 this.state.update(cx, |state, cx| state.leave_call(cx));
1214 }))
1215 .on_action(cx.listener(|this, _: &ToggleCallCamera, _, cx| {
1216 this.state
1217 .update(cx, |state, cx| state.toggle_call_camera(cx));
1218 }))
1219 .on_action(cx.listener(|this, _: &ToggleCallShare, _, cx| {
1220 this.state
1221 .update(cx, |state, cx| state.toggle_call_share(cx));
1222 }))
1223 .on_action(cx.listener(|this, _: &ToggleCallHand, _, cx| {
1224 this.state
1225 .update(cx, |state, cx| state.toggle_call_hand(cx));
1226 }))
1227 .on_action(cx.listener(|this, _: &OpenLobbyList, _, cx| {
1228 this.state
1229 .update(cx, |state, cx| state.open_call_lobby_list(cx));
1230 }))
1231 .on_action(cx.listener(|this, _: &StartAudioCall, _, cx| {
1232 this.start_call_in_open_chat(false, cx);
1233 }))
1234 .on_action(cx.listener(|this, _: &StartVideoCall, _, cx| {
1235 this.start_call_in_open_chat(true, cx);
1236 }))
1237 .on_action(cx.listener(|this, _: &ToggleCallFullscreen, _, cx| {
1238 if this.image_viewer.is_some() || !this.state.read(cx).viewing_call() {
1239 cx.propagate();
1240 return;
1241 }
1242 this.state
1243 .update(cx, |state, cx| state.toggle_call_fullscreen(cx));
1244 }))
1245 .on_action(cx.listener(|this, _: &ZoomIn, _, cx| change_zoom(&this.state, WindowZoom::In, cx)))
1246 .on_action(cx.listener(|this, _: &ZoomOut, _, cx| change_zoom(&this.state, WindowZoom::Out, cx)))
1247 .on_action(cx.listener(|this, _: &ZoomReset, _, cx| change_zoom(&this.state, WindowZoom::Reset, cx)))
1248 .on_action(zoom_listener::<ZoomShareIn>(&self.state, ZoomStep::In))
1249 .on_action(zoom_listener::<ZoomShareOut>(&self.state, ZoomStep::Out))
1250 .on_action(zoom_listener::<ZoomShareReset>(&self.state, ZoomStep::Reset))
1251 .on_action(cx.listener(|this, _: &JumpToLastReadOrNewest, _, cx| {
1252 if this.image_viewer.is_some() || this.state.read(cx).viewing_call() {
1253 cx.propagate();
1254 return;
1255 }
1256 this.conversation
1257 .update(cx, |conversation, cx| conversation.jump_to_last_read_or_newest(cx));
1258 }))
1259 .on_action(cx.listener(|this, _: &ReplyToHovered, window, cx| {
1260 this.close_image_viewer(window, cx);
1261 this.conversation.update(cx, |conversation, cx| {
1262 conversation.reply_to_hovered(window, cx)
1263 });
1264 }))
1265 .relative()
1266 .size_full()
1267 .bg(theme::background())
1268 .text_color(theme::text())
1269 .text_size(px(14.))
1270 .child(crate::frame_log::probe("first"))
1271 .child(user_activity::input_probe(self.user_input.clone()))
1272 .child(app_ui_kit::long_press::long_press_right_click())
1273 .child(
1274 v_flex()
1275 .debug_selector(|| "shell".into())
1276 .size_full()
1277 .child(title_bar)
1278 .children(banner)
1279 .child(self.islands(call_view, show_sidebar, calendar_open, quick_view_open, calls_open)),
1280 )
1281 .children(call_mini)
1282 .children(call_overlay)
1283 .children(stage_overlay)
1284 .children(self.image_viewer.clone())
1285 .children(self.switcher.clone())
1286 .children(render_task_dialog(self.state.read(cx), cx))
1287 .children(self.forward_dialog.clone())
1288 .children(self.status_dialog.clone())
1289 .children(self.shortcuts_dialog.clone())
1290 .children(self.agent_dialog.clone())
1291 .children(self.settings_dialog.clone())
1292 .children(self.profile_card.clone())
1293 .child(crate::frame_log::probe("last"))
1294 }
1295}