ai_onboarding: Read the plan from the CloudUserStore (#35451)

This PR updates the AI onboarding to read the plan from the
`CloudUserStore` so that we don't need to connect to Collab.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-07-31 22:08:21 -04:00
parent 5a70f2131c
commit d512ef1e56
4 changed files with 10 additions and 10 deletions

1
Cargo.lock generated
View file

@ -355,6 +355,7 @@ name = "ai_onboarding"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"client", "client",
"cloud_llm_client",
"component", "component",
"gpui", "gpui",
"language_model", "language_model",

View file

@ -697,6 +697,7 @@ impl AgentPanel {
let onboarding = cx.new(|cx| { let onboarding = cx.new(|cx| {
AgentPanelOnboarding::new( AgentPanelOnboarding::new(
user_store.clone(), user_store.clone(),
cloud_user_store.clone(),
client, client,
|_window, cx| { |_window, cx| {
OnboardingUpsell::set_dismissed(true, cx); OnboardingUpsell::set_dismissed(true, cx);

View file

@ -16,6 +16,7 @@ default = []
[dependencies] [dependencies]
client.workspace = true client.workspace = true
cloud_llm_client.workspace = true
component.workspace = true component.workspace = true
gpui.workspace = true gpui.workspace = true
language_model.workspace = true language_model.workspace = true

View file

@ -1,6 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use client::{Client, UserStore}; use client::{Client, CloudUserStore, UserStore};
use cloud_llm_client::Plan;
use gpui::{Entity, IntoElement, ParentElement}; use gpui::{Entity, IntoElement, ParentElement};
use language_model::{LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID}; use language_model::{LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID};
use ui::prelude::*; use ui::prelude::*;
@ -9,6 +10,7 @@ use crate::{AgentPanelOnboardingCard, ApiKeysWithoutProviders, ZedAiOnboarding};
pub struct AgentPanelOnboarding { pub struct AgentPanelOnboarding {
user_store: Entity<UserStore>, user_store: Entity<UserStore>,
cloud_user_store: Entity<CloudUserStore>,
client: Arc<Client>, client: Arc<Client>,
configured_providers: Vec<(IconName, SharedString)>, configured_providers: Vec<(IconName, SharedString)>,
continue_with_zed_ai: Arc<dyn Fn(&mut Window, &mut App)>, continue_with_zed_ai: Arc<dyn Fn(&mut Window, &mut App)>,
@ -17,6 +19,7 @@ pub struct AgentPanelOnboarding {
impl AgentPanelOnboarding { impl AgentPanelOnboarding {
pub fn new( pub fn new(
user_store: Entity<UserStore>, user_store: Entity<UserStore>,
cloud_user_store: Entity<CloudUserStore>,
client: Arc<Client>, client: Arc<Client>,
continue_with_zed_ai: impl Fn(&mut Window, &mut App) + 'static, continue_with_zed_ai: impl Fn(&mut Window, &mut App) + 'static,
cx: &mut Context<Self>, cx: &mut Context<Self>,
@ -36,6 +39,7 @@ impl AgentPanelOnboarding {
Self { Self {
user_store, user_store,
cloud_user_store,
client, client,
configured_providers: Self::compute_available_providers(cx), configured_providers: Self::compute_available_providers(cx),
continue_with_zed_ai: Arc::new(continue_with_zed_ai), continue_with_zed_ai: Arc::new(continue_with_zed_ai),
@ -56,15 +60,8 @@ impl AgentPanelOnboarding {
impl Render for AgentPanelOnboarding { impl Render for AgentPanelOnboarding {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let enrolled_in_trial = matches!( let enrolled_in_trial = self.cloud_user_store.read(cx).plan() == Some(Plan::ZedProTrial);
self.user_store.read(cx).current_plan(), let is_pro_user = self.cloud_user_store.read(cx).plan() == Some(Plan::ZedPro);
Some(proto::Plan::ZedProTrial)
);
let is_pro_user = matches!(
self.user_store.read(cx).current_plan(),
Some(proto::Plan::ZedPro)
);
AgentPanelOnboardingCard::new() AgentPanelOnboardingCard::new()
.child( .child(