agent: Add enabled indicator in Max Mode tooltip (#30008)

This PR adds an enabled indicator in the Max Mode tooltip to show when
it is enabled:

<img width="409" alt="Screenshot 2025-05-06 at 9 49 48 AM"
src="https://github.com/user-attachments/assets/43d3f6dd-5658-467a-9df9-606ce326426a"
/>

Release Notes:

- Agent Beta: Added an indicator in the Max Mode tooltip to show when it
is enabled.

Co-authored-by: Danilo <danilo@zed.dev>
This commit is contained in:
Marshall Bowers 2025-05-06 10:07:31 -04:00 committed by GitHub
parent 096355915a
commit fed5f89f8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 13 deletions

View file

@ -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(),
)
}