Start changing Avatar to use URI
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
parent
376716254f
commit
44d40625fe
19 changed files with 190 additions and 203 deletions
|
@ -1155,7 +1155,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()
|
||||
|
@ -2365,44 +2365,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())
|
||||
|
@ -2474,7 +2475,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(
|
||||
|
@ -2532,7 +2533,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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue