agent_ui: Remove feature upsell banners from agent registry (#50862)
These aren't built in anymore! Release Notes: - N/A
This commit is contained in:
1 parent
5e0c4c42cd
commit
c0c139c8a1
1 file changed
+2
-110
@@ -1,6 +1,4 @@
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::ops::Range;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use client::zed_urls;
|
||||
use collections::HashMap;
|
||||
@@ -16,7 +14,7 @@ use project::{AgentRegistryStore, RegistryAgent};
|
||||
use settings::{Settings, SettingsStore, update_settings_file};
|
||||
use theme::ThemeSettings;
|
||||
use ui::{
|
||||
Banner, ButtonStyle, ScrollableHandle, Severity, ToggleButtonGroup, ToggleButtonGroupSize,
|
||||
ButtonStyle, ScrollableHandle, ToggleButtonGroup, ToggleButtonGroupSize,
|
||||
ToggleButtonGroupStyle, ToggleButtonSimple, Tooltip, WithScrollbar, prelude::*,
|
||||
};
|
||||
use workspace::{
|
||||
@@ -39,28 +37,6 @@ enum RegistryInstallStatus {
|
||||
InstalledExtension,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
enum BuiltInAgent {
|
||||
Claude,
|
||||
Codex,
|
||||
Gemini,
|
||||
}
|
||||
|
||||
fn keywords_by_agent_feature() -> &'static BTreeMap<BuiltInAgent, Vec<&'static str>> {
|
||||
static KEYWORDS_BY_FEATURE: OnceLock<BTreeMap<BuiltInAgent, Vec<&'static str>>> =
|
||||
OnceLock::new();
|
||||
KEYWORDS_BY_FEATURE.get_or_init(|| {
|
||||
BTreeMap::from_iter([
|
||||
(
|
||||
BuiltInAgent::Claude,
|
||||
vec!["claude", "claude code", "claude agent"],
|
||||
),
|
||||
(BuiltInAgent::Codex, vec!["codex", "codex cli"]),
|
||||
(BuiltInAgent::Gemini, vec!["gemini", "gemini cli"]),
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
struct AgentRegistryCard {
|
||||
children: Vec<AnyElement>,
|
||||
@@ -106,7 +82,6 @@ pub struct AgentRegistryPage {
|
||||
installed_statuses: HashMap<String, RegistryInstallStatus>,
|
||||
query_editor: Entity<Editor>,
|
||||
filter: RegistryFilter,
|
||||
upsells: BTreeSet<BuiltInAgent>,
|
||||
_subscriptions: Vec<gpui::Subscription>,
|
||||
}
|
||||
|
||||
@@ -141,7 +116,6 @@ impl AgentRegistryPage {
|
||||
installed_statuses: HashMap::default(),
|
||||
query_editor,
|
||||
filter: RegistryFilter::All,
|
||||
upsells: BTreeSet::new(),
|
||||
_subscriptions: subscriptions,
|
||||
};
|
||||
|
||||
@@ -207,7 +181,6 @@ impl AgentRegistryPage {
|
||||
|
||||
fn filter_registry_agents(&mut self, cx: &mut Context<Self>) {
|
||||
self.refresh_installed_statuses(cx);
|
||||
self.refresh_feature_upsells(cx);
|
||||
let search = self.search_query(cx).map(|search| search.to_lowercase());
|
||||
let filter = self.filter;
|
||||
let installed_statuses = self.installed_statuses.clone();
|
||||
@@ -265,83 +238,6 @@ impl AgentRegistryPage {
|
||||
}
|
||||
}
|
||||
|
||||
fn refresh_feature_upsells(&mut self, cx: &mut Context<Self>) {
|
||||
let Some(search) = self.search_query(cx) else {
|
||||
self.upsells.clear();
|
||||
return;
|
||||
};
|
||||
|
||||
let search = search.to_lowercase();
|
||||
let search_terms = search
|
||||
.split_whitespace()
|
||||
.map(|term| term.trim())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for (feature, keywords) in keywords_by_agent_feature() {
|
||||
if keywords
|
||||
.iter()
|
||||
.any(|keyword| search_terms.contains(keyword))
|
||||
{
|
||||
self.upsells.insert(*feature);
|
||||
} else {
|
||||
self.upsells.remove(feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render_feature_upsell_banner(
|
||||
&self,
|
||||
label: SharedString,
|
||||
docs_url: SharedString,
|
||||
) -> impl IntoElement {
|
||||
let docs_url_button = Button::new("open_docs", "View Documentation")
|
||||
.icon(IconName::ArrowUpRight)
|
||||
.icon_size(IconSize::Small)
|
||||
.icon_position(IconPosition::End)
|
||||
.icon_color(Color::Muted)
|
||||
.on_click({
|
||||
move |_event, _window, cx| {
|
||||
telemetry::event!(
|
||||
"Documentation Viewed",
|
||||
source = "Agent Registry Feature Upsell",
|
||||
url = docs_url,
|
||||
);
|
||||
cx.open_url(&docs_url)
|
||||
}
|
||||
});
|
||||
|
||||
div().pt_4().px_4().child(
|
||||
Banner::new()
|
||||
.severity(Severity::Success)
|
||||
.child(Label::new(label).mt_0p5())
|
||||
.action_slot(docs_url_button),
|
||||
)
|
||||
}
|
||||
|
||||
fn render_feature_upsells(&self) -> impl IntoElement {
|
||||
let mut container = v_flex();
|
||||
|
||||
for feature in &self.upsells {
|
||||
let banner = match feature {
|
||||
BuiltInAgent::Claude => self.render_feature_upsell_banner(
|
||||
"Claude Agent support is built-in to Zed!".into(),
|
||||
"https://zed.dev/docs/ai/external-agents#claude-agent".into(),
|
||||
),
|
||||
BuiltInAgent::Codex => self.render_feature_upsell_banner(
|
||||
"Codex CLI support is built-in to Zed!".into(),
|
||||
"https://zed.dev/docs/ai/external-agents#codex-cli".into(),
|
||||
),
|
||||
BuiltInAgent::Gemini => self.render_feature_upsell_banner(
|
||||
"Gemini CLI support is built-in to Zed!".into(),
|
||||
"https://zed.dev/docs/ai/external-agents#gemini-cli".into(),
|
||||
),
|
||||
};
|
||||
container = container.child(banner);
|
||||
}
|
||||
|
||||
container
|
||||
}
|
||||
|
||||
fn render_search(&self, cx: &mut Context<Self>) -> Div {
|
||||
let mut key_context = KeyContext::new_with_defaults();
|
||||
key_context.add("BufferSearchBar");
|
||||
@@ -704,14 +600,10 @@ impl Render for AgentRegistryPage {
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(self.render_feature_upsells())
|
||||
.child(v_flex().px_4().size_full().overflow_y_hidden().map(|this| {
|
||||
let count = self.filtered_registry_indices.len();
|
||||
let has_upsells = !self.upsells.is_empty();
|
||||
if count == 0 && !has_upsells {
|
||||
if count == 0 {
|
||||
this.child(self.render_empty_state(cx)).into_any_element()
|
||||
} else if count == 0 {
|
||||
this.into_any_element()
|
||||
} else {
|
||||
let scroll_handle = &self.list;
|
||||
this.child(
|
||||
|
||||
Reference in new issue
Block a user