onboarding: Adjust the AI upsell card depending on user's state (#35658)
Use includes centralizing what each plan delivers in one single file (`plan_definitions.rs`). Release Notes: - N/A
This commit is contained in:
parent
0025019db4
commit
30414d154e
11 changed files with 398 additions and 284 deletions
|
@ -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 {
|
||||
AiGrid,
|
||||
CertifiedUserStamp,
|
||||
DebuggerGrid,
|
||||
Grid,
|
||||
ProTrialStamp,
|
||||
ZedLogo,
|
||||
ZedXCopilot,
|
||||
Grid,
|
||||
AiGrid,
|
||||
DebuggerGrid,
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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::*;
|
||||
|
|
40
crates/ui/src/components/list/list_bullet_item.rs
Normal file
40
crates/ui/src/components/list/list_bullet_item.rs
Normal file
|
@ -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()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue