diff --git a/assets/icons/zed_22.svg b/assets/icons/zed_22.svg
deleted file mode 100644
index 68e7dc8e57..0000000000
--- a/assets/icons/zed_22.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs
index bbe27ce3a9..c46861b5ab 100644
--- a/crates/collab_ui/src/collab_titlebar_item.rs
+++ b/crates/collab_ui/src/collab_titlebar_item.rs
@@ -163,8 +163,7 @@ impl CollabTitlebarItem {
if let Some(workspace) = self.workspace.upgrade(cx) {
let project = workspace.read(cx).project().clone();
let user_store = workspace.read(cx).user_store().clone();
- let view = cx
- .add_view(|cx| ContactsPopover::new(false, Some(project), user_store, cx));
+ let view = cx.add_view(|cx| ContactsPopover::new(project, user_store, cx));
cx.focus(&view);
cx.subscribe(&view, |this, _, event, cx| {
match event {
diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rs
index 221ee6068f..72595c2338 100644
--- a/crates/collab_ui/src/collab_ui.rs
+++ b/crates/collab_ui/src/collab_ui.rs
@@ -4,7 +4,6 @@ mod contact_list;
mod contact_notification;
mod contacts_popover;
mod incoming_call_notification;
-mod menu_bar_extra;
mod notifications;
mod project_shared_notification;
@@ -22,7 +21,6 @@ pub fn init(app_state: Arc, cx: &mut MutableAppContext) {
contact_finder::init(cx);
contacts_popover::init(cx);
incoming_call_notification::init(cx);
- menu_bar_extra::init(app_state.user_store.clone(), cx);
project_shared_notification::init(cx);
cx.add_global_action(move |action: &JoinProject, cx| {
diff --git a/crates/collab_ui/src/contact_list.rs b/crates/collab_ui/src/contact_list.rs
index da48015b4e..a539f8ffac 100644
--- a/crates/collab_ui/src/contact_list.rs
+++ b/crates/collab_ui/src/contact_list.rs
@@ -114,7 +114,7 @@ pub struct ContactList {
entries: Vec,
match_candidates: Vec,
list_state: ListState,
- project: Option>,
+ project: ModelHandle,
user_store: ModelHandle,
filter_editor: ViewHandle,
collapsed_sections: Vec,
@@ -124,7 +124,7 @@ pub struct ContactList {
impl ContactList {
pub fn new(
- project: Option>,
+ project: ModelHandle,
user_store: ModelHandle,
cx: &mut ViewContext,
) -> Self {
@@ -195,7 +195,7 @@ impl ContactList {
),
ContactEntry::Contact(contact) => Self::render_contact(
contact,
- this.project.as_ref(),
+ &this.project,
&theme.contact_list,
is_selected,
cx,
@@ -292,7 +292,7 @@ impl ContactList {
self.call(
&Call {
recipient_user_id: contact.user.id,
- initial_project: self.project.clone(),
+ initial_project: Some(self.project.clone()),
},
cx,
);
@@ -664,7 +664,7 @@ impl ContactList {
fn render_contact(
contact: &Contact,
- project: Option<&ModelHandle>,
+ project: &ModelHandle,
theme: &theme::ContactList,
is_selected: bool,
cx: &mut RenderContext,
@@ -672,7 +672,7 @@ impl ContactList {
let online = contact.online;
let busy = contact.busy;
let user_id = contact.user.id;
- let initial_project = project.cloned();
+ let initial_project = project.clone();
let mut element =
MouseEventHandler::::new(contact.user.id as usize, cx, |_, _| {
Flex::row()
@@ -726,7 +726,7 @@ impl ContactList {
if online && !busy {
cx.dispatch_action(Call {
recipient_user_id: user_id,
- initial_project: initial_project.clone(),
+ initial_project: Some(initial_project.clone()),
});
}
});
diff --git a/crates/collab_ui/src/contacts_popover.rs b/crates/collab_ui/src/contacts_popover.rs
index dd67cfe724..b9b1d254b6 100644
--- a/crates/collab_ui/src/contacts_popover.rs
+++ b/crates/collab_ui/src/contacts_popover.rs
@@ -23,9 +23,8 @@ enum Child {
}
pub struct ContactsPopover {
- is_popup: bool,
child: Child,
- project: Option>,
+ project: ModelHandle,
user_store: ModelHandle,
_subscription: Option,
_window_subscription: gpui::Subscription,
@@ -33,13 +32,11 @@ pub struct ContactsPopover {
impl ContactsPopover {
pub fn new(
- is_popup: bool,
- project: Option>,
+ project: ModelHandle,
user_store: ModelHandle,
cx: &mut ViewContext,
) -> Self {
let mut this = Self {
- is_popup,
child: Child::ContactList(
cx.add_view(|cx| ContactList::new(project.clone(), user_store.clone(), cx)),
),
@@ -103,21 +100,13 @@ impl View for ContactsPopover {
Child::ContactFinder(child) => ChildView::new(child),
};
- let mut container_style = theme.contacts_popover.container;
- if self.is_popup {
- container_style.shadow = Default::default();
- container_style.border = Default::default();
- container_style.corner_radius = Default::default();
- child.contained().with_style(container_style).boxed()
- } else {
- child
- .contained()
- .with_style(container_style)
- .constrained()
- .with_width(theme.contacts_popover.width)
- .with_height(theme.contacts_popover.height)
- .boxed()
- }
+ child
+ .contained()
+ .with_style(theme.contacts_popover.container)
+ .constrained()
+ .with_width(theme.contacts_popover.width)
+ .with_height(theme.contacts_popover.height)
+ .boxed()
}
fn on_focus_in(&mut self, _: gpui::AnyViewHandle, cx: &mut ViewContext) {
diff --git a/crates/collab_ui/src/menu_bar_extra.rs b/crates/collab_ui/src/menu_bar_extra.rs
deleted file mode 100644
index 1db9ceaabd..0000000000
--- a/crates/collab_ui/src/menu_bar_extra.rs
+++ /dev/null
@@ -1,125 +0,0 @@
-use crate::contacts_popover::{self, ContactsPopover};
-use call::ActiveCall;
-use client::UserStore;
-use gpui::{
- actions,
- color::Color,
- elements::*,
- geometry::{rect::RectF, vector::vec2f},
- Appearance, Entity, ModelHandle, MouseButton, MutableAppContext, RenderContext, View,
- ViewContext, ViewHandle, WindowKind,
-};
-
-actions!(menu_bar_extra, [ToggleActiveCallPopover]);
-
-pub fn init(user_store: ModelHandle, cx: &mut MutableAppContext) {
- cx.add_action(MenuBarExtra::toggle_active_call_popover);
-
- let mut status_bar_item_id = None;
- cx.observe(&ActiveCall::global(cx), move |call, cx| {
- let had_room = status_bar_item_id.is_some();
- let has_room = call.read(cx).room().is_some();
- if had_room != has_room {
- if let Some(status_bar_item_id) = status_bar_item_id.take() {
- cx.remove_status_bar_item(status_bar_item_id);
- }
-
- if has_room {
- let (id, _) = cx.add_status_bar_item(|_| MenuBarExtra::new(user_store.clone()));
- status_bar_item_id = Some(id);
- }
- }
- })
- .detach();
-}
-
-struct MenuBarExtra {
- popover: Option>,
- user_store: ModelHandle,
-}
-
-impl Entity for MenuBarExtra {
- type Event = ();
-
- fn release(&mut self, cx: &mut MutableAppContext) {
- if let Some(popover) = self.popover.take() {
- cx.remove_window(popover.window_id());
- }
- }
-}
-
-impl View for MenuBarExtra {
- fn ui_name() -> &'static str {
- "MenuBarExtra"
- }
-
- fn render(&mut self, cx: &mut RenderContext) -> ElementBox {
- let color = match cx.appearance {
- Appearance::Light | Appearance::VibrantLight => Color::black(),
- Appearance::Dark | Appearance::VibrantDark => Color::white(),
- };
- MouseEventHandler::::new(0, cx, |_, _| {
- Svg::new("icons/zed_22.svg")
- .with_color(color)
- .aligned()
- .boxed()
- })
- .on_click(MouseButton::Left, |_, cx| {
- cx.dispatch_action(ToggleActiveCallPopover);
- })
- .boxed()
- }
-}
-
-impl MenuBarExtra {
- fn new(user_store: ModelHandle) -> Self {
- Self {
- popover: None,
- user_store,
- }
- }
-
- fn toggle_active_call_popover(
- &mut self,
- _: &ToggleActiveCallPopover,
- cx: &mut ViewContext,
- ) {
- match self.popover.take() {
- Some(popover) => {
- cx.remove_window(popover.window_id());
- }
- None => {
- let window_bounds = cx.window_bounds();
- let size = vec2f(300., 350.);
- let origin = window_bounds.lower_left()
- + vec2f(window_bounds.width() / 2. - size.x() / 2., 0.);
- let (_, popover) = cx.add_window(
- gpui::WindowOptions {
- bounds: gpui::WindowBounds::Fixed(RectF::new(origin, size)),
- titlebar: None,
- center: false,
- kind: WindowKind::PopUp,
- is_movable: false,
- },
- |cx| ContactsPopover::new(true, None, self.user_store.clone(), cx),
- );
- cx.subscribe(&popover, Self::on_popover_event).detach();
- self.popover = Some(popover);
- }
- }
- }
-
- fn on_popover_event(
- &mut self,
- popover: ViewHandle,
- event: &contacts_popover::Event,
- cx: &mut ViewContext,
- ) {
- match event {
- contacts_popover::Event::Dismissed => {
- self.popover.take();
- cx.remove_window(popover.window_id());
- }
- }
- }
-}