BlueGit

ict rusty-teams

Files

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

shell.rs

22925882 History
shell.rs 26.9 KiB Download Raw
1use gpui_kit::component::{h_flex, v_flex};
2use gpui_kit::*;
3
4use super::activity_panel::{ActivityPanel, ActivityPanelEvent};
5use super::call_mini::render_call_mini;
6use super::call_stage::render_stage_overlay;
7use super::call_view::render_call_view;
8use super::conversation::{ConversationView, ReplyToHovered};
9use super::dialog_overlay::render_task_dialog;
10use super::forward_dialog::{ForwardDialog, ForwardDialogEvent};
11use super::image_viewer::{ImageViewer, ImageViewerEvent};
12use super::profile_card::{ProfileCard, ProfileCardEvent};
13use super::rail::RailView;
14use super::saved_panel::{SavedPanel, SavedPanelEvent};
15use super::shortcuts::{
16 AcceptCall, DeclineCall, HangUpCall, NextConversation, OpenActivity, OpenChannelsTab,
17 OpenCallsTab, OpenChatsTab, OpenSaved, PreviousConversation, Scope, ShowShortcuts, ToggleCallCamera,
18 ToggleCallShare,
19};
20use super::shortcuts_dialog::{ShortcutsDialog, ShortcutsDialogEvent};
21use super::sidebar::{SIDEBAR_WIDTH, SidebarView};
22use super::status_bar::render_status_bar;
23use super::status_menu::own_status_button;
24use super::status_message_dialog::{StatusMessageDialog, StatusMessageDialogEvent};
25use super::switcher::{Switcher, SwitcherEvent, candidates_from};
26use super::title_bar::render_title_bar;
27use crate::activity::ActivityCenter;
28use crate::app_state::{AppEvent, AppState, Selection};
29use crate::call::{CallMedia, CallWindows};
30use crate::embedded_web::{Overlays, RootFocus};
31use crate::notice::NoticeAction;
32use crate::notify::{NotificationCenter, selection_for};
33use crate::sidebar_model::Step;
34use crate::theme;
35use crate::updater::{self, IdleInputs, UpdateStatus};
36
37actions!(teams, [OpenSwitcher, NewChat, ToggleCallMute]);
38
39pub fn bind_keys(cx: &mut App) {
40 super::composer::bind_keys(cx);
41 super::shortcuts::bind_scopes(cx, &[Scope::Global, Scope::OutsideComposer, Scope::GlobalOverTextFields]);
42}
43
44#[derive(Debug, Clone, Copy)]
45pub enum OpenTarget {
46 Chat(usize),
47 Channel(usize),
48}
49
50#[derive(Default)]
51pub struct Startup {
52 pub switcher_query: Option<String>,
53 pub composer_text: Option<String>,
54 pub reply_to_last: bool,
55}
56
57pub const ISLAND_GAP: f32 = 6.;
58
59pub struct AppShell {
60 state: Entity<AppState>,
61 rail: Entity<RailView>,
62 sidebar: Entity<SidebarView>,
63 conversation: Entity<ConversationView>,
64 call_chat: Option<(String, Entity<ConversationView>)>,
65 switcher: Option<Entity<Switcher>>,
66 notifications: Entity<NotificationCenter>,
67 _call_windows: Entity<CallWindows>,
68 forward_dialog: Option<Entity<ForwardDialog>>,
69 image_viewer: Option<Entity<ImageViewer>>,
70 status_dialog: Option<Entity<StatusMessageDialog>>,
71 shortcuts_dialog: Option<Entity<ShortcutsDialog>>,
72 profile_card: Option<Entity<ProfileCard>>,
73 focus_handle: FocusHandle,
74 open_target: Option<OpenTarget>,
75 update: UpdateStatus,
76 _subscription: Subscription,
77 _call_media_observation: Subscription,
78 _panel_subscriptions: [Subscription; 2],
79 _escape_observation: Subscription,
80 _activation_observation: Subscription,
81}
82
83impl AppShell {
84 fn sync_call_chat(&mut self, thread: Option<String>, window: &mut Window, cx: &mut Context<Self>) {
85 match (thread, &self.call_chat) {
86 (Some(wanted), Some((open, _))) if &wanted == open => {}
87 (Some(wanted), _) => {
88 let app = self.state.clone();
89 let selection = Selection::Chat(wanted.clone());
90 let view = cx.new(|cx| ConversationView::pinned_to(app, selection, window, cx));
91 self.call_chat = Some((wanted, view));
92 }
93 (None, _) => self.call_chat = None,
94 }
95 }
96
97 pub fn new(
98 state: Entity<AppState>,
99 open_target: Option<OpenTarget>,
100 startup: Startup,
101 window: &mut Window,
102 cx: &mut Context<Self>,
103 ) -> Self {
104 let call_media = cx.new(|_| CallMedia);
105 state.update(cx, |state, _| state.call_media = Some(call_media.clone()));
106 let call_media_observation = cx.observe(&call_media, |_, _, cx| cx.notify());
107 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
108 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
109 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
110 let panel_subscriptions = [
111 cx.subscribe(&activity_panel, |this, _, event: &ActivityPanelEvent, cx| match event {
112 ActivityPanelEvent::OpenSettings => this
113 .notifications
114 .update(cx, |center, cx| center.open_settings(cx)),
115 ActivityPanelEvent::Open {
116 conversation_id,
117 message_id,
118 } => this.open_message(conversation_id, message_id, cx),
119 }),
120 cx.subscribe(&saved_panel, |this, _, event: &SavedPanelEvent, cx| {
121 let SavedPanelEvent::Open {
122 conversation_id,
123 message_id,
124 } = event;
125 this.open_message(conversation_id, message_id, cx);
126 }),
127 ];
128 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, cx));
129 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
130 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
131 let subscription =
132 cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {
133 if matches!(event, AppEvent::Sidebar | AppEvent::Status) {
134 this.apply_open_target(cx);
135 }
136 if matches!(event, AppEvent::Forward) {
137 this.open_forward_dialog(window, cx);
138 }
139 if matches!(event, AppEvent::ImageViewer) {
140 this.open_image_viewer(window, cx);
141 }
142 if matches!(event, AppEvent::StatusMessage) {
143 this.open_status_dialog(window, cx);
144 }
145 if matches!(event, AppEvent::NotificationSettings) {
146 this.notifications
147 .update(cx, |center, cx| center.open_settings(cx));
148 }
149 if matches!(event, AppEvent::Profile) {
150 this.open_profile_card(window, cx);
151 }
152 cx.notify();
153 });
154 let focus_handle = cx.focus_handle();
155 window.focus(&focus_handle, cx);
156 cx.set_global(RootFocus(focus_handle.clone()));
157 let notifications = cx.new(|cx| NotificationCenter::new(state.clone(), window, cx));
158 let call_windows = cx.new(|cx| CallWindows::new(state.clone(), window, cx));
159 let escape_observation = cx.observe_keystrokes(|this, event, _, cx| {
160 if event.keystroke.key == "escape" {
161 this.state.update(cx, |state, cx| state.leave_stage_fullscreen(cx));
162 }
163 });
164 let activation_observation = cx.observe_window_activation(window, |this, window, cx| {
165 if window.is_window_active() {
166 this.state.update(cx, |state, cx| state.refresh_calendar(cx));
167 }
168 });
169 let closing = notifications.clone();
170 window.on_window_should_close(cx, move |_, cx| !closing.read(cx).intercept_close(cx));
171 let mut shell = AppShell {
172 state,
173 rail,
174 sidebar,
175 conversation,
176 call_chat: None,
177 switcher: None,
178 notifications,
179 _call_windows: call_windows,
180 forward_dialog: None,
181 image_viewer: None,
182 status_dialog: None,
183 shortcuts_dialog: None,
184 profile_card: None,
185 focus_handle,
186 open_target,
187 update: UpdateStatus::UpToDate,
188 _subscription: subscription,
189 _call_media_observation: call_media_observation,
190 _panel_subscriptions: panel_subscriptions,
191 _escape_observation: escape_observation,
192 _activation_observation: activation_observation,
193 };
194 shell.apply_open_target(cx);
195 let Startup {
196 switcher_query,
197 composer_text,
198 reply_to_last,
199 } = startup;
200 if let Some(query) = switcher_query {
201 shell.toggle_switcher(&query, window, cx);
202 }
203 if composer_text.is_some() || reply_to_last {
204 cx.defer_in(window, move |this, window, cx| {
205 this.conversation.update(cx, |conversation, cx| {
206 if reply_to_last {
207 conversation.reply_to_latest_from_others(window, cx);
208 }
209 if let Some(text) = composer_text {
210 conversation.set_composer_text(&text, window, cx);
211 }
212 });
213 });
214 }
215 #[cfg(windows)]
216 cx.spawn_in(window, async move |this, cx| {
217 loop {
218 cx.background_executor().timer(updater::POLL_INTERVAL).await;
219 if this
220 .update_in(cx, |this, window, cx| this.poll_update(window, cx))
221 .is_err()
222 {
223 break;
224 }
225 }
226 })
227 .detach();
228 shell
229 }
230
231 #[cfg_attr(not(windows), allow(dead_code))]
232 fn poll_update(&mut self, window: &mut Window, cx: &mut Context<Self>) {
233 if matches!(self.update, UpdateStatus::Failed(_) | UpdateStatus::Installing) {
234 return;
235 }
236 let Some(paths) = updater::current_paths() else {
237 return;
238 };
239 if self.update == UpdateStatus::UpToDate {
240 if !updater::check(&paths) {
241 return;
242 }
243 self.update = UpdateStatus::Ready;
244 let update_exe = paths.update_exe.clone();
245 cx.background_spawn(async move { updater::prescan(&update_exe) })
246 .detach();
247 }
248 let conversation = self.conversation.read(cx);
249 let idle = updater::is_idle(IdleInputs {
250 window_active: window.is_window_active(),
251 composer_empty: conversation.composer_is_empty(cx),
252 send_in_flight: conversation.send_in_flight(),
253 });
254 if idle {
255 self.restart_into_update(cx);
256 }
257 cx.notify();
258 }
259
260 fn restart_into_update(&mut self, cx: &mut Context<Self>) {
261 if self.update == UpdateStatus::Installing {
262 return;
263 }
264 let Some(paths) = updater::current_paths() else {
265 return;
266 };
267 self.update = UpdateStatus::Installing;
268 cx.notify();
269 cx.spawn(async move |this, cx| {
270 let result = cx
271 .background_spawn(async move { updater::install_and_relaunch(&paths) })
272 .await;
273 let _ = this.update(cx, |this, cx| {
274 match result {
275 Ok(()) => cx.quit(),
276 Err(message) => this.update = UpdateStatus::Failed(message),
277 }
278 cx.notify();
279 });
280 })
281 .detach();
282 }
283
284 fn apply_open_target(&mut self, cx: &mut Context<Self>) {
285 let Some(target) = self.open_target else {
286 return;
287 };
288 let sidebar = &self.state.read(cx).sidebar;
289 let selection = match target {
290 OpenTarget::Chat(index) => sidebar
291 .chats
292 .get(index)
293 .map(|chat| Selection::Chat(chat.id.clone())),
294 OpenTarget::Channel(index) => sidebar
295 .teams
296 .iter()
297 .flat_map(|team| team.channels.iter())
298 .nth(index)
299 .map(|channel| Selection::Channel(channel.id.clone())),
300 };
301 if let Some(selection) = selection {
302 self.open_target = None;
303 self.state
304 .update(cx, |state, cx| state.select(selection, cx));
305 }
306 }
307
308 fn toggle_switcher(
309 &mut self,
310 initial_query: &str,
311 window: &mut Window,
312 cx: &mut Context<Self>,
313 ) {
314 if self.switcher.take().is_some() {
315 self.restore_focus(window, cx);
316 cx.notify();
317 return;
318 }
319 self.close_image_viewer(window, cx);
320 let candidates = candidates_from(self.state.read(cx));
321 let app = self.state.clone();
322 let switcher = cx.new(|cx| Switcher::new(app, candidates, initial_query, window, cx));
323 cx.subscribe_in(
324 &switcher,
325 window,
326 |this, _, event: &SwitcherEvent, window, cx| {
327 match event {
328 SwitcherEvent::Pick(selection) => {
329 let selection = selection.clone();
330 this.state
331 .update(cx, |state, cx| state.select(selection, cx));
332 }
333 SwitcherEvent::PickMessage {
334 selection,
335 message_id,
336 } => {
337 let (selection, message_id) = (selection.clone(), message_id.clone());
338 this.state.update(cx, |state, cx| {
339 state.jump_to_message(selection, message_id, cx)
340 });
341 }
342 SwitcherEvent::Close => {}
343 }
344 this.switcher = None;
345 this.restore_focus(window, cx);
346 cx.notify();
347 },
348 )
349 .detach();
350 self.switcher = Some(switcher);
351 cx.notify();
352 }
353
354 fn open_message(&mut self, conversation_id: &str, message_id: &str, cx: &mut Context<Self>) {
355 let Some(selection) = selection_for(&self.state.read(cx).sidebar, conversation_id) else {
356 return;
357 };
358 let message_id = message_id.to_owned();
359 self.state.update(cx, |state, cx| {
360 if message_id.is_empty() {
361 state.select(selection, cx)
362 } else {
363 state.jump_to_message(selection, message_id, cx)
364 }
365 });
366 }
367
368 fn open_status_dialog(&mut self, window: &mut Window, cx: &mut Context<Self>) {
369 if !self
370 .state
371 .update(cx, |state, _| state.take_status_message_request())
372 {
373 return;
374 }
375 self.close_image_viewer(window, cx);
376 self.switcher = None;
377 let app = self.state.clone();
378 let dialog = cx.new(|cx| StatusMessageDialog::new(app, window, cx));
379 cx.subscribe_in(
380 &dialog,
381 window,
382 |this, _, _: &StatusMessageDialogEvent, window, cx| {
383 this.status_dialog = None;
384 this.restore_focus(window, cx);
385 cx.notify();
386 },
387 )
388 .detach();
389 self.status_dialog = Some(dialog);
390 cx.notify();
391 }
392
393 fn toggle_shortcuts_dialog(&mut self, window: &mut Window, cx: &mut Context<Self>) {
394 if self.shortcuts_dialog.take().is_some() {
395 self.restore_focus(window, cx);
396 cx.notify();
397 return;
398 }
399 self.close_image_viewer(window, cx);
400 self.switcher = None;
401 let dialog = cx.new(|cx| ShortcutsDialog::new(window, cx));
402 cx.subscribe_in(
403 &dialog,
404 window,
405 |this, _, _: &ShortcutsDialogEvent, window, cx| {
406 this.shortcuts_dialog = None;
407 this.restore_focus(window, cx);
408 cx.notify();
409 },
410 )
411 .detach();
412 self.shortcuts_dialog = Some(dialog);
413 cx.notify();
414 }
415
416 fn open_profile_card(&mut self, window: &mut Window, cx: &mut Context<Self>) {
417 let Some(request) = self
418 .state
419 .update(cx, |state, _| state.take_profile_request())
420 else {
421 return;
422 };
423 self.close_image_viewer(window, cx);
424 if let Some(card) = &self.profile_card {
425 card.update(cx, |card, cx| {
426 card.move_to(request.user_id, request.anchor, cx)
427 });
428 return;
429 }
430 let app = self.state.clone();
431 let card = cx.new(|cx| ProfileCard::new(app, request.user_id, request.anchor, window, cx));
432 cx.subscribe_in(
433 &card,
434 window,
435 |this, _, _: &ProfileCardEvent, window, cx| {
436 this.profile_card = None;
437 this.restore_focus(window, cx);
438 cx.notify();
439 },
440 )
441 .detach();
442 self.profile_card = Some(card);
443 cx.notify();
444 }
445
446 fn open_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
447 let Some(request) = self
448 .state
449 .update(cx, |state, _| state.take_image_viewer_request())
450 else {
451 return;
452 };
453 self.switcher = None;
454 let app = self.state.clone();
455 let viewer = cx.new(|cx| ImageViewer::new(app, request, window, cx));
456 cx.subscribe_in(
457 &viewer,
458 window,
459 |this, _, _: &ImageViewerEvent, window, cx| {
460 this.image_viewer = None;
461 window.focus(&this.focus_handle, cx);
462 cx.notify();
463 },
464 )
465 .detach();
466 self.image_viewer = Some(viewer);
467 cx.notify();
468 }
469
470 fn close_image_viewer(&mut self, window: &mut Window, cx: &mut Context<Self>) {
471 if self.image_viewer.take().is_some() {
472 window.focus(&self.focus_handle, cx);
473 cx.notify();
474 }
475 }
476
477 fn restore_focus(&self, window: &mut Window, cx: &mut Context<Self>) {
478 match &self.image_viewer {
479 Some(viewer) => {
480 let handle = viewer.read(cx).focus_handle();
481 window.focus(&handle, cx)
482 }
483 None => window.focus(&self.focus_handle, cx),
484 }
485 }
486
487 fn open_forward_dialog(&mut self, window: &mut Window, cx: &mut Context<Self>) {
488 let Some(source) = self
489 .state
490 .update(cx, |state, _| state.take_forward_request())
491 else {
492 return;
493 };
494 self.switcher = None;
495 let candidates = candidates_from(self.state.read(cx));
496 let app = self.state.clone();
497 let dialog = cx.new(|cx| ForwardDialog::new(app, source, candidates, window, cx));
498 cx.subscribe_in(
499 &dialog,
500 window,
501 |this, _, event: &ForwardDialogEvent, window, cx| {
502 this.forward_dialog = None;
503 this.restore_focus(window, cx);
504 if let ForwardDialogEvent::Sent { target, title } = event {
505 let target = target.clone();
506 let open = NoticeAction::new("Open", move |state, cx| {
507 state.select(target.clone(), cx)
508 });
509 this.state.update(cx, |state, cx| {
510 state.raise_notice(format!("Forwarded to {title}"), Some(open), cx)
511 });
512 }
513 cx.notify();
514 },
515 )
516 .detach();
517 self.forward_dialog = Some(dialog);
518 cx.notify();
519 }
520}
521
522impl AppShell {
523 fn islands(&self, call_view: Option<AnyElement>) -> impl IntoElement {
524 h_flex()
525 .flex_1()
526 .min_h_0()
527 .w_full()
528 .gap(px(ISLAND_GAP))
529 .pr(px(ISLAND_GAP))
530 .py(px(ISLAND_GAP))
531 .child(
532 h_flex()
533 .h_full()
534 .flex_none()
535 .child(self.rail.clone())
536 .child(
537 self.sidebar
538 .clone()
539 .cached(StyleRefinement::default().w(px(SIDEBAR_WIDTH)).h_full().flex_none()),
540 ),
541 )
542 .child(match call_view {
543 Some(call_view) => call_view,
544 None => self
545 .conversation
546 .clone()
547 .cached(
548 StyleRefinement::default()
549 .flex_1()
550 .min_w_0()
551 .h_full()
552 .rounded(px(10.))
553 .bg(theme::surface())
554 .overflow_hidden(),
555 )
556 .into_any_element(),
557 })
558 }
559}
560
561impl Render for AppShell {
562 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
563 if let Some(dialog) = self
564 .state
565 .read(cx)
566 .task_dialog
567 .as_ref()
568 .map(|dialog| (dialog.scope.clone(), dialog.card.clone()))
569 {
570 self.state.update(cx, |state, cx| {
571 state.ensure_card_inputs(&dialog.0, &dialog.1, window, cx)
572 });
573 }
574 if let Some(me) = self.state.read(cx).directory.me.clone() {
575 let app = self.state.clone();
576 cx.defer(move |cx| {
577 app.update(cx, |state, cx| {
578 state.request_avatars(vec![me.user_id.clone()], cx);
579 state.request_presence(vec![me.user_id], cx);
580 });
581 });
582 }
583 let panels = self.switcher.is_some()
584 || self.forward_dialog.is_some()
585 || self.image_viewer.is_some()
586 || self.status_dialog.is_some()
587 || self.shortcuts_dialog.is_some()
588 || self.profile_card.is_some()
589 || {
590 let state = self.state.read(cx);
591 state.task_dialog.is_some() || state.status_menu_open
592 };
593 Overlays::update(cx, |overlays| overlays.panels = panels);
594 let chat_thread = self.state.read(cx).call_chat_thread();
595 self.sync_call_chat(chat_thread, window, cx);
596 let chat_panel = self.call_chat.as_ref().map(|(_, view)| view.clone());
597 let state = self.state.read(cx);
598 let call_view = render_call_view(&self.state, state, chat_panel).filter(|_| state.viewing_call());
599 let call_mini = render_call_mini(&self.state, state);
600 let stage_overlay = render_stage_overlay(&self.state, state);
601 let status = render_status_bar(
602 state,
603 &self.update,
604 cx.listener(|this, _, _, cx| this.restart_into_update(cx)),
605 cx.listener(|this, _, _, cx| {
606 this.state
607 .update(cx, |state, cx| state.run_notice_action(cx))
608 }),
609 );
610 let title_bar = render_title_bar(
611 own_status_button(&self.state, state),
612 cx.listener(|this, _, window, cx| this.toggle_switcher("", window, cx)),
613 );
614 div()
615 .id("app-shell")
616 .key_context("AppShell")
617 .track_focus(&self.focus_handle)
618 .on_action(cx.listener(|this, _: &OpenSwitcher, window, cx| {
619 this.toggle_switcher("", window, cx);
620 }))
621 .on_action(cx.listener(|this, _: &NewChat, window, cx| {
622 this.close_image_viewer(window, cx);
623 this.state.update(cx, |state, cx| state.start_new_chat(cx));
624 }))
625 .on_action(cx.listener(|this, _: &ToggleCallMute, _, cx| {
626 this.state.update(cx, |state, cx| state.toggle_call_mute(cx));
627 }))
628 .on_action(cx.listener(|this, _: &ShowShortcuts, window, cx| {
629 this.toggle_shortcuts_dialog(window, cx);
630 }))
631 .on_action(cx.listener(|this, _: &OpenActivity, window, cx| {
632 this.close_image_viewer(window, cx);
633 this.sidebar.update(cx, |sidebar, cx| sidebar.show_activity(cx));
634 }))
635 .on_action(cx.listener(|this, _: &OpenSaved, window, cx| {
636 this.close_image_viewer(window, cx);
637 this.sidebar.update(cx, |sidebar, cx| sidebar.show_saved(cx));
638 }))
639 .on_action(cx.listener(|this, _: &OpenChatsTab, window, cx| {
640 this.close_image_viewer(window, cx);
641 this.sidebar.update(cx, |sidebar, cx| sidebar.show_chats(cx));
642 }))
643 .on_action(cx.listener(|this, _: &OpenChannelsTab, window, cx| {
644 this.close_image_viewer(window, cx);
645 this.sidebar.update(cx, |sidebar, cx| sidebar.show_channels(cx));
646 }))
647 .on_action(cx.listener(|this, _: &OpenCallsTab, window, cx| {
648 this.close_image_viewer(window, cx);
649 this.sidebar.update(cx, |sidebar, cx| sidebar.show_calls(cx));
650 }))
651 .on_action(cx.listener(|this, _: &PreviousConversation, window, cx| {
652 this.close_image_viewer(window, cx);
653 this.sidebar
654 .update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Previous, cx));
655 }))
656 .on_action(cx.listener(|this, _: &NextConversation, window, cx| {
657 this.close_image_viewer(window, cx);
658 this.sidebar
659 .update(cx, |sidebar, cx| sidebar.select_adjacent(Step::Next, cx));
660 }))
661 .on_action(cx.listener(|this, _: &AcceptCall, _, cx| {
662 this.state.update(cx, |state, cx| state.accept_ringing_call(cx));
663 }))
664 .on_action(cx.listener(|this, _: &DeclineCall, _, cx| {
665 this.state.update(cx, |state, cx| state.decline_ringing_call(cx));
666 }))
667 .on_action(cx.listener(|this, _: &HangUpCall, _, cx| {
668 this.state.update(cx, |state, cx| state.leave_call(cx));
669 }))
670 .on_action(cx.listener(|this, _: &ToggleCallCamera, _, cx| {
671 this.state.update(cx, |state, cx| state.toggle_call_camera(cx));
672 }))
673 .on_action(cx.listener(|this, _: &ToggleCallShare, _, cx| {
674 this.state.update(cx, |state, cx| state.toggle_call_share(cx));
675 }))
676 .on_action(cx.listener(|this, _: &ReplyToHovered, window, cx| {
677 this.close_image_viewer(window, cx);
678 this.conversation.update(cx, |conversation, cx| {
679 conversation.reply_to_hovered(window, cx)
680 });
681 }))
682 .relative()
683 .size_full()
684 .bg(theme::background())
685 .text_color(theme::text())
686 .text_size(px(14.))
687 .child(crate::frame_log::probe("first"))
688 .child(
689 v_flex()
690 .size_full()
691 .child(title_bar)
692 .child(self.islands(call_view))
693 .child(status),
694 )
695 .children(call_mini)
696 .children(stage_overlay)
697 .children(self.image_viewer.clone())
698 .children(self.switcher.clone())
699 .children(render_task_dialog(self.state.read(cx), cx))
700 .children(self.forward_dialog.clone())
701 .children(self.status_dialog.clone())
702 .children(self.shortcuts_dialog.clone())
703 .children(self.profile_card.clone())
704 .child(crate::frame_log::probe("last"))
705 }
706}