Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
onboarding: Adjust the AI upsell card depending on user's state (#35658)
Danilo Leal30414d154e55
diff --git a/assets/images/certified_user_stamp.svg b/assets/images/certified_user_stamp.svgnew file mode 100644index 00000000000..7e65c4fc9d4--- /dev/null+++ b/assets/images/certified_user_stamp.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="51" height="51" fill="none"><path fill="#000" fill-opacity=".3" d="M25.5 3C37.926 3 48 13.074 48 25.5S37.926 48 25.5 48 3 37.926 3 25.5 13.074 3 25.5 3Zm0 3C14.73 6 6 14.73 6 25.5S14.73 45 25.5 45 45 36.27 45 25.5 36.27 6 25.5 6Z"/><circle cx="25.5" cy="25.5" r="22.5" stroke="#000"/><circle cx="25.5" cy="25.5" r="19.5" stroke="#000"/><path fill="#000" fill-rule="evenodd" d="M20.219 19.813a.406.406 0 0 0-.407.406v8.937H19V20.22c0-.673.546-1.219 1.219-1.219h10.884a.61.61 0 0 1 .431 1.04l-6.704 6.704h1.889v-.838h.812v1.041a.61.61 0 0 1-.61.61h-2.903l-1.397 1.396h6.332v-5.078h.813v5.078a.812.812 0 0 1-.813.813H21.81l-1.422 1.422h10.394a.406.406 0 0 0 .407-.407v-8.937H32v8.937c0 .673-.546 1.219-1.219 1.219H19.897a.61.61 0 0 1-.431-1.04l6.678-6.679h-1.863v.813h-.812v-1.016a.61.61 0 0 1 .61-.61h2.878l1.422-1.421h-6.332v5.078h-.813v-5.078c0-.449.364-.813.813-.813h7.144l1.422-1.422H20.219Z" clip-rule="evenodd"/><path fill="#000" d="M38.458 27.016c0-.648.622-1.13 1.464-1.13.836 0 1.464.486 1.464 1.135 0 .334-.168.59-.471.753v.026h1.464v.627H39.45a16 16 0 0 0-.94.037v-.601c.167-.021.313-.032.465-.042v-.027c-.335-.157-.518-.423-.518-.778Zm-.643-6.85 3.058.447-.727-1.511.517-.25 1.073 2.228-.47.227-3.06-.447.79 1.638-.519.25-1.133-2.355.47-.227Zm.683 4.304c-.169-.739.313-1.4 1.153-1.593.826-.188 1.527.183 1.688.886.157.688-.29 1.289-1.1 1.474l-.23.052-.402-1.759c-.441.155-.657.451-.574.818.053.23.2.388.388.41l.133.581c-.51.02-.933-.329-1.056-.869Zm1.85.098c.355-.114.54-.386.471-.687-.067-.295-.34-.458-.73-.444l.26 1.13Zm-1.315 2.594c0 .371.382.649.889.649s.888-.278.889-.649c0-.37-.382-.648-.89-.648-.506 0-.888.277-.888.648Zm-1.977 4.492.518.25-.329.683 2.26 1.089.325-.674.519.25-.933 1.936-.518-.25.325-.674-2.262-1.089-.328.684-.519-.25.942-1.955Zm-2.587 3.598 1.45 1.157c.242.193.484.192.64-.005.196-.245.107-.603-.216-.86l-1.287-1.027.39-.491 2.208 1.76-.375.47-.29-.231-.013.016a.78.78 0 0 1-.119.828c-.322.405-.83.429-1.288.064l-1.492-1.19.392-.49Zm.958-19.193a.784.784 0 1 1 .976-1.227.784.784 0 0 1-.976 1.227ZM32.04 37.022c.12.117.22.225.323.337l.02-.016c-.085-.36.009-.669.287-.89.507-.405 1.271-.218 1.796.44.521.654.532 1.447.025 1.851-.261.209-.566.238-.882.102l-.02.017.913 1.144-.49.392-1.827-2.29a15.93 15.93 0 0 0-.615-.713l.47-.374Zm.874-.029c-.29.232-.268.703.048 1.099.316.397.77.523 1.06.291.29-.231.27-.702-.046-1.099-.317-.396-.772-.522-1.062-.29Zm-3.46 1.101c.07.11.133.215.194.318l.019-.01a.78.78 0 0 1 .467-.694c.466-.224.933-.025 1.187.502l.828 1.72-.565.271-.806-1.672c-.133-.277-.352-.38-.578-.272-.282.136-.358.497-.178.87l.714 1.483-.565.272-.816-1.695c-.116-.24-.28-.545-.442-.832l.541-.261Zm.395-24.455c-.632-.144-.963-.858-.776-1.679.186-.815.8-1.319 1.433-1.175.326.075.538.295.629.626l.025.006.326-1.427.612.14-.652 2.855c-.059.26-.12.6-.174.925l-.585-.133c.016-.168.038-.313.062-.463l-.025-.006c-.228.291-.529.41-.875.33Zm-.163-1.54c-.113.495.072.929.433 1.012.362.082.717-.229.83-.723.113-.494-.073-.928-.434-1.01-.362-.083-.717.228-.83.722Zm-3.46 27.499c-.126-.55.23-1.034.872-1.18.622-.143 1.167.109 1.276.588l-.59.135c-.073-.177-.334-.262-.604-.2-.265.06-.408.232-.36.441.04.178.182.237.48.201l.14-.015c.644-.072 1.003.114 1.109.578.124.545-.198 1.01-.805 1.15-.58.132-1.104-.114-1.231-.578l.571-.13c.062.178.278.257.533.2.26-.06.394-.225.348-.428-.038-.169-.172-.235-.434-.207l-.14.016c-.686.076-1.06-.107-1.165-.571Zm-.146-28.044c0-.847.517-1.448 1.238-1.448.706 0 1.193.57 1.193 1.401v.235h-1.804c.052.465.293.742.669.743.235 0 .424-.11.486-.288h.596c-.094.501-.528.836-1.082.836-.758 0-1.296-.617-1.296-1.479Zm1.804-.304c-.032-.37-.257-.611-.566-.611-.303 0-.522.23-.595.611h1.16Zm-3.727-1.125.5 2.192.765-.175.128.56-2.14.49-.129-.56.765-.176-.372-1.63-.74.167-.127-.56 1.35-.308Zm-1.014 28.402c.156-.074.36-.11.575-.11.669 0 1.02.366 1.02 1.06v1.24h.73v.575h-.73v.78l-.629.109v-.889h-.915v-.575h.915v-1.24c0-.354-.167-.527-.511-.527a1.12 1.12 0 0 0-.455.1v-.523Zm.006-29.036a.474.474 0 0 1 .358-.569c.26-.06.51.098.57.358a.475.475 0 1 1-.928.211Zm-3.358 30.034.632.143c.003.173.123.308.307.35.31.07.596-.17.693-.593l.351-1.539.612.14-.628 2.752-.587-.134.085-.372-.02-.005a.844.844 0 0 1-.812.244c-.449-.102-.694-.486-.633-.986Zm.195-28.295-.015-.033c-.302-.626-.145-1.108.458-1.398.193-.093.392-.15.565-.151l.228.471a1.118 1.118 0 0 0-.453.108c-.311.15-.387.378-.233.698l.016.033.824-.397.25.518-.824.397.975 2.025-.565.273-.976-2.026-.659.318-.25-.518.66-.318Zm-2.438 1.138 1.401 1.758.613-.489.359.45-1.717 1.368-.358-.449.613-.49-1.043-1.307-.593.473-.358-.45 1.083-.864Zm.725 24.532-.706-.341.25-.518 1.978.952-.25.519-.706-.34-.726 1.507.683.33-.25.518-1.247-.602.974-2.025Zm-1.216 3.37a.471.471 0 0 1-.223-.634.475.475 0 1 1 .857.413.474.474 0 0 1-.634.222Zm-3.123-26.1.695.554.57-.716.45.359-.57.715.968.773c.278.221.517.198.732-.072a1.12 1.12 0 0 0 .206-.417l.409.326c-.041.168-.14.35-.273.518-.417.523-.921.568-1.465.135l-.969-.772-.457.572-.449-.359.456-.572-.61-.485.307-.56Zm2.431-1.935a.473.473 0 0 1 .075-.668.471.471 0 0 1 .67.075.477.477 0 0 1-.744.593Zm-1.55 24.734c-.552-.44-.577-1.189-.06-1.839l.147-.184 1.412 1.125c.248-.396.233-.763-.061-.997-.184-.147-.4-.178-.56-.079l-.466-.372c.387-.333.935-.325 1.368.02.592.474.63 1.292.091 1.967-.528.662-1.307.809-1.871.359Zm.272-1.247c-.207.31-.181.638.06.83.236.189.552.146.847-.106l-.907-.724Zm-2.49-1.46c-.372-.466-.377-1.043-.014-1.36l.364.459c-.134.133-.11.363.052.567.166.208.373.257.536.127.135-.108.137-.256-.002-.48l-.075-.12c-.366-.584-.363-1 .009-1.297.441-.352 1.03-.24 1.441.274.398.499.409 1.099.025 1.405l-.378-.475c.127-.141.09-.413-.082-.63-.17-.212-.387-.267-.554-.133-.143.114-.135.268.026.52l.076.12c.344.549.332.953-.04 1.25-.437.348-.996.26-1.384-.227Zm-.353-16.337.345.166.009-.018a.845.845 0 0 1-.058-.846c.2-.415.628-.568 1.103-.398l-.282.584c-.168-.034-.326.052-.408.221-.138.287.033.62.424.808l1.423.685-.273.565-2.544-1.225.261-.542Zm-.223 4.342c-.826-.189-1.298-.827-1.137-1.53.157-.688.821-1.036 1.632-.851l.23.052-.402 1.759c.465.052.788-.12.872-.488.052-.23-.013-.437-.172-.538l.133-.58c.468.203.697.7.574 1.24-.169.74-.89 1.128-1.73.936Zm-2.71 1.802c0-.612.407-1.093.993-1.182v.633a.543.543 0 0 0-.392.543c0 .47.502.774 1.28.774.785 0 1.282-.309 1.282-.79 0-.287-.173-.501-.445-.554v-.632c.612.062 1.046.56 1.046 1.197 0 .847-.769 1.433-1.883 1.433-1.113 0-1.881-.586-1.881-1.422Zm1.347 5.094a.782.782 0 0 1 .59-.938.783.783 0 1 1-.59.938Zm.746-8.308c-.067.295.108.561.464.718l.258-1.132c-.369-.052-.653.113-.722.414Z"/></svg>diff --git a/assets/images/pro_trial_stamp.svg b/assets/images/pro_trial_stamp.svgnew file mode 100644index 00000000000..501de88a48e--- /dev/null+++ b/assets/images/pro_trial_stamp.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="51" height="51" fill="none"><path fill="#000" fill-opacity=".15" d="M45 3a3 3 0 0 1 3 3v39a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h39ZM10 7a3 3 0 0 0-3 3v31a3 3 0 0 0 3 3h31a3 3 0 0 0 3-3V10a3 3 0 0 0-3-3H10Z"/><rect width="36" height="36" x="7.5" y="7.5" stroke="#000" stroke-dasharray="2 2" rx=".5"/><rect width="44" height="44" x="3.5" y="3.5" stroke="#000" stroke-dasharray="2 2" rx="2.5"/><path fill="#000" d="M28.636 13.124c.732 0 1.27.617 1.27 1.464s-.538 1.465-1.27 1.465-1.27-.618-1.27-1.465c0-.847.538-1.464 1.27-1.464Zm-6.066-.784c.69 0 1.171.465 1.171 1.124s-.48 1.124-1.17 1.124h-.66V16h-.653v-3.66h1.312Zm3.323.8c.46 0 .784.319.837.82h-.649c-.042-.166-.188-.27-.376-.27-.319 0-.544.297-.544.73V16h-.627v-2.823h.6v.382h.022a.844.844 0 0 1 .737-.418Zm2.743.56c-.382 0-.643.36-.643.888s.261.89.643.89c.381 0 .643-.362.643-.89s-.262-.889-.643-.889Zm-6.725.314h.686c.308 0 .517-.22.517-.55 0-.33-.21-.549-.517-.549h-.686v1.099ZM28.63 36.124c.649 0 1.083.366 1.083.91v.957c0 .382.036.721.104 1.009h-.606a2.793 2.793 0 0 1-.078-.366h-.027c-.151.266-.413.419-.757.419-.539 0-.915-.356-.915-.868 0-.523.397-.811 1.228-.884l.173-.016c.177-.016.25-.09.25-.246 0-.24-.172-.392-.465-.392-.267 0-.46.126-.48.314h-.613c.006-.486.466-.837 1.104-.837Zm3.413 1.867c0 .355.167.527.512.528.146 0 .303-.031.455-.1v.523c-.157.074-.361.11-.575.11-.67 0-1.02-.366-1.02-1.06v-2.286h-.81v-.575h1.438v2.86Zm-11.452-2.076h-1.03V39h-.654v-3.085h-1.035v-.575h2.719v.575Zm2.23.226c.46 0 .784.318.836.82h-.648c-.042-.167-.188-.271-.376-.271-.32 0-.544.297-.544.73V39h-.627v-2.823h.6v.382h.022a.844.844 0 0 1 .737-.418Zm2.993 2.284h.785V39h-2.196v-.575h.785v-1.673h-.758v-.575h1.384v2.248Zm3.272-.784a.583.583 0 0 1-.204.062l-.168.022c-.46.057-.653.193-.653.449 0 .23.162.382.418.382.34 0 .607-.272.607-.622v-.293Zm-3.638-2.782c.267 0 .477.21.477.476a.477.477 0 0 1-.952 0c0-.267.214-.475.475-.476Z"/><path fill="#000" fill-rule="evenodd" d="M20.219 19.813a.406.406 0 0 0-.407.406v8.937H19V20.22c0-.673.546-1.219 1.219-1.219h10.884a.61.61 0 0 1 .431 1.04l-6.704 6.704h1.889v-.838h.812v1.041a.61.61 0 0 1-.61.61h-2.903l-1.397 1.396h6.332v-5.078h.813v5.078a.812.812 0 0 1-.813.813H21.81l-1.422 1.422h10.394a.406.406 0 0 0 .407-.407v-8.937H32v8.937c0 .673-.546 1.219-1.219 1.219H19.897a.61.61 0 0 1-.431-1.04l6.678-6.679h-1.863v.813h-.812v-1.016a.61.61 0 0 1 .61-.61h2.878l1.422-1.421h-6.332v5.078h-.813v-5.078c0-.449.364-.813.813-.813h7.144l1.422-1.422H20.219Z" clip-rule="evenodd"/></svg>diff --git a/crates/agent_ui/src/ui/end_trial_upsell.rs b/crates/agent_ui/src/ui/end_trial_upsell.rsindex 36770c21975..0d9751afecb 100644--- a/crates/agent_ui/src/ui/end_trial_upsell.rs+++ b/crates/agent_ui/src/ui/end_trial_upsell.rs@@ -1,9 +1,9 @@use std::sync::Arc;-use ai_onboarding::{AgentPanelOnboardingCard, BulletItem};+use ai_onboarding::{AgentPanelOnboardingCard, PlanDefinitions};use client::zed_urls;use gpui::{AnyElement, App, IntoElement, RenderOnce, Window};-use ui::{Divider, List, Tooltip, prelude::*};+use ui::{Divider, Tooltip, prelude::*};#[derive(IntoElement, RegisterComponent)]pub struct EndTrialUpsell {@@ -18,6 +18,8 @@ impl EndTrialUpsell {impl RenderOnce for EndTrialUpsell {fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {+ let plan_definitions = PlanDefinitions;+let pro_section = v_flex().gap_1().child(@@ -31,13 +33,7 @@ impl RenderOnce for EndTrialUpsell {).child(Divider::horizontal()),)- .child(- List::new()- .child(BulletItem::new("500 prompts with Claude models"))- .child(BulletItem::new(- "Unlimited edit predictions with Zeta, our open-source model",- )),- )+ .child(plan_definitions.pro_plan(false)).child(Button::new("cta-button", "Upgrade to Zed Pro").full_width()@@ -68,11 +64,7 @@ impl RenderOnce for EndTrialUpsell {).child(Divider::horizontal()),)- .child(- List::new()- .child(BulletItem::new("50 prompts with the Claude models"))- .child(BulletItem::new("2,000 accepted edit predictions")),- );+ .child(plan_definitions.free_plan());AgentPanelOnboardingCard::new().child(Headline::new("Your Zed Pro Trial has expired"))diff --git a/crates/ai_onboarding/src/agent_api_keys_onboarding.rs b/crates/ai_onboarding/src/agent_api_keys_onboarding.rsindex e86568fe7a3..b55ad4c8954 100644--- a/crates/ai_onboarding/src/agent_api_keys_onboarding.rs+++ b/crates/ai_onboarding/src/agent_api_keys_onboarding.rs@@ -1,8 +1,6 @@use gpui::{Action, IntoElement, ParentElement, RenderOnce, point};use language_model::{LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID};-use ui::{Divider, List, prelude::*};--use crate::BulletItem;+use ui::{Divider, List, ListBulletItem, prelude::*};pub struct ApiKeysWithProviders {configured_providers: Vec<(IconName, SharedString)>,@@ -128,7 +126,7 @@ impl RenderOnce for ApiKeysWithoutProviders {).child(Divider::horizontal()),)- .child(List::new().child(BulletItem::new(+ .child(List::new().child(ListBulletItem::new("Add your own keys to use AI without signing in.",))).child(diff --git a/crates/ai_onboarding/src/ai_onboarding.rs b/crates/ai_onboarding/src/ai_onboarding.rsindex c252b65f202..9372a33fedb 100644--- a/crates/ai_onboarding/src/ai_onboarding.rs+++ b/crates/ai_onboarding/src/ai_onboarding.rs@@ -3,6 +3,7 @@ mod agent_panel_onboarding_card;mod agent_panel_onboarding_content;mod ai_upsell_card;mod edit_prediction_onboarding_content;+mod plan_definitions;mod young_account_banner;pub use agent_api_keys_onboarding::{ApiKeysWithProviders, ApiKeysWithoutProviders};@@ -11,51 +12,14 @@ pub use agent_panel_onboarding_content::AgentPanelOnboarding;pub use ai_upsell_card::AiUpsellCard;use cloud_llm_client::Plan;pub use edit_prediction_onboarding_content::EditPredictionOnboarding;+pub use plan_definitions::PlanDefinitions;pub use young_account_banner::YoungAccountBanner;use std::sync::Arc;use client::{Client, UserStore, zed_urls};-use gpui::{AnyElement, Entity, IntoElement, ParentElement, SharedString};-use ui::{Divider, List, ListItem, RegisterComponent, TintColor, Tooltip, prelude::*};--#[derive(IntoElement)]-pub struct BulletItem {- label: SharedString,-}--impl BulletItem {- pub fn new(label: impl Into<SharedString>) -> Self {- Self {- label: label.into(),- }- }-}--impl RenderOnce for BulletItem {- fn render(self, window: &mut Window, _cx: &mut App) -> impl IntoElement {- let line_height = 0.85 * window.line_height();-- ListItem::new("list-item")- .selectable(false)- .child(- h_flex()- .w_full()- .min_w_0()- .gap_1()- .items_start()- .child(- h_flex().h(line_height).justify_center().child(- Icon::new(IconName::Dash)- .size(IconSize::XSmall)- .color(Color::Hidden),- ),- )- .child(div().w_full().min_w_0().child(Label::new(self.label))),- )- .into_any_element()- }-}+use gpui::{AnyElement, Entity, IntoElement, ParentElement};+use ui::{Divider, RegisterComponent, TintColor, Tooltip, prelude::*};#[derive(PartialEq)]pub enum SignInStatus {@@ -130,107 +94,6 @@ impl ZedAiOnboarding {self}- fn free_plan_definition(&self, cx: &mut App) -> impl IntoElement {- v_flex()- .mt_2()- .gap_1()- .child(- h_flex()- .gap_2()- .child(- Label::new("Free")- .size(LabelSize::Small)- .color(Color::Muted)- .buffer_font(cx),- )- .child(- Label::new("(Current Plan)")- .size(LabelSize::Small)- .color(Color::Custom(cx.theme().colors().text_muted.opacity(0.6)))- .buffer_font(cx),- )- .child(Divider::horizontal()),- )- .child(- List::new()- .child(BulletItem::new("50 prompts per month with Claude models"))- .child(BulletItem::new(- "2,000 accepted edit predictions with Zeta, our open-source model",- )),- )- }-- fn pro_trial_definition(&self) -> impl IntoElement {- List::new()- .child(BulletItem::new("150 prompts with Claude models"))- .child(BulletItem::new(- "Unlimited accepted edit predictions with Zeta, our open-source model",- ))- }-- fn pro_plan_definition(&self, cx: &mut App) -> impl IntoElement {- v_flex().mt_2().gap_1().map(|this| {- if self.account_too_young {- this.child(- h_flex()- .gap_2()- .child(- Label::new("Pro")- .size(LabelSize::Small)- .color(Color::Accent)- .buffer_font(cx),- )- .child(Divider::horizontal()),- )- .child(- List::new()- .child(BulletItem::new("500 prompts per month with Claude models"))- .child(BulletItem::new(- "Unlimited accepted edit predictions with Zeta, our open-source model",- ))- .child(BulletItem::new("$20 USD per month")),- )- .child(- Button::new("pro", "Get Started")- .full_width()- .style(ButtonStyle::Tinted(ui::TintColor::Accent))- .on_click(move |_, _window, cx| {- telemetry::event!("Upgrade To Pro Clicked", state = "young-account");- cx.open_url(&zed_urls::upgrade_to_zed_pro_url(cx))- }),- )- } else {- this.child(- h_flex()- .gap_2()- .child(- Label::new("Pro Trial")- .size(LabelSize::Small)- .color(Color::Accent)- .buffer_font(cx),- )- .child(Divider::horizontal()),- )- .child(- List::new()- .child(self.pro_trial_definition())- .child(BulletItem::new(- "Try it out for 14 days for free, no credit card required",- )),- )- .child(- Button::new("pro", "Start Free Trial")- .full_width()- .style(ButtonStyle::Tinted(ui::TintColor::Accent))- .on_click(move |_, _window, cx| {- telemetry::event!("Start Trial Clicked", state = "post-sign-in");- cx.open_url(&zed_urls::start_trial_url(cx))- }),- )- }- })- }-fn render_accept_terms_of_service(&self) -> AnyElement {v_flex().gap_1()@@ -269,6 +132,7 @@ impl ZedAiOnboarding {fn render_sign_in_disclaimer(&self, _cx: &mut App) -> AnyElement {let signing_in = matches!(self.sign_in_status, SignInStatus::SigningIn);+ let plan_definitions = PlanDefinitions;v_flex().gap_1()@@ -278,7 +142,7 @@ impl ZedAiOnboarding {.color(Color::Muted).mb_2(),)- .child(self.pro_trial_definition())+ .child(plan_definitions.pro_plan(false)).child(Button::new("sign_in", "Try Zed Pro for Free").disabled(signing_in)@@ -297,43 +161,132 @@ impl ZedAiOnboarding {fn render_free_plan_state(&self, cx: &mut App) -> AnyElement {let young_account_banner = YoungAccountBanner;+ let plan_definitions = PlanDefinitions;- v_flex()- .relative()- .gap_1()- .child(Headline::new("Welcome to Zed AI"))- .map(|this| {- if self.account_too_young {- this.child(young_account_banner)- } else {- this.child(self.free_plan_definition(cx)).when_some(- self.dismiss_onboarding.as_ref(),- |this, dismiss_callback| {- let callback = dismiss_callback.clone();+ if self.account_too_young {+ v_flex()+ .relative()+ .max_w_full()+ .gap_1()+ .child(Headline::new("Welcome to Zed AI"))+ .child(young_account_banner)+ .child(+ v_flex()+ .mt_2()+ .gap_1()+ .child(+ h_flex()+ .gap_2()+ .child(+ Label::new("Pro")+ .size(LabelSize::Small)+ .color(Color::Accent)+ .buffer_font(cx),+ )+ .child(Divider::horizontal()),+ )+ .child(plan_definitions.pro_plan(true))+ .child(+ Button::new("pro", "Get Started")+ .full_width()+ .style(ButtonStyle::Tinted(ui::TintColor::Accent))+ .on_click(move |_, _window, cx| {+ telemetry::event!(+ "Upgrade To Pro Clicked",+ state = "young-account"+ );+ cx.open_url(&zed_urls::upgrade_to_zed_pro_url(cx))+ }),+ ),+ )+ .into_any_element()+ } else {+ v_flex()+ .relative()+ .gap_1()+ .child(Headline::new("Welcome to Zed AI"))+ .child(+ v_flex()+ .mt_2()+ .gap_1()+ .child(+ h_flex()+ .gap_2()+ .child(+ Label::new("Free")+ .size(LabelSize::Small)+ .color(Color::Muted)+ .buffer_font(cx),+ )+ .child(+ Label::new("(Current Plan)")+ .size(LabelSize::Small)+ .color(Color::Custom(+ cx.theme().colors().text_muted.opacity(0.6),+ ))+ .buffer_font(cx),+ )+ .child(Divider::horizontal()),+ )+ .child(plan_definitions.free_plan()),+ )+ .when_some(+ self.dismiss_onboarding.as_ref(),+ |this, dismiss_callback| {+ let callback = dismiss_callback.clone();- this.child(- h_flex().absolute().top_0().right_0().child(- IconButton::new("dismiss_onboarding", IconName::Close)- .icon_size(IconSize::Small)- .tooltip(Tooltip::text("Dismiss"))- .on_click(move |_, window, cx| {- telemetry::event!(- "Banner Dismissed",- source = "AI Onboarding",- );- callback(window, cx)- }),- ),- )- },- )- }- })- .child(self.pro_plan_definition(cx))- .into_any_element()+ this.child(+ h_flex().absolute().top_0().right_0().child(+ IconButton::new("dismiss_onboarding", IconName::Close)+ .icon_size(IconSize::Small)+ .tooltip(Tooltip::text("Dismiss"))+ .on_click(move |_, window, cx| {+ telemetry::event!(+ "Banner Dismissed",+ source = "AI Onboarding",+ );+ callback(window, cx)+ }),+ ),+ )+ },+ )+ .child(+ v_flex()+ .mt_2()+ .gap_1()+ .child(+ h_flex()+ .gap_2()+ .child(+ Label::new("Pro Trial")+ .size(LabelSize::Small)+ .color(Color::Accent)+ .buffer_font(cx),+ )+ .child(Divider::horizontal()),+ )+ .child(plan_definitions.pro_trial(true))+ .child(+ Button::new("pro", "Start Free Trial")+ .full_width()+ .style(ButtonStyle::Tinted(ui::TintColor::Accent))+ .on_click(move |_, _window, cx| {+ telemetry::event!(+ "Start Trial Clicked",+ state = "post-sign-in"+ );+ cx.open_url(&zed_urls::start_trial_url(cx))+ }),+ ),+ )+ .into_any_element()+ }}fn render_trial_state(&self, _cx: &mut App) -> AnyElement {+ let plan_definitions = PlanDefinitions;+v_flex().relative().gap_1()@@ -343,13 +296,7 @@ impl ZedAiOnboarding {.color(Color::Muted).mb_2(),)- .child(- List::new()- .child(BulletItem::new("150 prompts with Claude models"))- .child(BulletItem::new(- "Unlimited edit predictions with Zeta, our open-source model",- )),- )+ .child(plan_definitions.pro_trial(false)).when_some(self.dismiss_onboarding.as_ref(),|this, dismiss_callback| {@@ -374,6 +321,8 @@ impl ZedAiOnboarding {}fn render_pro_plan_state(&self, _cx: &mut App) -> AnyElement {+ let plan_definitions = PlanDefinitions;+v_flex().gap_1().child(Headline::new("Welcome to Zed Pro"))@@ -382,13 +331,7 @@ impl ZedAiOnboarding {.color(Color::Muted).mb_2(),)- .child(- List::new()- .child(BulletItem::new("500 prompts with Claude models"))- .child(BulletItem::new(- "Unlimited edit predictions with Zeta, our open-source model",- )),- )+ .child(plan_definitions.pro_plan(false)).child(Button::new("pro", "Continue with Zed Pro").full_width()@@ -450,8 +393,9 @@ impl Component for ZedAiOnboarding {Some(v_flex()- .p_4().gap_4()+ .items_center()+ .max_w_4_5().children(vec![single_example("Not Signed-in",@@ -462,8 +406,8 @@ impl Component for ZedAiOnboarding {onboarding(SignInStatus::SignedIn, false, None, false),),single_example(- "Account too young",- onboarding(SignInStatus::SignedIn, false, None, true),+ "Young Account",+ onboarding(SignInStatus::SignedIn, true, None, true),),single_example("Free Plan",diff --git a/crates/ai_onboarding/src/ai_upsell_card.rs b/crates/ai_onboarding/src/ai_upsell_card.rsindex 89a782a7c2d..a3fea5dce32 100644--- a/crates/ai_onboarding/src/ai_upsell_card.rs+++ b/crates/ai_onboarding/src/ai_upsell_card.rs@@ -1,11 +1,14 @@-use std::sync::Arc;+use std::{sync::Arc, time::Duration};use client::{Client, zed_urls};use cloud_llm_client::Plan;-use gpui::{AnyElement, App, IntoElement, RenderOnce, Window};-use ui::{Divider, List, Vector, VectorName, prelude::*};+use gpui::{+ Animation, AnimationExt, AnyElement, App, IntoElement, RenderOnce, Transformation, Window,+ percentage,+};+use ui::{Divider, Vector, VectorName, prelude::*};-use crate::{BulletItem, SignInStatus};+use crate::{SignInStatus, plan_definitions::PlanDefinitions};#[derive(IntoElement, RegisterComponent)]pub struct AiUpsellCard {@@ -36,6 +39,8 @@ impl AiUpsellCard {impl RenderOnce for AiUpsellCard {fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {+ let plan_definitions = PlanDefinitions;+let pro_section = v_flex().flex_grow().w_full()@@ -51,13 +56,7 @@ impl RenderOnce for AiUpsellCard {).child(Divider::horizontal()),)- .child(- List::new()- .child(BulletItem::new("500 prompts with Claude models"))- .child(BulletItem::new(- "Unlimited edit predictions with Zeta, our open-source model",- )),- );+ .child(plan_definitions.pro_plan(false));let free_section = v_flex().flex_grow()@@ -74,11 +73,7 @@ impl RenderOnce for AiUpsellCard {).child(Divider::horizontal()),)- .child(- List::new()- .child(BulletItem::new("50 prompts with Claude models"))- .child(BulletItem::new("2,000 accepted edit predictions")),- );+ .child(plan_definitions.free_plan());let grid_bg = h_flex().absolute().inset_0().w_full().h(px(240.)).child(Vector::new(VectorName::Grid, rems_from_px(500.), rems_from_px(240.))@@ -101,44 +96,11 @@ impl RenderOnce for AiUpsellCard {),));- const DESCRIPTION: &str = "Zed offers a complete agentic experience, with robust editing and reviewing features to collaborate with AI.";+ let description = PlanDefinitions::AI_DESCRIPTION;- let footer_buttons = match self.sign_in_status {- SignInStatus::SignedIn => v_flex()- .items_center()- .gap_1()- .child(- Button::new("sign_in", "Start 14-day Free Pro Trial")- .full_width()- .style(ButtonStyle::Tinted(ui::TintColor::Accent))- .on_click(move |_, _window, cx| {- telemetry::event!("Start Trial Clicked", state = "post-sign-in");- cx.open_url(&zed_urls::start_trial_url(cx))- })- .when_some(self.tab_index, |this, tab_index| this.tab_index(tab_index)),- )- .child(- Label::new("No credit card required")- .size(LabelSize::Small)- .color(Color::Muted),- )- .into_any_element(),- _ => Button::new("sign_in", "Sign In")- .full_width()- .style(ButtonStyle::Tinted(ui::TintColor::Accent))- .when_some(self.tab_index, |this, tab_index| this.tab_index(tab_index))- .on_click({- let callback = self.sign_in.clone();- move |_, window, cx| {- telemetry::event!("Start Trial Clicked", state = "pre-sign-in");- callback(window, cx)- }- })- .into_any_element(),- };-- v_flex()+ let card = v_flex().relative()+ .flex_grow().p_4().pt_3().border_1()@@ -146,25 +108,129 @@ impl RenderOnce for AiUpsellCard {.rounded_lg().overflow_hidden().child(grid_bg)- .child(gradient_bg)- .child(Label::new("Try Zed AI").size(LabelSize::Large))+ .child(gradient_bg);++ let plans_section = h_flex()+ .w_full()+ .mt_1p5()+ .mb_2p5()+ .items_start()+ .gap_6()+ .child(free_section)+ .child(pro_section);++ let footer_container = v_flex().items_center().gap_1();++ let certified_user_stamp = div()+ .absolute()+ .top_2()+ .right_2()+ .size(rems_from_px(72.)).child(- div()- .max_w_3_4()- .mb_2()- .child(Label::new(DESCRIPTION).color(Color::Muted)),- )+ Vector::new(+ VectorName::CertifiedUserStamp,+ rems_from_px(72.),+ rems_from_px(72.),+ )+ .color(Color::Custom(cx.theme().colors().text_accent.alpha(0.3)))+ .with_animation(+ "loading_stamp",+ Animation::new(Duration::from_secs(10)).repeat(),+ |this, delta| this.transform(Transformation::rotate(percentage(delta))),+ ),+ );++ let pro_trial_stamp = div()+ .absolute()+ .top_2()+ .right_2()+ .size(rems_from_px(72.)).child(- h_flex()- .w_full()- .mt_1p5()- .mb_2p5()- .items_start()- .gap_6()- .child(free_section)- .child(pro_section),- )- .child(footer_buttons)+ Vector::new(+ VectorName::ProTrialStamp,+ rems_from_px(72.),+ rems_from_px(72.),+ )+ .color(Color::Custom(cx.theme().colors().text.alpha(0.2))),+ );++ match self.sign_in_status {+ SignInStatus::SignedIn => match self.user_plan {+ None | Some(Plan::ZedFree) => card+ .child(Label::new("Try Zed AI").size(LabelSize::Large))+ .child(+ div()+ .max_w_3_4()+ .mb_2()+ .child(Label::new(description).color(Color::Muted)),+ )+ .child(plans_section)+ .child(+ footer_container+ .child(+ Button::new("start_trial", "Start 14-day Free Pro Trial")+ .full_width()+ .style(ButtonStyle::Tinted(ui::TintColor::Accent))+ .when_some(self.tab_index, |this, tab_index| {+ this.tab_index(tab_index)+ })+ .on_click(move |_, _window, cx| {+ telemetry::event!(+ "Start Trial Clicked",+ state = "post-sign-in"+ );+ cx.open_url(&zed_urls::start_trial_url(cx))+ }),+ )+ .child(+ Label::new("No credit card required")+ .size(LabelSize::Small)+ .color(Color::Muted),+ ),+ ),+ Some(Plan::ZedProTrial) => card+ .child(pro_trial_stamp)+ .child(Label::new("You're in the Zed Pro Trial").size(LabelSize::Large))+ .child(+ Label::new("Here's what you get for the next 14 days:")+ .color(Color::Muted)+ .mb_2(),+ )+ .child(plan_definitions.pro_trial(false)),+ Some(Plan::ZedPro) => card+ .child(certified_user_stamp)+ .child(Label::new("You're in the Zed Pro plan").size(LabelSize::Large))+ .child(+ Label::new("Here's what you get:")+ .color(Color::Muted)+ .mb_2(),+ )+ .child(plan_definitions.pro_plan(false)),+ },+ // Signed Out State+ _ => card+ .child(Label::new("Try Zed AI").size(LabelSize::Large))+ .child(+ div()+ .max_w_3_4()+ .mb_2()+ .child(Label::new(description).color(Color::Muted)),+ )+ .child(plans_section)+ .child(+ Button::new("sign_in", "Sign In")+ .full_width()+ .style(ButtonStyle::Tinted(ui::TintColor::Accent))+ .when_some(self.tab_index, |this, tab_index| this.tab_index(tab_index))+ .on_click({+ let callback = self.sign_in.clone();+ move |_, window, cx| {+ telemetry::event!("Start Trial Clicked", state = "pre-sign-in");+ callback(window, cx)+ }+ }),+ ),+ }}}@@ -188,7 +254,6 @@ impl Component for AiUpsellCard {fn preview(_window: &mut Window, _cx: &mut App) -> Option<AnyElement> {Some(v_flex()- .p_4().gap_4().children(vec![example_group(vec![single_example(@@ -202,11 +267,31 @@ impl Component for AiUpsellCard {.into_any_element(),),single_example(- "Signed In State",+ "Free Plan",AiUpsellCard {sign_in_status: SignInStatus::SignedIn,sign_in: Arc::new(|_, _| {}),- user_plan: None,+ user_plan: Some(Plan::ZedFree),+ tab_index: Some(1),+ }+ .into_any_element(),+ ),+ single_example(+ "Pro Trial",+ AiUpsellCard {+ sign_in_status: SignInStatus::SignedIn,+ sign_in: Arc::new(|_, _| {}),+ user_plan: Some(Plan::ZedProTrial),+ tab_index: Some(1),+ }+ .into_any_element(),+ ),+ single_example(+ "Pro Plan",+ AiUpsellCard {+ sign_in_status: SignInStatus::SignedIn,+ sign_in: Arc::new(|_, _| {}),+ user_plan: Some(Plan::ZedPro),tab_index: Some(1),}.into_any_element(),diff --git a/crates/ai_onboarding/src/plan_definitions.rs b/crates/ai_onboarding/src/plan_definitions.rsnew file mode 100644index 00000000000..8d66f6c3563--- /dev/null+++ b/crates/ai_onboarding/src/plan_definitions.rs@@ -0,0 +1,39 @@+use gpui::{IntoElement, ParentElement};+use ui::{List, ListBulletItem, prelude::*};++/// Centralized definitions for Zed AI plans+pub struct PlanDefinitions;++impl PlanDefinitions {+ pub const AI_DESCRIPTION: &'static str = "Zed offers a complete agentic experience, with robust editing and reviewing features to collaborate with AI.";++ pub fn free_plan(&self) -> impl IntoElement {+ List::new()+ .child(ListBulletItem::new("50 prompts with Claude models"))+ .child(ListBulletItem::new("2,000 accepted edit predictions"))+ }++ pub fn pro_trial(&self, period: bool) -> impl IntoElement {+ List::new()+ .child(ListBulletItem::new("150 prompts with Claude models"))+ .child(ListBulletItem::new(+ "Unlimited edit predictions with Zeta, our open-source model",+ ))+ .when(period, |this| {+ this.child(ListBulletItem::new(+ "Try it out for 14 days for free, no credit card required",+ ))+ })+ }++ pub fn pro_plan(&self, price: bool) -> impl IntoElement {+ List::new()+ .child(ListBulletItem::new("500 prompts with Claude models"))+ .child(ListBulletItem::new(+ "Unlimited edit predictions with Zeta, our open-source model",+ ))+ .when(price, |this| {+ this.child(ListBulletItem::new("$20 USD per month"))+ })+ }+}diff --git a/crates/ai_onboarding/src/young_account_banner.rs b/crates/ai_onboarding/src/young_account_banner.rsindex a43625a60ee..54f563e4aac 100644--- a/crates/ai_onboarding/src/young_account_banner.rs+++ b/crates/ai_onboarding/src/young_account_banner.rs@@ -15,6 +15,7 @@ impl RenderOnce for YoungAccountBanner {.child(YOUNG_ACCOUNT_DISCLAIMER);div()+ .max_w_full().my_1().child(Banner::new().severity(ui::Severity::Warning).child(label))}diff --git a/crates/ui/src/components/image.rs b/crates/ui/src/components/image.rsindex 2deba68d88f..18f804abe9d 100644--- a/crates/ui/src/components/image.rs+++ b/crates/ui/src/components/image.rs@@ -1,5 +1,6 @@use std::sync::Arc;+use gpui::Transformation;use gpui::{App, IntoElement, Rems, RenderOnce, Size, Styled, Window, svg};use serde::{Deserialize, Serialize};use strum::{EnumIter, EnumString, IntoStaticStr};@@ -12,11 +13,13 @@ use crate::prelude::*;)]#[strum(serialize_all = "snake_case")]pub enum VectorName {- ZedLogo,- ZedXCopilot,- Grid,AiGrid,+ CertifiedUserStamp,DebuggerGrid,+ Grid,+ ProTrialStamp,+ ZedLogo,+ ZedXCopilot,}impl VectorName {@@ -37,6 +40,7 @@ pub struct Vector {path: Arc<str>,color: Color,size: Size<Rems>,+ transformation: Transformation,}impl Vector {@@ -46,6 +50,7 @@ impl Vector {path: vector.path(),color: Color::default(),size: Size { width, height },+ transformation: Transformation::default(),}}@@ -66,6 +71,11 @@ impl Vector {self.size = size;self}++ pub fn transform(mut self, transformation: Transformation) -> Self {+ self.transformation = transformation;+ self+ }}impl RenderOnce for Vector {@@ -81,6 +91,7 @@ impl RenderOnce for Vector {.h(height).path(self.path).text_color(self.color.color(cx))+ .with_transformation(self.transformation)}}diff --git a/crates/ui/src/components/list.rs b/crates/ui/src/components/list.rsindex 88650b6ae8d..6876f290ced 100644--- a/crates/ui/src/components/list.rs+++ b/crates/ui/src/components/list.rs@@ -1,10 +1,12 @@mod list;+mod list_bullet_item;mod list_header;mod list_item;mod list_separator;mod list_sub_header;pub use list::*;+pub use list_bullet_item::*;pub use list_header::*;pub use list_item::*;pub use list_separator::*;diff --git a/crates/ui/src/components/list/list_bullet_item.rs b/crates/ui/src/components/list/list_bullet_item.rsnew file mode 100644index 00000000000..6e079d9f112--- /dev/null+++ b/crates/ui/src/components/list/list_bullet_item.rs@@ -0,0 +1,40 @@+use crate::{ListItem, prelude::*};+use gpui::{IntoElement, ParentElement, SharedString};++#[derive(IntoElement)]+pub struct ListBulletItem {+ label: SharedString,+}++impl ListBulletItem {+ pub fn new(label: impl Into<SharedString>) -> Self {+ Self {+ label: label.into(),+ }+ }+}++impl RenderOnce for ListBulletItem {+ fn render(self, window: &mut Window, _cx: &mut App) -> impl IntoElement {+ let line_height = 0.85 * window.line_height();++ ListItem::new("list-item")+ .selectable(false)+ .child(+ h_flex()+ .w_full()+ .min_w_0()+ .gap_1()+ .items_start()+ .child(+ h_flex().h(line_height).justify_center().child(+ Icon::new(IconName::Dash)+ .size(IconSize::XSmall)+ .color(Color::Hidden),+ ),+ )+ .child(div().w_full().min_w_0().child(Label::new(self.label))),+ )+ .into_any_element()+ }+}