agent: Only show expand message editor when focused on it (#29595)
Simplifying the UI as much as possible. Release Notes: - N/A
This commit is contained in:
parent
7e25460708
commit
fcef101227
1 changed files with 27 additions and 25 deletions
|
@ -495,32 +495,34 @@ impl MessageEditor {
|
||||||
.items_start()
|
.items_start()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.child(self.context_strip.clone())
|
.child(self.context_strip.clone())
|
||||||
.child(
|
.when(focus_handle.is_focused(window), |this| {
|
||||||
IconButton::new("toggle-height", expand_icon)
|
this.child(
|
||||||
.icon_size(IconSize::XSmall)
|
IconButton::new("toggle-height", expand_icon)
|
||||||
.icon_color(Color::Muted)
|
.icon_size(IconSize::XSmall)
|
||||||
.tooltip({
|
.icon_color(Color::Muted)
|
||||||
let focus_handle = focus_handle.clone();
|
.tooltip({
|
||||||
move |window, cx| {
|
let focus_handle = focus_handle.clone();
|
||||||
let expand_label = if is_editor_expanded {
|
move |window, cx| {
|
||||||
"Minimize Message Editor".to_string()
|
let expand_label = if is_editor_expanded {
|
||||||
} else {
|
"Minimize Message Editor".to_string()
|
||||||
"Expand Message Editor".to_string()
|
} else {
|
||||||
};
|
"Expand Message Editor".to_string()
|
||||||
|
};
|
||||||
|
|
||||||
Tooltip::for_action_in(
|
Tooltip::for_action_in(
|
||||||
expand_label,
|
expand_label,
|
||||||
&ExpandMessageEditor,
|
&ExpandMessageEditor,
|
||||||
&focus_handle,
|
&focus_handle,
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on_click(cx.listener(|_, _, window, cx| {
|
.on_click(cx.listener(|_, _, window, cx| {
|
||||||
window.dispatch_action(Box::new(ExpandMessageEditor), cx);
|
window.dispatch_action(Box::new(ExpandMessageEditor), cx);
|
||||||
})),
|
})),
|
||||||
),
|
)
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue