Detailed changes
@@ -2142,7 +2142,7 @@ impl CollabPanel {
}
fn render_signed_out(&mut self, cx: &mut ViewContext<Self>) -> Div {
- v_stack().child(
+ v_stack().border_1().border_color(gpui::red()).child(
Button::new("sign_in", "Sign in to collaborate").on_click(cx.listener(
|this, _, cx| {
let client = this.client.clone();
@@ -2301,9 +2301,14 @@ impl CollabPanel {
.into_any_element()
}),
Section::Contacts => Some(
- IconButton::new("add-contact", Icon::Plus)
- .on_click(cx.listener(|this, _, cx| this.toggle_contact_finder(cx)))
- .tooltip(|cx| Tooltip::text("Search for new contact", cx))
+ div()
+ .border_1()
+ .border_color(gpui::red())
+ .child(
+ IconButton::new("add-contact", Icon::Plus)
+ .on_click(cx.listener(|this, _, cx| this.toggle_contact_finder(cx)))
+ .tooltip(|cx| Tooltip::text("Search for new contact", cx)),
+ )
.into_any_element(),
),
Section::Channels => Some(
@@ -2323,7 +2328,7 @@ impl CollabPanel {
| Section::Offline => true,
};
- h_stack()
+ let mut row = h_stack()
.w_full()
.group("section-header")
.child(
@@ -2350,7 +2355,13 @@ impl CollabPanel {
.detach_and_log_err(cx)
},
))
- })
+ });
+
+ if section == Section::Offline {
+ row = div().border_1().border_color(gpui::red()).child(row);
+ }
+
+ row
}
fn render_contact(
@@ -11,14 +11,8 @@ use ui::{prelude::*, Avatar};
use util::{ResultExt as _, TryFutureExt};
use workspace::ModalView;
-pub fn init(cx: &mut AppContext) {
- //Picker::<ContactFinderDelegate>::init(cx);
- //cx.add_action(ContactFinder::dismiss)
-}
-
pub struct ContactFinder {
picker: View<Picker<ContactFinderDelegate>>,
- has_focus: bool,
}
impl ContactFinder {
@@ -31,16 +25,12 @@ impl ContactFinder {
};
let picker = cx.build_view(|cx| Picker::new(delegate, cx));
- Self {
- picker,
- has_focus: false,
- }
+ Self { picker }
}
pub fn set_query(&mut self, query: String, cx: &mut ViewContext<Self>) {
self.picker.update(cx, |picker, cx| {
- // todo!()
- // picker.set_query(query, cx);
+ picker.set_query(query, cx);
});
}
}
@@ -62,32 +52,9 @@ impl Render for ContactFinder {
.w(rems(34.))
}
- // fn focus_in(&mut self, _: gpui::AnyViewHandle, cx: &mut ViewContext<Self>) {
- // self.has_focus = true;
- // if cx.is_self_focused() {
- // cx.focus(&self.picker)
- // }
- // }
-
- // fn focus_out(&mut self, _: gpui::AnyViewHandle, _: &mut ViewContext<Self>) {
- // self.has_focus = false;
- // }
-
type Element = Div;
}
-// impl Modal for ContactFinder {
-// fn has_focus(&self) -> bool {
-// self.has_focus
-// }
-
-// fn dismiss_on_event(event: &Self::Event) -> bool {
-// match event {
-// PickerEvent::Dismiss => true,
-// }
-// }
-// }
-
pub struct ContactFinderDelegate {
parent: WeakView<ContactFinder>,
potential_contacts: Arc<[Arc<User>]>,
@@ -161,7 +128,6 @@ impl PickerDelegate for ContactFinderDelegate {
}
fn dismissed(&mut self, cx: &mut ViewContext<Picker<Self>>) {
- //cx.emit(PickerEvent::Dismiss);
self.parent
.update(cx, |_, cx| cx.emit(DismissEvent))
.log_err();
@@ -191,6 +157,7 @@ impl PickerDelegate for ContactFinderDelegate {
.child(Label::new(user.github_login.clone()))
.children(icon_path.map(|icon_path| svg().path(icon_path))),
)
+ // todo!()
// Flex::row()
// .with_children(user.avatar.clone().map(|avatar| {
// Image::from_data(avatar)
@@ -233,56 +233,68 @@ impl Render for CollabTitlebarItem {
}),
)
})
- .child(h_stack().px_1p5().map(|this| {
- if let Some(user) = current_user {
- // TODO: Finish implementing user menu popover
- //
- this.child(
- popover_menu("user-menu")
- .menu(|cx| {
- ContextMenu::build(cx, |menu, _| menu.header("ADADA"))
- })
- .trigger(
- ButtonLike::new("user-menu")
- .child(
- h_stack()
- .gap_0p5()
- .child(Avatar::new(user.avatar_uri.clone()))
+ .child(
+ h_stack()
+ .border_color(gpui::red())
+ .border_1()
+ .px_1p5()
+ .map(|this| {
+ if let Some(user) = current_user {
+ // TODO: Finish implementing user menu popover
+ //
+ this.child(
+ popover_menu("user-menu")
+ .menu(|cx| {
+ ContextMenu::build(cx, |menu, _| {
+ menu.header("ADADA")
+ })
+ })
+ .trigger(
+ ButtonLike::new("user-menu")
.child(
- IconElement::new(Icon::ChevronDown)
- .color(Color::Muted),
- ),
+ h_stack()
+ .gap_0p5()
+ .child(Avatar::new(
+ user.avatar_uri.clone(),
+ ))
+ .child(
+ IconElement::new(Icon::ChevronDown)
+ .color(Color::Muted),
+ ),
+ )
+ .style(ButtonStyle::Subtle)
+ .tooltip(move |cx| {
+ Tooltip::text("Toggle User Menu", cx)
+ }),
)
- .style(ButtonStyle::Subtle)
- .tooltip(move |cx| {
- Tooltip::text("Toggle User Menu", cx)
- }),
+ .anchor(gpui::AnchorCorner::TopRight),
)
- .anchor(gpui::AnchorCorner::TopRight),
- )
- // this.child(
- // ButtonLike::new("user-menu")
- // .child(
- // h_stack().gap_0p5().child(Avatar::data(avatar)).child(
- // IconElement::new(Icon::ChevronDown).color(Color::Muted),
- // ),
- // )
- // .style(ButtonStyle::Subtle)
- // .tooltip(move |cx| Tooltip::text("Toggle User Menu", cx)),
- // )
- } else {
- this.child(Button::new("sign_in", "Sign in").on_click(move |_, cx| {
- let client = client.clone();
- cx.spawn(move |mut cx| async move {
- client
- .authenticate_and_connect(true, &cx)
- .await
- .notify_async_err(&mut cx);
- })
- .detach();
- }))
- }
- })),
+ // this.child(
+ // ButtonLike::new("user-menu")
+ // .child(
+ // h_stack().gap_0p5().child(Avatar::data(avatar)).child(
+ // IconElement::new(Icon::ChevronDown).color(Color::Muted),
+ // ),
+ // )
+ // .style(ButtonStyle::Subtle)
+ // .tooltip(move |cx| Tooltip::text("Toggle User Menu", cx)),
+ // )
+ } else {
+ this.child(Button::new("sign_in", "Sign in").on_click(
+ move |_, cx| {
+ let client = client.clone();
+ cx.spawn(move |mut cx| async move {
+ client
+ .authenticate_and_connect(true, &cx)
+ .await
+ .notify_async_err(&mut cx);
+ })
+ .detach();
+ },
+ ))
+ }
+ }),
+ ),
)
}
}