diff --git a/crates/copilot_ui/src/sign_in.rs b/crates/copilot_ui/src/sign_in.rs index f0408ea063..fe9ac57bda 100644 --- a/crates/copilot_ui/src/sign_in.rs +++ b/crates/copilot_ui/src/sign_in.rs @@ -535,23 +535,12 @@ impl ConfigurationView { label: impl Into, edit_prediction: bool, ) -> impl IntoElement { - ButtonLike::new("loading_button") + Button::new("loading_button", label) + .full_width() .disabled(true) + .loading(true) .style(ButtonStyle::Outlined) .when(edit_prediction, |this| this.size(ButtonSize::Medium)) - .child( - h_flex() - .w_full() - .gap_1() - .justify_center() - .child( - Icon::new(IconName::ArrowCircle) - .size(IconSize::Small) - .color(Color::Muted) - .with_rotate_animation(4), - ) - .child(Label::new(label)), - ) } fn render_sign_in_button(&self, edit_prediction: bool) -> impl IntoElement { diff --git a/crates/language_models/src/provider/openai_subscribed.rs b/crates/language_models/src/provider/openai_subscribed.rs index 36d5775448..2da10003a4 100644 --- a/crates/language_models/src/provider/openai_subscribed.rs +++ b/crates/language_models/src/provider/openai_subscribed.rs @@ -1015,6 +1015,7 @@ impl Render for ConfigurationView { .unwrap_or_else(|| "Signed in".to_string()); let weak_state = self.state.downgrade(); + return v_flex() .child( ConfiguredApiCard::new(SharedString::from(label)) @@ -1026,30 +1027,52 @@ impl Render for ConfigurationView { .into_any_element(); } - if state.is_signing_in() { - return v_flex() - .child(Label::new("Signing in…").color(Color::Muted)) - .into_any_element(); - } - let last_auth_error = state.last_auth_error.clone(); let provider_state = self.state.clone(); let http_client = self.http_client.clone(); + let is_signing_in = state.is_signing_in(); + let button_label = if is_signing_in { + "Signing in…" + } else { + "Sign in to use ChatGPT Subscription" + }; + v_flex() .gap_2() - .when_some(last_auth_error, |this, error| { - this.child(Label::new(error).color(Color::Error)) - }) .child(Label::new( "Sign in with your ChatGPT Plus or Pro subscription to use OpenAI models in Zed's agent.", )) .child( - Button::new("sign-in", "Sign in with ChatGPT") + Button::new("sign-in", button_label) + .full_width() + .style(ButtonStyle::Outlined) + .loading(is_signing_in) + .disabled(is_signing_in) + .when(!is_signing_in, |this| { + this.start_icon( + Icon::new(IconName::AiOpenAi) + .size(IconSize::Small) + .color(Color::Muted), + ) + }) .on_click(move |_, _window, cx| { do_sign_in(&provider_state, &http_client, cx); }), ) + .when_some(last_auth_error, |this, error| { + this.child( + h_flex() + .gap_1() + .justify_center() + .child( + Icon::new(IconName::XCircle) + .color(Color::Error) + .size(IconSize::Small), + ) + .child(Label::new(error).color(Color::Muted)), + ) + }) .into_any_element() } }