Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
collab_ui: Fix "lost session" visual bug in Collab Panel (#52486)
Jose Garcia15d8660748b5
diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex 3c32e76fea6..392e2340f14 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -2340,46 +2340,57 @@ impl CollabPanel {fn render_signed_out(&mut self, cx: &mut Context<Self>) -> Div {let collab_blurb = "Work with your team in realtime with collaborative editing, voice, shared notes and more.";- let is_signing_in = self.client.status().borrow().is_signing_in();- let button_label = if is_signing_in {- "Signing in…"++ // Two distinct "not connected" states:+ // - Authenticated (has credentials): user just needs to connect.+ // - Unauthenticated (no credentials): user needs to sign in via GitHub.+ let is_authenticated = self.client.user_id().is_some();+ let status = *self.client.status().borrow();+ let is_busy = status.is_signing_in();++ let (button_id, button_label, button_icon) = if is_authenticated {+ (+ "connect",+ if is_busy { "Connecting…" } else { "Connect" },+ IconName::Public,+ )} else {- "Sign in"+ (+ "sign_in",+ if is_busy {+ "Signing in…"+ } else {+ "Sign In with GitHub"+ },+ IconName::Github,+ )};v_flex()- .gap_6().p_4()+ .gap_4()+ .size_full()+ .text_center()+ .justify_center().child(Label::new(collab_blurb)).child(- v_flex()- .gap_2()- .child(- Button::new("sign_in", button_label)- .start_icon(Icon::new(IconName::Github).color(Color::Muted))- .style(ButtonStyle::Filled)- .full_width()- .disabled(is_signing_in)- .on_click(cx.listener(|this, _, window, cx| {- let client = this.client.clone();- let workspace = this.workspace.clone();- cx.spawn_in(window, async move |_, mut cx| {- client- .connect(true, &mut cx)- .await- .into_response()- .notify_workspace_async_err(workspace, &mut cx);- })- .detach()- })),- )- .child(- v_flex().w_full().items_center().child(- Label::new("Sign in to enable collaboration.")- .color(Color::Muted)- .size(LabelSize::Small),- ),- ),+ Button::new(button_id, button_label)+ .full_width()+ .start_icon(Icon::new(button_icon).color(Color::Muted))+ .style(ButtonStyle::Outlined)+ .disabled(is_busy)+ .on_click(cx.listener(|this, _, window, cx| {+ let client = this.client.clone();+ let workspace = this.workspace.clone();+ cx.spawn_in(window, async move |_, mut cx| {+ client+ .connect(true, &mut cx)+ .await+ .into_response()+ .notify_workspace_async_err(workspace, &mut cx);+ })+ .detach()+ })),)}