Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge remote-tracking branch 'origin/main' into surfaces

Antonio Scandurracc0bc444b1fa
diff --cc crates/collab_ui2/src/collab_panel/contact_finder.rs
index d0c12a7f90a,fee04ec40c0..717ab2d8970
--- a/crates/collab_ui2/src/collab_panel/contact_finder.rs
+++ b/crates/collab_ui2/src/collab_panel/contact_finder.rs
@@@ -214,48 -181,46 +181,46 @@@ impl PickerDelegate for ContactFinderDe
ContactRequestStatus::RequestSent => Some("icons/x.svg"),
ContactRequestStatus::RequestAccepted => None,
};
- let button_style = if self.user_store.read(cx).is_contact_request_pending(user) {
- &theme.disabled_contact_button
- } else {
- &theme.contact_button
- };
- let style = tabbed_modal
- .picker
- .item
- .in_state(selected)
- .style_for(mouse_state);
- Flex::row()
- .with_children(user.avatar.clone().map(|avatar| {
- Image::from_data(avatar)
- .with_style(theme.contact_avatar)
- .aligned()
- .left()
- }))
- .with_child(
- Label::new(user.github_login.clone(), style.label.clone())
- .contained()
- .with_style(theme.contact_username)
- .aligned()
- .left(),
- )
- .with_children(icon_path.map(|icon_path| {
- Svg::new(icon_path)
- .with_color(button_style.color)
- .constrained()
- .with_width(button_style.icon_width)
- .aligned()
- .contained()
- .with_style(button_style.container)
- .constrained()
- .with_width(button_style.button_width)
- .with_height(button_style.button_width)
- .aligned()
- .flex_float()
- }))
- .contained()
- .with_style(style.container)
- .constrained()
- .with_height(tabbed_modal.row_height)
- .into_any()
+ Some(
+ div()
+ .flex_1()
+ .justify_between()
- .children(user.avatar.clone().map(|avatar| img().data(avatar)))
++ .children(user.avatar.clone().map(|avatar| img(avatar)))
+ .child(Label::new(user.github_login.clone()))
+ .children(icon_path.map(|icon_path| svg().path(icon_path))),
+ )
+ // Flex::row()
+ // .with_children(user.avatar.clone().map(|avatar| {
+ // Image::from_data(avatar)
+ // .with_style(theme.contact_avatar)
+ // .aligned()
+ // .left()
+ // }))
+ // .with_child(
+ // Label::new(user.github_login.clone(), style.label.clone())
+ // .contained()
+ // .with_style(theme.contact_username)
+ // .aligned()
+ // .left(),
+ // )
+ // .with_children(icon_path.map(|icon_path| {
+ // Svg::new(icon_path)
+ // .with_color(button_style.color)
+ // .constrained()
+ // .with_width(button_style.icon_width)
+ // .aligned()
+ // .contained()
+ // .with_style(button_style.container)
+ // .constrained()
+ // .with_width(button_style.button_width)
+ // .with_height(button_style.button_width)
+ // .aligned()
+ // .flex_float()
+ // }))
+ // .contained()
+ // .with_style(style.container)
+ // .constrained()
+ // .with_height(tabbed_modal.row_height)
+ // .into_any()
}
}
diff --cc crates/ui2/src/components/avatar.rs
index f74a7d02ead,4d374d7bb19..3c8eefa6db2
--- a/crates/ui2/src/components/avatar.rs
+++ b/crates/ui2/src/components/avatar.rs
@@@ -17,10 -18,10 +18,10 @@@ pub struct Avatar
}
impl RenderOnce for Avatar {
- type Rendered = Img;
+ type Rendered = Div;
- fn render(self, _: &mut WindowContext) -> Self::Rendered {
+ fn render(self, cx: &mut WindowContext) -> Self::Rendered {
- let mut img = img();
+ let mut img = img(self.src);
if self.shape == Shape::Circle {
img = img.rounded_full();
@@@ -28,9 -29,29 +29,28 @@@
img = img.rounded_md();
}
- img.size_4()
- // todo!(Pull the avatar fallback background from the theme.)
- .bg(gpui::red())
+ let size = rems(1.0);
+
+ div()
+ .size(size)
+ .child(
- img.source(self.src.clone())
- .size(size)
++ img.size(size)
+ // todo!(Pull the avatar fallback background from the theme.)
+ .bg(gpui::red()),
+ )
+ .children(self.is_available.map(|is_free| {
+ // HACK: non-integer sizes result in oval indicators.
+ let indicator_size = (size.0 * cx.rem_size() * 0.4).round();
+
+ div()
+ .absolute()
+ .z_index(1)
+ .bg(if is_free { gpui::green() } else { gpui::red() })
+ .size(indicator_size)
+ .rounded(indicator_size)
+ .bottom_0()
+ .right_0()
+ }))
}
}