use std::sync::Arc; use client::{Client, UserStore}; use gpui::{Entity, IntoElement, ParentElement}; use ui::prelude::*; use crate::ZedAiOnboarding; pub struct EditPredictionOnboarding { user_store: Entity, client: Arc, copilot_is_configured: bool, continue_with_zed_ai: Arc, continue_with_copilot: Arc, } impl EditPredictionOnboarding { pub fn new( user_store: Entity, client: Arc, copilot_is_configured: bool, continue_with_zed_ai: Arc, continue_with_copilot: Arc, _cx: &mut Context, ) -> Self { Self { user_store, copilot_is_configured, client, continue_with_zed_ai, continue_with_copilot, } } } impl Render for EditPredictionOnboarding { fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { let github_copilot = v_flex() .gap_1() .child(Label::new(if self.copilot_is_configured { "Alternatively, you can continue to use GitHub Copilot as that's already set up." } else { "Alternatively, you can use GitHub Copilot as your edit prediction provider." })) .child( Button::new( "configure-copilot", if self.copilot_is_configured { "Use Copilot" } else { "Configure Copilot" }, ) .full_width() .style(ButtonStyle::Outlined) .on_click({ let callback = self.continue_with_copilot.clone(); move |_, window, cx| callback(window, cx) }), ); v_flex() .gap_2() .child(ZedAiOnboarding::new( self.client.clone(), &self.user_store, self.continue_with_zed_ai.clone(), cx, )) .child(ui::Divider::horizontal()) .child(github_copilot) } }