diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rs index 57d6f7b4f6..76d4427aea 100644 --- a/crates/collab_ui/src/collab_ui.rs +++ b/crates/collab_ui/src/collab_ui.rs @@ -8,7 +8,6 @@ mod incoming_call_notification; mod notifications; mod panel_settings; pub mod project_shared_notification; -mod sharing_status_indicator; use call::{report_call_event_for_room, ActiveCall, Room}; use gpui::{ @@ -42,7 +41,6 @@ pub fn init(app_state: &Arc, cx: &mut AppContext) { chat_panel::init(cx); incoming_call_notification::init(&app_state, cx); project_shared_notification::init(&app_state, cx); - sharing_status_indicator::init(cx); cx.add_global_action(toggle_screen_sharing); cx.add_global_action(toggle_mute); diff --git a/crates/collab_ui/src/sharing_status_indicator.rs b/crates/collab_ui/src/sharing_status_indicator.rs deleted file mode 100644 index 6a6acb4b70..0000000000 --- a/crates/collab_ui/src/sharing_status_indicator.rs +++ /dev/null @@ -1,62 +0,0 @@ -use crate::toggle_screen_sharing; -use call::ActiveCall; -use gpui::{ - color::Color, - elements::{MouseEventHandler, Svg}, - platform::{Appearance, MouseButton}, - AnyElement, AppContext, Element, Entity, View, ViewContext, -}; -use workspace::WorkspaceSettings; - -pub fn init(cx: &mut AppContext) { - let active_call = ActiveCall::global(cx); - - let mut status_indicator = None; - cx.observe(&active_call, move |call, cx| { - if let Some(room) = call.read(cx).room() { - if room.read(cx).is_screen_sharing() { - if status_indicator.is_none() - && settings::get::(cx).show_call_status_icon - { - status_indicator = Some(cx.add_status_bar_item(|_| SharingStatusIndicator)); - } - } else if let Some(window) = status_indicator.take() { - window.update(cx, |cx| cx.remove_window()); - } - } else if let Some(window) = status_indicator.take() { - window.update(cx, |cx| cx.remove_window()); - } - }) - .detach(); -} - -pub struct SharingStatusIndicator; - -impl Entity for SharingStatusIndicator { - type Event = (); -} - -impl View for SharingStatusIndicator { - fn ui_name() -> &'static str { - "SharingStatusIndicator" - } - - fn render(&mut self, cx: &mut ViewContext) -> AnyElement { - let color = match cx.window_appearance() { - Appearance::Light | Appearance::VibrantLight => Color::black(), - Appearance::Dark | Appearance::VibrantDark => Color::white(), - }; - - MouseEventHandler::new::(0, cx, |_, _| { - Svg::new("icons/desktop.svg") - .with_color(color) - .constrained() - .with_width(18.) - .aligned() - }) - .on_click(MouseButton::Left, |_, _, cx| { - toggle_screen_sharing(&Default::default(), cx) - }) - .into_any() - } -}