Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Merge branch 'main' into collab-panel2
Conrad Irwin01d3432a403e
diff --cc crates/collab_ui2/src/collab_panel/contact_finder.rsindex 80872db729c,d0c12a7f90a..48453ada72f--- a/crates/collab_ui2/src/collab_panel/contact_finder.rs+++ b/crates/collab_ui2/src/collab_panel/contact_finder.rs@@@ -168,9 -197,13 +168,9 @@@ impl PickerDelegate for ContactFinderDefn render_match(&self,ix: usize,- mouse_state: &mut MouseState,selected: bool,- cx: &gpui::AppContext,- ) -> AnyElement<Picker<Self>> {- let full_theme = &theme::current(cx);- let theme = &full_theme.collab_panel.contact_finder;- let tabbed_modal = &full_theme.collab_panel.tabbed_modal;+ cx: &mut ViewContext<Picker<Self>>,- ) -> Self::ListItem {++ ) -> Option<Self::ListItem> {let user = &self.potential_contacts[ix];let request_status = self.user_store.read(cx).contact_request_status(user);@@@ -181,45 -214,48 +181,47 @@@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()+ dbg!(icon_path);- div()- .flex_1()- .justify_between()- .children(user.avatar.clone().map(|avatar| img().data(avatar)))- .child(Label::new(user.github_login.clone()))- .children(icon_path.map(|icon_path| svg().path(icon_path)))++ Some(++ div()++ .flex_1()++ .justify_between()++ .children(user.avatar.clone().map(|avatar| img().data(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/list.rsindex ecdd32d168f,6683c9a0cff..d17c77ea445--- a/crates/ui2/src/components/list.rs+++ b/crates/ui2/src/components/list.rs@@@ -1,12 -1,13 +1,14 @@@+ use std::rc::Rc;+use gpui::{- div, px, AnyElement, Div, ImageSource, IntoElement, MouseButton, MouseDownEvent, Stateful,- div, px, AnyElement, ClickEvent, Div, IntoElement, MouseButton, MouseDownEvent, Pixels,- Stateful, StatefulInteractiveElement,++ div, px, AnyElement, ClickEvent, Div, ImageSource, IntoElement, MouseButton, MouseDownEvent,++ Pixels, Stateful, StatefulInteractiveElement,};use smallvec::SmallVec;- use std::rc::Rc;use crate::{- disclosure_control, h_stack, v_stack, Avatar, Icon, IconElement, IconSize, Label, Toggle,+ disclosure_control, h_stack, v_stack, Avatar, Icon, IconButton, IconElement, IconSize, Label,+ Toggle,};use crate::{prelude::*, GraphicSlot};@@@ -348,25 -292,29 +292,20 @@@ impl RenderOnce for ListItem// this.border()// .border_color(cx.theme().colors().border_focused)// })- //.hover(|style| style.bg(cx.theme().colors().ghost_element_hover))- //.active(|style| style.bg(cx.theme().colors().ghost_element_active))+ .hover(|style| style.bg(cx.theme().colors().ghost_element_hover))+ .active(|style| style.bg(cx.theme().colors().ghost_element_active))+ .when(self.selected, |this| {+ this.bg(cx.theme().colors().ghost_element_selected)+ })- .when_some(self.on_click.clone(), |this, on_click| {- this.on_click(move |event, cx| {- // HACK: GPUI currently fires `on_click` with any mouse button,- // but we only care about the left button.- if event.down.button == MouseButton::Left {- (on_click)(event, cx)- }- })- })+ .when_some(self.on_secondary_mouse_down, |this, on_mouse_down| {+ this.on_mouse_down(MouseButton::Right, move |event, cx| {+ (on_mouse_down)(event, cx)+ })+ }).child(- sized_item+ div().when(self.variant == ListItemVariant::Inset, |this| this.px_2())- // .ml(rems(0.75 * self.indent_level as f32))- .children((0..self.indent_level).map(|_| {- div()- .w(px(4.))- .h_full()- .flex()- .justify_center()- .group_hover("", |style| style.bg(cx.theme().colors().border_focused))- .child(- h_stack()- .child(div().w_px().h_full())- .child(div().w_px().h_full().bg(cx.theme().colors().border)),- )- }))+ .ml(self.indent_level as f32 * self.indent_step_size).flex().gap_1().items_center()