zed2 notification panel (#3603)

Release Notes:

- N/A
This commit is contained in:
Julia 2023-12-12 18:04:47 -05:00 committed by GitHub
commit 2e00da5a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 874 additions and 1098 deletions

View file

@ -19,6 +19,7 @@ mod contact_finder;
use contact_finder::ContactFinder;
use menu::{Cancel, Confirm, SelectNext, SelectPrev};
use rpc::proto::{self, PeerId};
use smallvec::SmallVec;
use theme::{ActiveTheme, ThemeSettings};
// use context_menu::{ContextMenu, ContextMenuItem};
// use db::kvp::KEY_VALUE_STORE;
@ -1155,7 +1156,7 @@ impl CollabPanel {
let tooltip = format!("Follow {}", user.github_login);
ListItem::new(SharedString::from(user.github_login.clone()))
.left_child(Avatar::data(user.avatar.clone().unwrap()))
.left_child(Avatar::new(user.avatar_uri.clone()))
.child(
h_stack()
.w_full()
@ -2349,44 +2350,45 @@ impl CollabPanel {
let busy = contact.busy || calling;
let user_id = contact.user.id;
let github_login = SharedString::from(contact.user.github_login.clone());
let mut item = ListItem::new(github_login.clone())
.on_click(cx.listener(move |this, _, cx| this.call(user_id, cx)))
.child(
h_stack()
.w_full()
.justify_between()
.child(Label::new(github_login.clone()))
.when(calling, |el| {
el.child(Label::new("Calling").color(Color::Muted))
})
.when(!calling, |el| {
el.child(
div()
.id("remove_contact")
.invisible()
.group_hover("", |style| style.visible())
.child(
IconButton::new("remove_contact", Icon::Close)
.icon_color(Color::Muted)
.tooltip(|cx| Tooltip::text("Remove Contact", cx))
.on_click(cx.listener({
let github_login = github_login.clone();
move |this, _, cx| {
this.remove_contact(user_id, &github_login, cx);
}
})),
),
)
}),
)
.left_child(
// todo!() handle contacts with no avatar
Avatar::data(contact.user.avatar.clone().unwrap())
.availability_indicator(if online { Some(!busy) } else { None }),
)
.when(online && !busy, |el| {
el.on_click(cx.listener(move |this, _, cx| this.call(user_id, cx)))
});
let mut item =
ListItem::new(github_login.clone())
.on_click(cx.listener(move |this, _, cx| this.call(user_id, cx)))
.child(
h_stack()
.w_full()
.justify_between()
.child(Label::new(github_login.clone()))
.when(calling, |el| {
el.child(Label::new("Calling").color(Color::Muted))
})
.when(!calling, |el| {
el.child(
div()
.id("remove_contact")
.invisible()
.group_hover("", |style| style.visible())
.child(
IconButton::new("remove_contact", Icon::Close)
.icon_color(Color::Muted)
.tooltip(|cx| Tooltip::text("Remove Contact", cx))
.on_click(cx.listener({
let github_login = github_login.clone();
move |this, _, cx| {
this.remove_contact(user_id, &github_login, cx);
}
})),
),
)
}),
)
.left_child(
// todo!() handle contacts with no avatar
Avatar::new(contact.user.avatar_uri.clone())
.availability_indicator(if online { Some(!busy) } else { None }),
)
.when(online && !busy, |el| {
el.on_click(cx.listener(move |this, _, cx| this.call(user_id, cx)))
});
div()
.id(github_login.clone())
@ -2458,7 +2460,7 @@ impl CollabPanel {
.child(Label::new(github_login.clone()))
.child(h_stack().children(controls)),
)
.when_some(user.avatar.clone(), |el, avatar| el.left_avatar(avatar))
.left_avatar(user.avatar_uri.clone())
}
fn render_contact_placeholder(
@ -2516,7 +2518,9 @@ impl CollabPanel {
let result = FacePile {
faces: participants
.iter()
.filter_map(|user| Some(Avatar::data(user.avatar.clone()?).into_any_element()))
.filter_map(|user| {
Some(Avatar::new(user.avatar_uri.clone()).into_any_element())
})
.take(FACEPILE_LIMIT)
.chain(if extra_count > 0 {
// todo!() @nate - this label looks wrong.
@ -2524,7 +2528,7 @@ impl CollabPanel {
} else {
None
})
.collect::<Vec<_>>(),
.collect::<SmallVec<_>>(),
};
Some(result)