From 196df1c37889f3b220a41da4e5fd6f8024183b35 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 18 Dec 2023 11:33:37 -0500 Subject: [PATCH 1/5] Start on collab panel empty state --- crates/collab_ui2/src/collab_panel.rs | 41 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rs index 5f01d4987838961e9c7e086ec1f115e527bbee33..a845e117d5f1ffa2e3b21f60fec4d3817aca2aa3 100644 --- a/crates/collab_ui2/src/collab_panel.rs +++ b/crates/collab_ui2/src/collab_panel.rs @@ -2027,20 +2027,33 @@ impl CollabPanel { } fn render_signed_out(&mut self, cx: &mut ViewContext) -> Div { - 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(); - cx.spawn(|_, mut cx| async move { - client - .authenticate_and_connect(true, &cx) - .await - .notify_async_err(&mut cx); - }) - .detach() - }, - )), - ) + v_stack() + .justify_center() + .items_center() + .child(v_stack().gap_1().p_4() + .child( + Label::new("Work with your team with realtive collaborative editing, voice, shared notes and more.") + ) + .child( + Label::new("Sign in to enable collaboration.") + ) + .child( + Button::new("sign_in", "Sign in") + .style(ButtonStyle::Filled) + .full_width() + .on_click(cx.listener( + |this, _, cx| { + let client = this.client.clone(); + cx.spawn(|_, mut cx| async move { + client + .authenticate_and_connect(true, &cx) + .await + .notify_async_err(&mut cx); + }) + .detach() + }, + )), + )) } fn render_list_entry(&mut self, ix: usize, cx: &mut ViewContext) -> AnyElement { From d72cd3795aba48be2f4a0c37821eef12dc4a34d7 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 18 Dec 2023 12:56:50 -0500 Subject: [PATCH 2/5] Fix implementation of full_width and icon_position in button --- crates/ui2/src/components/button/button.rs | 33 +++++++++++-------- .../ui2/src/components/button/button_like.rs | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/crates/ui2/src/components/button/button.rs b/crates/ui2/src/components/button/button.rs index fc7ca2c12872142e5e41a8a2a96e6c8fe764697a..014a2f536278e6064769a5605eb43dafd01a4ee0 100644 --- a/crates/ui2/src/components/button/button.rs +++ b/crates/ui2/src/components/button/button.rs @@ -151,26 +151,31 @@ impl RenderOnce for Button { self.base.child( h_stack() .gap_1() - .map(|this| { - if self.icon_position == Some(IconPosition::End) { - this.flex_row_reverse() - } else { - this - } + .when(self.icon_position.is_some(), |this| { + this.children(self.icon.map(|icon| { + ButtonIcon::new(icon) + .disabled(is_disabled) + .selected(is_selected) + .selected_icon(self.selected_icon) + .size(self.icon_size) + .color(self.icon_color) + })) }) .child( Label::new(label) .color(label_color) .line_height_style(LineHeightStyle::UILabel), ) - .children(self.icon.map(|icon| { - ButtonIcon::new(icon) - .disabled(is_disabled) - .selected(is_selected) - .selected_icon(self.selected_icon) - .size(self.icon_size) - .color(self.icon_color) - })), + .when(!self.icon_position.is_some(), |this| { + this.children(self.icon.map(|icon| { + ButtonIcon::new(icon) + .disabled(is_disabled) + .selected(is_selected) + .selected_icon(self.selected_icon) + .size(self.icon_size) + .color(self.icon_color) + })) + }), ) } } diff --git a/crates/ui2/src/components/button/button_like.rs b/crates/ui2/src/components/button/button_like.rs index 8255490476b8a58f4a39d03de10412151f320db6..54f2a0e9eaa0a7a87a93927088bc3a6e7975c06b 100644 --- a/crates/ui2/src/components/button/button_like.rs +++ b/crates/ui2/src/components/button/button_like.rs @@ -355,7 +355,7 @@ impl RenderOnce for ButtonLike { .group("") .flex_none() .h(self.size.height()) - .when_some(self.width, |this, width| this.w(width)) + .when_some(self.width, |this, width| this.w(width).justify_center()) .rounded_md() .gap_1() .map(|this| match self.size { From eeaa1e5cf9a6ea0369bf237705439b392f9ad382 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 18 Dec 2023 12:56:57 -0500 Subject: [PATCH 3/5] Add github icon --- assets/icons/github.svg | 1 + crates/ui2/src/components/icon.rs | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 assets/icons/github.svg diff --git a/assets/icons/github.svg b/assets/icons/github.svg new file mode 100644 index 0000000000000000000000000000000000000000..28148b9894b21f0f5995f3ffcfc464b161f3169a --- /dev/null +++ b/assets/icons/github.svg @@ -0,0 +1 @@ + diff --git a/crates/ui2/src/components/icon.rs b/crates/ui2/src/components/icon.rs index 6876630100e95d3ec23252e80787642263783d56..6216acac483489f283366177fe5b6416495122c9 100644 --- a/crates/ui2/src/components/icon.rs +++ b/crates/ui2/src/components/icon.rs @@ -67,6 +67,7 @@ pub enum Icon { Folder, FolderOpen, FolderX, + Github, Hash, InlayHint, Link, @@ -147,6 +148,7 @@ impl Icon { Icon::Folder => "icons/file_icons/folder.svg", Icon::FolderOpen => "icons/file_icons/folder_open.svg", Icon::FolderX => "icons/stop_sharing.svg", + Icon::Github => "icons/github.svg", Icon::Hash => "icons/hash.svg", Icon::InlayHint => "icons/inlay_hint.svg", Icon::Link => "icons/link.svg", From 89b231afebe71e270025ba4556d66d08aa58e1b8 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 18 Dec 2023 13:09:46 -0500 Subject: [PATCH 4/5] Update collab panel signed out state --- crates/collab_ui2/src/collab_panel.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rs index a845e117d5f1ffa2e3b21f60fec4d3817aca2aa3..18d9916bb3881cf316863510c278c6754711d7f7 100644 --- a/crates/collab_ui2/src/collab_panel.rs +++ b/crates/collab_ui2/src/collab_panel.rs @@ -2028,17 +2028,20 @@ impl CollabPanel { fn render_signed_out(&mut self, cx: &mut ViewContext) -> Div { v_stack() - .justify_center() + // .flex_1() + // .justify_center() .items_center() - .child(v_stack().gap_1().p_4() + .child(v_stack().gap_6().p_4() .child( - Label::new("Work with your team with realtive collaborative editing, voice, shared notes and more.") - ) - .child( - Label::new("Sign in to enable collaboration.") + Label::new("Work with your team in realtime with collaborative editing, voice, shared notes and more.") ) + .child(v_stack().gap_2() + .child( Button::new("sign_in", "Sign in") + .icon_color(Color::Muted) + .icon(Icon::Github) + .icon_position(IconPosition::Start) .style(ButtonStyle::Filled) .full_width() .on_click(cx.listener( @@ -2052,6 +2055,12 @@ impl CollabPanel { }) .detach() }, + ))) + .child( + div().flex().w_full().items_center().child( + Label::new("Sign in to enable collaboration.") + .color(Color::Muted) + .size(LabelSize::Small) )), )) } From 9d014b0f9a886e308b3ad80aa1f7318a541c5a89 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Mon, 18 Dec 2023 13:11:51 -0500 Subject: [PATCH 5/5] Remove comment --- crates/collab_ui2/src/collab_panel.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rs index 18d9916bb3881cf316863510c278c6754711d7f7..5fc0c77d0c151a130ce9900a724dfaaa17e99cb7 100644 --- a/crates/collab_ui2/src/collab_panel.rs +++ b/crates/collab_ui2/src/collab_panel.rs @@ -2028,8 +2028,6 @@ impl CollabPanel { fn render_signed_out(&mut self, cx: &mut ViewContext) -> Div { v_stack() - // .flex_1() - // .justify_center() .items_center() .child(v_stack().gap_6().p_4() .child(