1use gpui::{AnyElement, IntoElement, ParentElement, linear_color_stop, linear_gradient};
2use smallvec::SmallVec;
3use ui::{Vector, VectorName, prelude::*};
4
5#[derive(IntoElement)]
6pub struct AgentPanelOnboardingCard {
7 children: SmallVec<[AnyElement; 2]>,
8}
9
10impl AgentPanelOnboardingCard {
11 pub fn new() -> Self {
12 Self {
13 children: SmallVec::new(),
14 }
15 }
16}
17
18impl ParentElement for AgentPanelOnboardingCard {
19 fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>) {
20 self.children.extend(elements)
21 }
22}
23
24impl RenderOnce for AgentPanelOnboardingCard {
25 fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
26 div()
27 .m_4()
28 .p(px(3.))
29 .elevation_2(cx)
30 .rounded_lg()
31 .bg(cx.theme().colors().background.alpha(0.5))
32 .child(
33 v_flex()
34 .relative()
35 .size_full()
36 .px_4()
37 .py_3()
38 .gap_2()
39 .border_1()
40 .rounded(px(5.))
41 .border_color(cx.theme().colors().text.alpha(0.1))
42 .overflow_hidden()
43 .bg(cx.theme().colors().panel_background)
44 .child(
45 div()
46 .opacity(0.5)
47 .absolute()
48 .top(px(-8.0))
49 .right_0()
50 .w(px(400.))
51 .h(px(92.))
52 .child(
53 Vector::new(
54 VectorName::AiGrid,
55 rems_from_px(400.),
56 rems_from_px(92.),
57 )
58 .color(Color::Custom(cx.theme().colors().text.alpha(0.32))),
59 ),
60 )
61 .child(
62 div()
63 .absolute()
64 .top_0()
65 .right_0()
66 .w(px(660.))
67 .h(px(401.))
68 .overflow_hidden()
69 .bg(linear_gradient(
70 75.,
71 linear_color_stop(
72 cx.theme().colors().panel_background.alpha(0.01),
73 1.0,
74 ),
75 linear_color_stop(cx.theme().colors().panel_background, 0.45),
76 )),
77 )
78 .children(self.children),
79 )
80 }
81}