assistant: Add tiny design tweaks to the patch block (#20636)

Adjusting really tiny things, most notably ensuring that the header text
doesn't overflow out of the block.

<img width="600" alt="Screenshot 2024-11-13 at 20 11 08"
src="https://github.com/user-attachments/assets/26656203-92c6-49e5-a732-bae010f96b2d">


Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2024-11-14 10:53:00 -03:00 committed by GitHub
parent 776cfe44d7
commit 204a989758
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3470,15 +3470,16 @@ impl ContextEditor {
.id(id) .id(id)
.bg(theme.colors().editor_background) .bg(theme.colors().editor_background)
.ml(gutter_width) .ml(gutter_width)
.pb_1()
.w(max_width - gutter_width) .w(max_width - gutter_width)
.rounded_md() .rounded_md()
.border_1() .border_1()
.border_color(theme.colors().border) .border_color(theme.colors().border_variant)
.overflow_hidden()
.hover(|style| style.border_color(theme.colors().text_accent)) .hover(|style| style.border_color(theme.colors().text_accent))
.when(selected, |this| { .when(selected, |this| {
this.border_color(theme.colors().text_accent) this.border_color(theme.colors().text_accent)
}) })
.pb_1()
.cursor(CursorStyle::PointingHand) .cursor(CursorStyle::PointingHand)
.on_click(cx.listener(move |this, _, cx| { .on_click(cx.listener(move |this, _, cx| {
this.editor.update(cx, |editor, cx| { this.editor.update(cx, |editor, cx| {
@ -3489,20 +3490,25 @@ impl ContextEditor {
this.focus_active_patch(cx); this.focus_active_patch(cx);
})) }))
.child( .child(
h_flex() div()
.rounded_t_md()
.bg(theme.colors().element_background)
.px_2() .px_2()
.py_1() .py_1()
.child(Label::new(patch.title.clone()).size(LabelSize::Small)) .overflow_hidden()
.text_ellipsis()
.border_b_1() .border_b_1()
.border_color(theme.colors().border), .border_color(theme.colors().border_variant)
.bg(theme.colors().element_background)
.child(
Label::new(patch.title.clone())
.size(LabelSize::Small)
.color(Color::Muted),
),
) )
.children(paths.into_iter().map(|path| { .children(paths.into_iter().map(|path| {
h_flex() h_flex()
.px_2() .px_2()
.pt_1() .pt_1()
.gap_1() .gap_1p5()
.child(Icon::new(IconName::File).size(IconSize::Small)) .child(Icon::new(IconName::File).size(IconSize::Small))
.child(Label::new(path).size(LabelSize::Small)) .child(Label::new(path).size(LabelSize::Small))
})) }))
@ -3515,7 +3521,7 @@ impl ContextEditor {
.child( .child(
Icon::new(IconName::ArrowCircle) Icon::new(IconName::ArrowCircle)
.size(IconSize::XSmall) .size(IconSize::XSmall)
.color(Color::Info) .color(Color::Muted)
.with_animation( .with_animation(
"arrow-circle", "arrow-circle",
Animation::new(Duration::from_secs(2)).repeat(), Animation::new(Duration::from_secs(2)).repeat(),
@ -3527,14 +3533,14 @@ impl ContextEditor {
), ),
) )
.child( .child(
Label::new("Generating") Label::new("Generating")
.color(Color::Muted) .color(Color::Muted)
.size(LabelSize::Small) .size(LabelSize::Small)
.with_animation( .with_animation(
"pulsating-label", "pulsating-label",
Animation::new(Duration::from_secs(2)) Animation::new(Duration::from_secs(2))
.repeat() .repeat()
.with_easing(pulsating_between(0.4, 1.)), .with_easing(pulsating_between(0.4, 0.8)),
|label, delta| label.alpha(delta), |label, delta| label.alpha(delta),
), ),
), ),