inline_completion_button: Replace UserStore
with CloudUserStore
(#35456)
This PR replaces usages of the `UserStore` in the inline completion button with the `CloudUserStore`. Release Notes: - N/A
This commit is contained in:
parent
8be3f48f37
commit
f7f90593ac
4 changed files with 24 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
use anyhow::Result;
|
||||
use client::{DisableAiSettings, UserStore, zed_urls};
|
||||
use client::{CloudUserStore, DisableAiSettings, zed_urls};
|
||||
use cloud_llm_client::UsageLimit;
|
||||
use copilot::{Copilot, Status};
|
||||
use editor::{
|
||||
|
@ -59,7 +59,7 @@ pub struct InlineCompletionButton {
|
|||
file: Option<Arc<dyn File>>,
|
||||
edit_prediction_provider: Option<Arc<dyn inline_completion::InlineCompletionProviderHandle>>,
|
||||
fs: Arc<dyn Fs>,
|
||||
user_store: Entity<UserStore>,
|
||||
cloud_user_store: Entity<CloudUserStore>,
|
||||
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
|
||||
}
|
||||
|
||||
|
@ -245,13 +245,16 @@ impl Render for InlineCompletionButton {
|
|||
IconName::ZedPredictDisabled
|
||||
};
|
||||
|
||||
if zeta::should_show_upsell_modal(&self.user_store, cx) {
|
||||
let tooltip_meta =
|
||||
match self.user_store.read(cx).current_user_has_accepted_terms() {
|
||||
Some(true) => "Choose a Plan",
|
||||
Some(false) => "Accept the Terms of Service",
|
||||
None => "Sign In",
|
||||
};
|
||||
if zeta::should_show_upsell_modal(&self.cloud_user_store, cx) {
|
||||
let tooltip_meta = if self.cloud_user_store.read(cx).is_authenticated() {
|
||||
if self.cloud_user_store.read(cx).has_accepted_tos() {
|
||||
"Choose a Plan"
|
||||
} else {
|
||||
"Accept the Terms of Service"
|
||||
}
|
||||
} else {
|
||||
"Sign In"
|
||||
};
|
||||
|
||||
return div().child(
|
||||
IconButton::new("zed-predict-pending-button", zeta_icon)
|
||||
|
@ -368,7 +371,7 @@ impl Render for InlineCompletionButton {
|
|||
impl InlineCompletionButton {
|
||||
pub fn new(
|
||||
fs: Arc<dyn Fs>,
|
||||
user_store: Entity<UserStore>,
|
||||
cloud_user_store: Entity<CloudUserStore>,
|
||||
popover_menu_handle: PopoverMenuHandle<ContextMenu>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Self {
|
||||
|
@ -389,7 +392,7 @@ impl InlineCompletionButton {
|
|||
edit_prediction_provider: None,
|
||||
popover_menu_handle,
|
||||
fs,
|
||||
user_store,
|
||||
cloud_user_store,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -760,7 +763,7 @@ impl InlineCompletionButton {
|
|||
})
|
||||
})
|
||||
.separator();
|
||||
} else if self.user_store.read(cx).account_too_young() {
|
||||
} else if self.cloud_user_store.read(cx).account_too_young() {
|
||||
menu = menu
|
||||
.custom_entry(
|
||||
|_window, _cx| {
|
||||
|
@ -775,7 +778,7 @@ impl InlineCompletionButton {
|
|||
cx.open_url(&zed_urls::account_url(cx))
|
||||
})
|
||||
.separator();
|
||||
} else if self.user_store.read(cx).has_overdue_invoices() {
|
||||
} else if self.cloud_user_store.read(cx).has_overdue_invoices() {
|
||||
menu = menu
|
||||
.custom_entry(
|
||||
|_window, _cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue