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_2p5()
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 .rounded_md()
53 .child(
54 Vector::new(
55 VectorName::AiGrid,
56 rems_from_px(400.),
57 rems_from_px(92.),
58 )
59 .color(Color::Custom(cx.theme().colors().text.alpha(0.32))),
60 ),
61 )
62 .child(
63 div()
64 .absolute()
65 .top_0p5()
66 .right_0p5()
67 .w(px(660.))
68 .h(px(401.))
69 .overflow_hidden()
70 .rounded_md()
71 .bg(linear_gradient(
72 75.,
73 linear_color_stop(
74 cx.theme().colors().panel_background.alpha(0.01),
75 1.0,
76 ),
77 linear_color_stop(cx.theme().colors().panel_background, 0.45),
78 )),
79 )
80 .children(self.children),
81 )
82 }
83}