collab_ui: Add a loading state when signing in (#49713)
| Before | After | | ------------- | ------------- | | <video src="https://github.com/user-attachments/assets/ad5892f8-1fb9-4ea4-ba97-e1f2dc778f9e"> | <video src="https://github.com/user-attachments/assets/f932dfd7-90a7-4536-b42e-f5508412e5d8"> | Before you mark this PR as ready for review, make sure that you have: - [ ] Added a solid test coverage and/or screenshots from doing manual testing - [ ] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - N/A
This commit is contained in:
1 parent
989887ca0b
commit
366d5fa808
1 file changed
+11
-2
@@ -2324,6 +2324,12 @@ 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…"
|
||||
} else {
|
||||
"Sign in"
|
||||
};
|
||||
|
||||
v_flex()
|
||||
.gap_6()
|
||||
@@ -2333,12 +2339,13 @@ impl CollabPanel {
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
Button::new("sign_in", "Sign in")
|
||||
Button::new("sign_in", button_label)
|
||||
.icon_color(Color::Muted)
|
||||
.icon(IconName::Github)
|
||||
.icon_position(IconPosition::Start)
|
||||
.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();
|
||||
@@ -3107,6 +3114,8 @@ fn render_participant_name_and_handle(user: &User) -> impl IntoElement {
|
||||
|
||||
impl Render for CollabPanel {
|
||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let status = *self.client.status().borrow();
|
||||
|
||||
v_flex()
|
||||
.key_context(self.dispatch_context(window, cx))
|
||||
.on_action(cx.listener(CollabPanel::cancel))
|
||||
@@ -3125,7 +3134,7 @@ impl Render for CollabPanel {
|
||||
.on_action(cx.listener(CollabPanel::move_channel_down))
|
||||
.track_focus(&self.focus_handle)
|
||||
.size_full()
|
||||
.child(if !self.client.status().borrow().is_or_was_connected() {
|
||||
.child(if !status.is_or_was_connected() || status.is_signing_in() {
|
||||
self.render_signed_out(cx)
|
||||
} else {
|
||||
self.render_signed_in(window, cx)
|
||||
|
||||
Reference in new issue
Block a user