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        let icon = if self.selected {
22            IconName::ZedBurnModeOn
23        } else {
24            IconName::ZedBurnMode
25        };
26
27        let title = h_flex()
28            .gap_1()
29            .child(Icon::new(icon).size(IconSize::Small))
30            .child(Label::new("Burn Mode"));
31
32        tooltip_container(window, cx, |this, _, _| {
33            this.gap_0p5()
34                .map(|header| if self.selected {
35                    header.child(
36                        h_flex()
37                            .justify_between()
38                            .child(title)
39                            .child(
40                                h_flex()
41                                    .gap_0p5()
42                                    .child(Icon::new(IconName::Check).size(IconSize::XSmall).color(Color::Accent))
43                                    .child(Label::new("Turned On").size(LabelSize::XSmall).color(Color::Accent))
44                            )
45                    )
46                } else {
47                    header.child(title)
48                })
49                .child(
50                    div()
51                        .max_w_72()
52                        .child(
53                            Label::new("Enables models to use large context windows, unlimited tool calls, and other capabilities for expanded reasoning, offering an unfettered agentic experience.")
54                                .size(LabelSize::Small)
55                                .color(Color::Muted)
56                        )
57                )
58        })
59    }
60}