assistant panel: Use feature flag for Zed Pro mentions (#15903)

This removes Zed Pro mentions.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-08-07 14:44:00 +02:00 committed by GitHub
parent f24f601e05
commit 94028290cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 28 deletions

View file

@ -2447,10 +2447,10 @@ impl ContextEditor {
} }
fn render_notice(&self, cx: &mut ViewContext<Self>) -> Option<AnyElement> { fn render_notice(&self, cx: &mut ViewContext<Self>) -> Option<AnyElement> {
let nudge = self use feature_flags::FeatureFlagAppExt;
.assistant_panel let nudge = self.assistant_panel.upgrade().map(|assistant_panel| {
.upgrade() assistant_panel.read(cx).show_zed_ai_notice && cx.has_flag::<feature_flags::ZedPro>()
.map(|assistant_panel| assistant_panel.read(cx).show_zed_ai_notice); });
if let Some(error) = self.error_message.clone() { if let Some(error) = self.error_message.clone() {
Some(Self::render_error_popover(error, cx).into_any_element()) Some(Self::render_error_popover(error, cx).into_any_element())

View file

@ -1,4 +1,3 @@
use feature_flags::LanguageModels;
use feature_flags::ZedPro; use feature_flags::ZedPro;
use language_model::{LanguageModel, LanguageModelAvailability, LanguageModelRegistry}; use language_model::{LanguageModel, LanguageModelAvailability, LanguageModelRegistry};
use proto::Plan; use proto::Plan;
@ -194,9 +193,6 @@ impl PickerDelegate for ModelPickerDelegate {
fn render_footer(&self, cx: &mut ViewContext<Picker<Self>>) -> Option<gpui::AnyElement> { fn render_footer(&self, cx: &mut ViewContext<Picker<Self>>) -> Option<gpui::AnyElement> {
use feature_flags::FeatureFlagAppExt; use feature_flags::FeatureFlagAppExt;
if !cx.has_flag::<LanguageModels>() {
return None;
}
let plan = proto::Plan::ZedPro; let plan = proto::Plan::ZedPro;
let is_trial = false; let is_trial = false;
@ -209,26 +205,28 @@ impl PickerDelegate for ModelPickerDelegate {
.p_1() .p_1()
.gap_4() .gap_4()
.justify_between() .justify_between()
.child(match plan { .when(cx.has_flag::<ZedPro>(), |this| {
// Already a zed pro subscriber this.child(match plan {
Plan::ZedPro => Button::new("zed-pro", "Zed Pro") // Already a zed pro subscriber
.icon(IconName::ZedAssistant) Plan::ZedPro => Button::new("zed-pro", "Zed Pro")
.icon_size(IconSize::Small) .icon(IconName::ZedAssistant)
.icon_color(Color::Muted) .icon_size(IconSize::Small)
.icon_position(IconPosition::Start) .icon_color(Color::Muted)
.on_click(|_, cx| { .icon_position(IconPosition::Start)
cx.dispatch_action(Box::new(zed_actions::OpenAccountSettings)) .on_click(|_, cx| {
}), cx.dispatch_action(Box::new(zed_actions::OpenAccountSettings))
// Free user }),
Plan::Free => Button::new( // Free user
"try-pro", Plan::Free => Button::new(
if is_trial { "try-pro",
"Upgrade to Pro" if is_trial {
} else { "Upgrade to Pro"
"Try Pro" } else {
}, "Try Pro"
) },
.on_click(|_, cx| cx.open_url(TRY_ZED_PRO_URL)), )
.on_click(|_, cx| cx.open_url(TRY_ZED_PRO_URL)),
})
}) })
.child( .child(
Button::new("configure", "Configure") Button::new("configure", "Configure")