@@ -468,6 +468,7 @@ impl MessageEditor {
}
let active_completion_mode = thread.completion_mode();
+ let max_mode_enabled = active_completion_mode == CompletionMode::Max;
Some(
Button::new("max-mode", "Max Mode")
@@ -477,7 +478,7 @@ impl MessageEditor {
.icon_size(IconSize::Small)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
- .toggle_state(active_completion_mode == CompletionMode::Max)
+ .toggle_state(max_mode_enabled)
.on_click(cx.listener(move |this, _event, _window, cx| {
this.thread.update(cx, |thread, _cx| {
thread.set_completion_mode(match active_completion_mode {
@@ -486,7 +487,10 @@ impl MessageEditor {
});
});
}))
- .tooltip(|_, cx| cx.new(MaxModeTooltip::new).into())
+ .tooltip(move |_window, cx| {
+ cx.new(|_| MaxModeTooltip::new().selected(max_mode_enabled))
+ .into()
+ })
.into_any_element(),
)
}
@@ -1,24 +1,50 @@
use gpui::{Context, IntoElement, Render, Window};
use ui::{prelude::*, tooltip_container};
-pub struct MaxModeTooltip;
+pub struct MaxModeTooltip {
+ selected: bool,
+}
impl MaxModeTooltip {
- pub fn new(_cx: &mut Context<Self>) -> Self {
- Self
+ pub fn new() -> Self {
+ Self { selected: false }
+ }
+
+ pub fn selected(mut self, selected: bool) -> Self {
+ self.selected = selected;
+ self
}
}
impl Render for MaxModeTooltip {
- fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
- tooltip_container(_window, cx, |this, _, _| {
+ fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ tooltip_container(window, cx, |this, _, _| {
this.gap_1()
- .child(
- h_flex()
- .gap_1p5()
- .child(Icon::new(IconName::ZedMaxMode).size(IconSize::Small))
- .child(Label::new("Zed's Max Mode"))
- )
+ .map(|header| if self.selected {
+ header.child(
+ h_flex()
+ .justify_between()
+ .child(
+ h_flex()
+ .gap_1p5()
+ .child(Icon::new(IconName::ZedMaxMode).size(IconSize::Small).color(Color::Accent))
+ .child(Label::new("Zed's Max Mode"))
+ )
+ .child(
+ h_flex()
+ .gap_0p5()
+ .child(Icon::new(IconName::Check).size(IconSize::XSmall).color(Color::Accent))
+ .child(Label::new("Turned On").size(LabelSize::XSmall).color(Color::Accent))
+ )
+ )
+ } else {
+ header.child(
+ h_flex()
+ .gap_1p5()
+ .child(Icon::new(IconName::ZedMaxMode).size(IconSize::Small))
+ .child(Label::new("Zed's Max Mode"))
+ )
+ })
.child(
div()
.max_w_72()