Close contacts popover when call ends
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
e9464815e0
commit
ae87961a77
1 changed files with 24 additions and 5 deletions
|
@ -140,7 +140,7 @@ impl CollabTitlebarItem {
|
|||
let active_call = ActiveCall::global(cx);
|
||||
let mut subscriptions = Vec::new();
|
||||
subscriptions.push(cx.observe(workspace, |_, _, cx| cx.notify()));
|
||||
subscriptions.push(cx.observe(&active_call, |_, _, cx| cx.notify()));
|
||||
subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
|
||||
subscriptions.push(cx.observe_window_activation(|this, active, cx| {
|
||||
this.window_activation_changed(active, cx)
|
||||
}));
|
||||
|
@ -191,6 +191,13 @@ impl CollabTitlebarItem {
|
|||
}
|
||||
}
|
||||
|
||||
fn active_call_changed(&mut self, cx: &mut ViewContext<Self>) {
|
||||
if ActiveCall::global(cx).read(cx).room().is_none() {
|
||||
self.contacts_popover = None;
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn share_project(&mut self, _: &ShareProject, cx: &mut ViewContext<Self>) {
|
||||
if let Some(workspace) = self.workspace.upgrade(cx) {
|
||||
let active_call = ActiveCall::global(cx);
|
||||
|
@ -397,7 +404,11 @@ impl CollabTitlebarItem {
|
|||
.boxed(),
|
||||
)
|
||||
.with_children(badge)
|
||||
.with_children(self.contacts_popover_host(ContactsPopoverSide::Left, titlebar, cx))
|
||||
.with_children(self.render_contacts_popover_host(
|
||||
ContactsPopoverSide::Left,
|
||||
titlebar,
|
||||
cx,
|
||||
))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
|
@ -499,7 +510,11 @@ impl CollabTitlebarItem {
|
|||
)
|
||||
.boxed(),
|
||||
)
|
||||
.with_children(self.contacts_popover_host(ContactsPopoverSide::Right, titlebar, cx))
|
||||
.with_children(self.render_contacts_popover_host(
|
||||
ContactsPopoverSide::Right,
|
||||
titlebar,
|
||||
cx,
|
||||
))
|
||||
.aligned()
|
||||
.contained()
|
||||
.with_margin_left(theme.workspace.titlebar.avatar_margin)
|
||||
|
@ -543,7 +558,11 @@ impl CollabTitlebarItem {
|
|||
)
|
||||
.boxed(),
|
||||
)
|
||||
.with_children(self.contacts_popover_host(ContactsPopoverSide::Right, titlebar, cx))
|
||||
.with_children(self.render_contacts_popover_host(
|
||||
ContactsPopoverSide::Right,
|
||||
titlebar,
|
||||
cx,
|
||||
))
|
||||
.aligned()
|
||||
.contained()
|
||||
.with_margin_left(theme.workspace.titlebar.avatar_margin)
|
||||
|
@ -551,7 +570,7 @@ impl CollabTitlebarItem {
|
|||
.boxed()
|
||||
}
|
||||
|
||||
fn contacts_popover_host<'a>(
|
||||
fn render_contacts_popover_host<'a>(
|
||||
&'a self,
|
||||
side: ContactsPopoverSide,
|
||||
theme: &'a theme::Titlebar,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue