Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ai_onboarding: Read the plan from the `CloudUserStore` (#35451)
Marshall Bowersf8673dacf515
diff --git a/Cargo.lock b/Cargo.lockindex 61875e878fd..f76d4d520d0 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -355,6 +355,7 @@ name = "ai_onboarding"version = "0.1.0"dependencies = ["client",+ "cloud_llm_client","component","gpui","language_model",diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex a39e022df4a..7e0d766f914 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -697,6 +697,7 @@ impl AgentPanel {let onboarding = cx.new(|cx| {AgentPanelOnboarding::new(user_store.clone(),+ cloud_user_store.clone(),client,|_window, cx| {OnboardingUpsell::set_dismissed(true, cx);diff --git a/crates/ai_onboarding/Cargo.toml b/crates/ai_onboarding/Cargo.tomlindex 9031e14e29d..20fd54339e3 100644--- a/crates/ai_onboarding/Cargo.toml+++ b/crates/ai_onboarding/Cargo.toml@@ -16,6 +16,7 @@ default = [][dependencies]client.workspace = true+cloud_llm_client.workspace = truecomponent.workspace = truegpui.workspace = truelanguage_model.workspace = truediff --git a/crates/ai_onboarding/src/agent_panel_onboarding_content.rs b/crates/ai_onboarding/src/agent_panel_onboarding_content.rsindex e8a62f7ff27..237b0ae0464 100644--- a/crates/ai_onboarding/src/agent_panel_onboarding_content.rs+++ b/crates/ai_onboarding/src/agent_panel_onboarding_content.rs@@ -1,6 +1,7 @@use std::sync::Arc;-use client::{Client, UserStore};+use client::{Client, CloudUserStore, UserStore};+use cloud_llm_client::Plan;use gpui::{Entity, IntoElement, ParentElement};use language_model::{LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID};use ui::prelude::*;@@ -9,6 +10,7 @@ use crate::{AgentPanelOnboardingCard, ApiKeysWithoutProviders, ZedAiOnboarding};pub struct AgentPanelOnboarding {user_store: Entity<UserStore>,+ cloud_user_store: Entity<CloudUserStore>,client: Arc<Client>,configured_providers: Vec<(IconName, SharedString)>,continue_with_zed_ai: Arc<dyn Fn(&mut Window, &mut App)>,@@ -17,6 +19,7 @@ pub struct AgentPanelOnboarding {impl AgentPanelOnboarding {pub fn new(user_store: Entity<UserStore>,+ cloud_user_store: Entity<CloudUserStore>,client: Arc<Client>,continue_with_zed_ai: impl Fn(&mut Window, &mut App) + 'static,cx: &mut Context<Self>,@@ -36,6 +39,7 @@ impl AgentPanelOnboarding {Self {user_store,+ cloud_user_store,client,configured_providers: Self::compute_available_providers(cx),continue_with_zed_ai: Arc::new(continue_with_zed_ai),@@ -56,15 +60,8 @@ impl AgentPanelOnboarding {impl Render for AgentPanelOnboarding {fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {- let enrolled_in_trial = matches!(- self.user_store.read(cx).current_plan(),- Some(proto::Plan::ZedProTrial)- );-- let is_pro_user = matches!(- self.user_store.read(cx).current_plan(),- Some(proto::Plan::ZedPro)- );+ let enrolled_in_trial = self.cloud_user_store.read(cx).plan() == Some(Plan::ZedProTrial);+ let is_pro_user = self.cloud_user_store.read(cx).plan() == Some(Plan::ZedPro);AgentPanelOnboardingCard::new().child(