max_mode_tooltip.rs

 1use gpui::{Context, IntoElement, Render, Window};
 2use ui::{prelude::*, tooltip_container};
 3
 4pub struct MaxModeTooltip {
 5    selected: bool,
 6}
 7
 8impl MaxModeTooltip {
 9    pub fn new() -> Self {
10        Self { selected: false }
11    }
12
13    pub fn selected(mut self, selected: bool) -> Self {
14        self.selected = selected;
15        self
16    }
17}
18
19impl Render for MaxModeTooltip {
20    fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
21        tooltip_container(window, cx, |this, _, _| {
22            this.gap_1()
23                .map(|header| if self.selected {
24                    header.child(
25                        h_flex()
26                            .justify_between()
27                            .child(
28                                h_flex()
29                                    .gap_1p5()
30                                    .child(Icon::new(IconName::ZedMaxMode).size(IconSize::Small).color(Color::Accent))
31                                    .child(Label::new("Zed's Max Mode"))
32                            )
33                            .child(
34                                h_flex()
35                                    .gap_0p5()
36                                    .child(Icon::new(IconName::Check).size(IconSize::XSmall).color(Color::Accent))
37                                    .child(Label::new("Turned On").size(LabelSize::XSmall).color(Color::Accent))
38                            )
39                    )
40                } else {
41                    header.child(
42                        h_flex()
43                            .gap_1p5()
44                            .child(Icon::new(IconName::ZedMaxMode).size(IconSize::Small))
45                            .child(Label::new("Zed's Max Mode"))
46                    )
47                })
48                .child(
49                    div()
50                        .max_w_72()
51                        .child(
52                            Label::new("This mode enables models to use large context windows, unlimited tool calls, and other capabilities for expanded reasoning, offering an unfettered agentic experience.")
53                                .size(LabelSize::Small)
54                                .color(Color::Muted)
55                        )
56                )
57        })
58    }
59}