1use crate::ToggleBurnMode;
2use gpui::{Context, FontWeight, IntoElement, Render, Window};
3use ui::{KeyBinding, prelude::*, tooltip_container};
4
5pub struct BurnModeTooltip {
6 selected: bool,
7}
8
9impl BurnModeTooltip {
10 pub fn new() -> Self {
11 Self { selected: false }
12 }
13
14 pub fn selected(mut self, selected: bool) -> Self {
15 self.selected = selected;
16 self
17 }
18}
19
20impl Render for BurnModeTooltip {
21 fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
22 let (icon, color) = if self.selected {
23 (IconName::ZedBurnModeOn, Color::Error)
24 } else {
25 (IconName::ZedBurnMode, Color::Default)
26 };
27
28 let turned_on = h_flex()
29 .h_4()
30 .px_1()
31 .border_1()
32 .border_color(cx.theme().colors().border)
33 .bg(cx.theme().colors().text_accent.opacity(0.1))
34 .rounded_sm()
35 .child(
36 Label::new("ON")
37 .size(LabelSize::XSmall)
38 .weight(FontWeight::SEMIBOLD)
39 .color(Color::Accent),
40 );
41
42 let title = h_flex()
43 .gap_1p5()
44 .child(Icon::new(icon).size(IconSize::Small).color(color))
45 .child(Label::new("Burn Mode"))
46 .when(self.selected, |title| title.child(turned_on));
47
48 let keybinding = KeyBinding::for_action(&ToggleBurnMode, cx).size(rems_from_px(12.));
49
50 tooltip_container(cx, |this, _| {
51 this
52 .child(
53 h_flex()
54 .justify_between()
55 .child(title)
56 .child(keybinding)
57 )
58 .child(
59 div()
60 .max_w_64()
61 .child(
62 Label::new("Enables models to use large context windows, unlimited tool calls, and other capabilities for expanded reasoning.")
63 .size(LabelSize::Small)
64 .color(Color::Muted)
65 )
66 )
67 })
68 }
69}