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:
parent
72d354de6c
commit
f8673dacf5
4 changed files with 10 additions and 10 deletions
|
@ -16,6 +16,7 @@ default = []
|
|||
|
||||
[dependencies]
|
||||
client.workspace = true
|
||||
cloud_llm_client.workspace = true
|
||||
component.workspace = true
|
||||
gpui.workspace = true
|
||||
language_model.workspace = true
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue