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, window, cx)
49 .map(|kb| kb.size(rems_from_px(12.)));
50
51 tooltip_container(window, cx, |this, _, _| {
52 this
53 .child(
54 h_flex()
55 .justify_between()
56 .child(title)
57 .children(keybinding)
58 )
59 .child(
60 div()
61 .max_w_64()
62 .child(
63 Label::new("Enables models to use large context windows, unlimited tool calls, and other capabilities for expanded reasoning.")
64 .size(LabelSize::Small)
65 .color(Color::Muted)
66 )
67 )
68 })
69 }
70}