Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ai onboarding: Add some fast-follow adjustments (#37486)
Danilo Leal2aa0114b40e0
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 305261183e9..d021eaefb5e 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -2967,6 +2967,20 @@ impl AgentPanel {return false;}+ let user_store = self.user_store.read(cx);++ if user_store+ .plan()+ .is_some_and(|plan| matches!(plan, Plan::ZedPro))+ && user_store+ .subscription_period()+ .and_then(|period| period.0.checked_add_days(chrono::Days::new(1)))+ .is_some_and(|date| date < chrono::Utc::now())+ {+ OnboardingUpsell::set_dismissed(true, cx);+ return false;+ }+match &self.active_view {ActiveView::History | ActiveView::Configuration => false,ActiveView::ExternalAgentThread { thread_view, .. }diff --git a/crates/ai_onboarding/src/edit_prediction_onboarding_content.rs b/crates/ai_onboarding/src/edit_prediction_onboarding_content.rsindex e883d8da8ce..50b729c37ee 100644--- a/crates/ai_onboarding/src/edit_prediction_onboarding_content.rs+++ b/crates/ai_onboarding/src/edit_prediction_onboarding_content.rs@@ -1,6 +1,7 @@use std::sync::Arc;use client::{Client, UserStore};+use cloud_llm_client::Plan;use gpui::{Entity, IntoElement, ParentElement};use ui::prelude::*;@@ -35,6 +36,8 @@ impl EditPredictionOnboarding {impl Render for EditPredictionOnboarding {fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ let is_free_plan = self.user_store.read(cx).plan() == Some(Plan::ZedFree);+let github_copilot = v_flex().gap_1().child(Label::new(if self.copilot_is_configured {@@ -67,7 +70,8 @@ impl Render for EditPredictionOnboarding {self.continue_with_zed_ai.clone(),cx,))- .child(ui::Divider::horizontal())- .child(github_copilot)+ .when(is_free_plan, |this| {+ this.child(ui::Divider::horizontal()).child(github_copilot)+ })}}diff --git a/crates/ai_onboarding/src/young_account_banner.rs b/crates/ai_onboarding/src/young_account_banner.rsindex ed9a6b3b35f..ae13b955688 100644--- a/crates/ai_onboarding/src/young_account_banner.rs+++ b/crates/ai_onboarding/src/young_account_banner.rs@@ -6,7 +6,7 @@ pub struct YoungAccountBanner;impl RenderOnce for YoungAccountBanner {fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {- const YOUNG_ACCOUNT_DISCLAIMER: &str = "To prevent abuse of our service, we cannot offer plans to GitHub accounts created fewer than 30 days ago. To request an exception, reach out to [email protected].";+ const YOUNG_ACCOUNT_DISCLAIMER: &str = "To prevent abuse of our service, GitHub accounts created fewer than 30 days ago are not eligible for free plan usage or Pro plan free trial. To request an exception, reach out to [email protected].";let label = div().w_full()diff --git a/crates/zeta/src/onboarding_modal.rs b/crates/zeta/src/onboarding_modal.rsindex 3a58c8c7b81..6b743d95f2d 100644--- a/crates/zeta/src/onboarding_modal.rs+++ b/crates/zeta/src/onboarding_modal.rs@@ -14,7 +14,7 @@ use settings::update_settings_file;use ui::{Vector, VectorName, prelude::*};use workspace::{ModalView, Workspace};-/// Introduces user to Zed's Edit Prediction feature and terms of service+/// Introduces user to Zed's Edit Prediction featurepub struct ZedPredictModal {onboarding: Entity<EditPredictionOnboarding>,focus_handle: FocusHandle,@@ -86,7 +86,16 @@ impl Focusable for ZedPredictModal {}}-impl ModalView for ZedPredictModal {}+impl ModalView for ZedPredictModal {+ fn on_before_dismiss(+ &mut self,+ _window: &mut Window,+ cx: &mut Context<Self>,+ ) -> workspace::DismissDecision {+ ZedPredictUpsell::set_dismissed(true, cx);+ workspace::DismissDecision::Dismiss(true)+ }+}impl Render for ZedPredictModal {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {