From 44a46e371373b7c79b45c31358d5da307c95d3e3 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Tue, 24 Dec 2024 01:26:04 -0300 Subject: [PATCH] assistant2: Don't render the context space if there's none (#22383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note the extra bottom space on the before version. That was because, previously, the container that holds the context pills in an active thread was being rendered even if there was no attached context. | Before | After | |--------|--------| | Screenshot 2024-12-23 at 8 42 00 PM | Screenshot 2024-12-23 at 8 39 00 PM | Release Notes: - N/A --- crates/assistant2/src/active_thread.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index ace4685f0c..09add94b49 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -274,13 +274,18 @@ impl ActiveThread { ) .child(v_flex().p_2p5().text_ui(cx).child(markdown.clone())) .when_some(context, |parent, context| { - parent.child( - h_flex().flex_wrap().gap_1().p_1p5().children( - context - .iter() - .map(|context| ContextPill::new(context.clone())), - ), - ) + if !context.is_empty() { + parent.child( + h_flex() + .flex_wrap() + .gap_1() + .px_1p5() + .pb_1p5() + .children(context.iter().map(|c| ContextPill::new(c.clone()))), + ) + } else { + parent + } }), ) .into_any()