agent_ui: Improve UI for the feedback container (#43195)

Improves a previously weird wrapping and simplify the UI by adding the
meta text inside the tooltip itself.


https://github.com/user-attachments/assets/9896d4a2-6954-4e61-9b77-864db8f2542a

Release Notes:

- N/A
This commit is contained in:
Danilo Leal
2025-11-20 18:18:30 -03:00
committed by GitHub
parent a332b79189
commit 6adb0f4d03
+23 -22
View File
@@ -5024,15 +5024,12 @@ impl AcpThreadView {
}));
let mut container = h_flex()
.id("thread-controls-container")
.group("thread-controls-container")
.w_full()
.py_2()
.px_5()
.gap_px()
.opacity(0.6)
.hover(|style| style.opacity(1.))
.flex_wrap()
.hover(|s| s.opacity(1.))
.justify_end();
if AgentSettings::get_global(cx).enable_feedback
@@ -5042,23 +5039,13 @@ impl AcpThreadView {
{
let feedback = self.thread_feedback.feedback;
container = container
.child(
div().visible_on_hover("thread-controls-container").child(
Label::new(match feedback {
Some(ThreadFeedback::Positive) => "Thanks for your feedback!",
Some(ThreadFeedback::Negative) => {
"We appreciate your feedback and will use it to improve."
}
None => {
"Rating the thread sends all of your current conversation to the Zed team."
}
})
.color(Color::Muted)
.size(LabelSize::XSmall)
.truncate(),
),
let tooltip_meta = || {
SharedString::new(
"Rating the thread sends all of your current conversation to the Zed team.",
)
};
container = container
.child(
IconButton::new("feedback-thumbs-up", IconName::ThumbsUp)
.shape(ui::IconButtonShape::Square)
@@ -5067,7 +5054,12 @@ impl AcpThreadView {
Some(ThreadFeedback::Positive) => Color::Accent,
_ => Color::Ignored,
})
.tooltip(Tooltip::text("Helpful Response"))
.tooltip(move |window, cx| match feedback {
Some(ThreadFeedback::Positive) => {
Tooltip::text("Thanks for your feedback!")(window, cx)
}
_ => Tooltip::with_meta("Helpful Response", None, tooltip_meta(), cx),
})
.on_click(cx.listener(move |this, _, window, cx| {
this.handle_feedback_click(ThreadFeedback::Positive, window, cx);
})),
@@ -5080,7 +5072,16 @@ impl AcpThreadView {
Some(ThreadFeedback::Negative) => Color::Accent,
_ => Color::Ignored,
})
.tooltip(Tooltip::text("Not Helpful"))
.tooltip(move |window, cx| match feedback {
Some(ThreadFeedback::Negative) => {
Tooltip::text(
"We appreciate your feedback and will use it to improve in the future.",
)(window, cx)
}
_ => {
Tooltip::with_meta("Not Helpful Response", None, tooltip_meta(), cx)
}
})
.on_click(cx.listener(move |this, _, window, cx| {
this.handle_feedback_click(ThreadFeedback::Negative, window, cx);
})),