Thread controls UI pass

This commit is contained in:
Danilo Leal 2025-08-26 11:37:17 -03:00
parent 5bfe900468
commit 698d6557e1

View file

@ -4171,13 +4171,14 @@ impl AcpThreadView {
) -> impl IntoElement { ) -> impl IntoElement {
let is_generating = matches!(thread.read(cx).status(), ThreadStatus::Generating); let is_generating = matches!(thread.read(cx).status(), ThreadStatus::Generating);
if is_generating { if is_generating {
return h_flex().id("thread-controls-container").ml_1().child( return h_flex().id("thread-controls-container").child(
div() div()
.py_2() .py_2()
.px(rems_from_px(22.)) .px_5()
.child(SpinnerLabel::new().size(LabelSize::Small)), .child(SpinnerLabel::new().size(LabelSize::Small)),
); );
} }
let open_as_markdown = IconButton::new("open-as-markdown", IconName::FileMarkdown) let open_as_markdown = IconButton::new("open-as-markdown", IconName::FileMarkdown)
.shape(ui::IconButtonShape::Square) .shape(ui::IconButtonShape::Square)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
@ -4203,12 +4204,10 @@ impl AcpThreadView {
.id("thread-controls-container") .id("thread-controls-container")
.group("thread-controls-container") .group("thread-controls-container")
.w_full() .w_full()
.mr_1() .py_2()
.pt_1() .px_5()
.pb_2()
.px(RESPONSE_PADDING_X)
.gap_px() .gap_px()
.opacity(0.4) .opacity(0.6)
.hover(|style| style.opacity(1.)) .hover(|style| style.opacity(1.))
.flex_wrap() .flex_wrap()
.justify_end(); .justify_end();
@ -4219,56 +4218,50 @@ impl AcpThreadView {
.is_some_and(|thread| thread.read(cx).connection().telemetry().is_some()) .is_some_and(|thread| thread.read(cx).connection().telemetry().is_some())
{ {
let feedback = self.thread_feedback.feedback; let feedback = self.thread_feedback.feedback;
container = container.child(
div().visible_on_hover("thread-controls-container").child( container = container
Label::new( .child(
match feedback { div().visible_on_hover("thread-controls-container").child(
Label::new(match feedback {
Some(ThreadFeedback::Positive) => "Thanks for your feedback!", Some(ThreadFeedback::Positive) => "Thanks for your feedback!",
Some(ThreadFeedback::Negative) => "We appreciate your feedback and will use it to improve.", Some(ThreadFeedback::Negative) => {
None => "Rating the thread sends all of your current conversation to the Zed team.", "We appreciate your feedback and will use it to improve."
} }
) None => {
.color(Color::Muted) "Rating the thread sends all of your current conversation to the Zed team."
.size(LabelSize::XSmall) }
.truncate(), })
), .color(Color::Muted)
).child( .size(LabelSize::XSmall)
h_flex() .truncate(),
.child( ),
IconButton::new("feedback-thumbs-up", IconName::ThumbsUp) )
.shape(ui::IconButtonShape::Square) .child(
.icon_size(IconSize::Small) IconButton::new("feedback-thumbs-up", IconName::ThumbsUp)
.icon_color(match feedback { .shape(ui::IconButtonShape::Square)
Some(ThreadFeedback::Positive) => Color::Accent, .icon_size(IconSize::Small)
_ => Color::Ignored, .icon_color(match feedback {
}) Some(ThreadFeedback::Positive) => Color::Accent,
.tooltip(Tooltip::text("Helpful Response")) _ => Color::Ignored,
.on_click(cx.listener(move |this, _, window, cx| { })
this.handle_feedback_click( .tooltip(Tooltip::text("Helpful Response"))
ThreadFeedback::Positive, .on_click(cx.listener(move |this, _, window, cx| {
window, this.handle_feedback_click(ThreadFeedback::Positive, window, cx);
cx, })),
); )
})), .child(
) IconButton::new("feedback-thumbs-down", IconName::ThumbsDown)
.child( .shape(ui::IconButtonShape::Square)
IconButton::new("feedback-thumbs-down", IconName::ThumbsDown) .icon_size(IconSize::Small)
.shape(ui::IconButtonShape::Square) .icon_color(match feedback {
.icon_size(IconSize::Small) Some(ThreadFeedback::Negative) => Color::Accent,
.icon_color(match feedback { _ => Color::Ignored,
Some(ThreadFeedback::Negative) => Color::Accent, })
_ => Color::Ignored, .tooltip(Tooltip::text("Not Helpful"))
}) .on_click(cx.listener(move |this, _, window, cx| {
.tooltip(Tooltip::text("Not Helpful")) this.handle_feedback_click(ThreadFeedback::Negative, window, cx);
.on_click(cx.listener(move |this, _, window, cx| { })),
this.handle_feedback_click( );
ThreadFeedback::Negative,
window,
cx,
);
})),
)
)
} }
container.child(open_as_markdown).child(scroll_to_top) container.child(open_as_markdown).child(scroll_to_top)