Add onboarding banner for claude code support (#37443)

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
Bennet Bo Fenner
2025-09-03 10:59:14 +00:00
committed by GitHub
co-authored by Danilo Leal
parent 40199266b6
commit 91cbb2ec25
8 changed files with 330 additions and 24 deletions
+9 -2
View File
@@ -7,6 +7,7 @@ pub struct OnboardingBanner {
dismissed: bool,
source: String,
details: BannerDetails,
visible_when: Option<Box<dyn Fn(&mut App) -> bool>>,
}
#[derive(Clone)]
@@ -42,12 +43,18 @@ impl OnboardingBanner {
label: label.into(),
subtitle: subtitle.or(Some(SharedString::from("Introducing:"))),
},
visible_when: None,
dismissed: get_dismissed(source),
}
}
fn should_show(&self, _cx: &mut App) -> bool {
!self.dismissed
pub fn visible_when(mut self, predicate: impl Fn(&mut App) -> bool + 'static) -> Self {
self.visible_when = Some(Box::new(predicate));
self
}
fn should_show(&self, cx: &mut App) -> bool {
!self.dismissed && self.visible_when.as_ref().map_or(true, |f| f(cx))
}
fn dismiss(&mut self, cx: &mut Context<Self>) {
+6 -4
View File
@@ -279,13 +279,15 @@ impl TitleBar {
let banner = cx.new(|cx| {
OnboardingBanner::new(
"ACP Onboarding",
IconName::Sparkle,
"Bring Your Own Agent",
"ACP Claude Code Onboarding",
IconName::AiClaude,
"Claude Code",
Some("Introducing:".into()),
zed_actions::agent::OpenAcpOnboardingModal.boxed_clone(),
zed_actions::agent::OpenClaudeCodeOnboardingModal.boxed_clone(),
cx,
)
// When updating this to a non-AI feature release, remove this line.
.visible_when(|cx| !project::DisableAiSettings::get_global(cx).disable_ai)
});
let platform_titlebar = cx.new(|cx| PlatformTitleBar::new(id, cx));