From 73ab5abee118d227df7a9adce90a4dd745344de8 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:33:37 -0300 Subject: [PATCH] assistant2: Adjust tool call accordion visuals (#25749) Just fine-tuning it a bit more. Release Notes: - N/A --- crates/assistant2/src/active_thread.rs | 43 ++++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index 63b6fe64d8afd0a1af627c7d33384900ad0cd14d..fd6c7705c8385d7529f6fef85fc88d7cd3ec71bb 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -396,26 +396,25 @@ impl ActiveThread { .copied() .unwrap_or_default(); - v_flex().px_2p5().child( + div().px_2p5().child( v_flex() .gap_1() - .bg(cx.theme().colors().editor_background) .rounded_lg() .border_1() .border_color(cx.theme().colors().border) - .shadow_sm() .child( h_flex() .justify_between() - .py_1() - .px_2() - .bg(cx.theme().colors().editor_foreground.opacity(0.05)) - .when(is_open, |element| element.border_b_1()) + .py_0p5() + .pl_1() + .pr_2() + .bg(cx.theme().colors().editor_foreground.opacity(0.02)) + .when(is_open, |element| element.border_b_1().rounded_t(px(6.))) + .when(!is_open, |element| element.rounded(px(6.))) .border_color(cx.theme().colors().border) - .rounded_t(px(6.)) .child( h_flex() - .gap_2() + .gap_1() .child(Disclosure::new("tool-use-disclosure", is_open).on_click( cx.listener({ let tool_use_id = tool_use.id.clone(); @@ -431,12 +430,16 @@ impl ActiveThread { )) .child(Label::new(tool_use.name)), ) - .child(Label::new(match tool_use.status { - ToolUseStatus::Pending => "Pending", - ToolUseStatus::Running => "Running", - ToolUseStatus::Finished(_) => "Finished", - ToolUseStatus::Error(_) => "Error", - })), + .child( + Label::new(match tool_use.status { + ToolUseStatus::Pending => "Pending", + ToolUseStatus::Running => "Running", + ToolUseStatus::Finished(_) => "Finished", + ToolUseStatus::Error(_) => "Error", + }) + .size(LabelSize::XSmall) + .buffer_font(cx), + ), ) .map(|parent| { if !is_open { @@ -445,11 +448,13 @@ impl ActiveThread { parent.child( v_flex() - .gap_2() - .p_2p5() .child( v_flex() .gap_0p5() + .py_1() + .px_2p5() + .border_b_1() + .border_color(cx.theme().colors().border) .child(Label::new("Input:")) .child(Label::new( serde_json::to_string_pretty(&tool_use.input) @@ -460,12 +465,16 @@ impl ActiveThread { ToolUseStatus::Finished(output) => parent.child( v_flex() .gap_0p5() + .py_1() + .px_2p5() .child(Label::new("Result:")) .child(Label::new(output)), ), ToolUseStatus::Error(err) => parent.child( v_flex() .gap_0p5() + .py_1() + .px_2p5() .child(Label::new("Error:")) .child(Label::new(err)), ),