From fc3a871264fc32031f271793aef336416f36d58e Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Fri, 24 Jan 2025 12:34:11 -0300 Subject: [PATCH] assistant2: Adjust spacing and icons on the context picker (#23607) Just fine-tuning spacing, icon size and color, and ensure they're are consistent throughout. Release Notes: - N/A --- assets/icons/file.svg | 10 +++------- assets/icons/folder.svg | 2 +- assets/icons/globe.svg | 13 ++++++++++++- assets/icons/message_bubbles.svg | 8 +++++--- crates/assistant2/src/context_picker.rs | 2 ++ .../context_picker/directory_context_picker.rs | 7 ++++++- .../src/context_picker/file_context_picker.rs | 15 +++++++++------ .../src/context_picker/thread_context_picker.rs | 8 ++++++-- crates/ui/src/components/context_menu.rs | 2 +- 9 files changed, 45 insertions(+), 22 deletions(-) diff --git a/assets/icons/file.svg b/assets/icons/file.svg index 5f256b42e1..5b1b892756 100644 --- a/assets/icons/file.svg +++ b/assets/icons/file.svg @@ -1,8 +1,4 @@ - - + + + diff --git a/assets/icons/folder.svg b/assets/icons/folder.svg index a76dc63d1a..1a40805a70 100644 --- a/assets/icons/folder.svg +++ b/assets/icons/folder.svg @@ -1,3 +1,3 @@ - + diff --git a/assets/icons/globe.svg b/assets/icons/globe.svg index 2082a43984..545b83aa71 100644 --- a/assets/icons/globe.svg +++ b/assets/icons/globe.svg @@ -1 +1,12 @@ - + + + + + + + + + + + + diff --git a/assets/icons/message_bubbles.svg b/assets/icons/message_bubbles.svg index f4ff1851a3..03a6c7760c 100644 --- a/assets/icons/message_bubbles.svg +++ b/assets/icons/message_bubbles.svg @@ -1,4 +1,6 @@ - - - + + + + + diff --git a/crates/assistant2/src/context_picker.rs b/crates/assistant2/src/context_picker.rs index b1b230bd05..4577db0bb8 100644 --- a/crates/assistant2/src/context_picker.rs +++ b/crates/assistant2/src/context_picker.rs @@ -115,6 +115,8 @@ impl ContextPicker { ContextMenuEntry::new(kind.label()) .icon(kind.icon()) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) .handler(move |cx| { context_picker.update(cx, |this, cx| this.select_kind(kind, cx)) }) diff --git a/crates/assistant2/src/context_picker/directory_context_picker.rs b/crates/assistant2/src/context_picker/directory_context_picker.rs index bdd191037c..f434e114d2 100644 --- a/crates/assistant2/src/context_picker/directory_context_picker.rs +++ b/crates/assistant2/src/context_picker/directory_context_picker.rs @@ -234,7 +234,12 @@ impl PickerDelegate for DirectoryContextPickerDelegate { ListItem::new(ix) .inset(true) .toggle_state(selected) - .child(h_flex().gap_2().child(Label::new(directory_name))) + .start_slot( + Icon::new(IconName::Folder) + .size(IconSize::XSmall) + .color(Color::Muted), + ) + .child(Label::new(directory_name)) .when(added, |el| { el.end_slot( h_flex() diff --git a/crates/assistant2/src/context_picker/file_context_picker.rs b/crates/assistant2/src/context_picker/file_context_picker.rs index 158c53370a..30624f5ee1 100644 --- a/crates/assistant2/src/context_picker/file_context_picker.rs +++ b/crates/assistant2/src/context_picker/file_context_picker.rs @@ -396,12 +396,12 @@ pub fn render_file_context_entry( h_flex() .id(id) - .gap_1() + .gap_1p5() .w_full() - .child(file_icon.size(IconSize::Small)) + .child(file_icon.size(IconSize::Small).color(Color::Muted)) .child( h_flex() - .gap_2() + .gap_1() .child(Label::new(file_name)) .children(directory.map(|directory| { Label::new(directory) @@ -409,11 +409,12 @@ pub fn render_file_context_entry( .color(Color::Muted) })), ) - .child(div().w_full()) .when_some(added, |el, added| match added { FileInclusion::Direct(_) => el.child( h_flex() - .gap_1() + .w_full() + .justify_end() + .gap_0p5() .child( Icon::new(IconName::Check) .size(IconSize::Small) @@ -426,7 +427,9 @@ pub fn render_file_context_entry( el.child( h_flex() - .gap_1() + .w_full() + .justify_end() + .gap_0p5() .child( Icon::new(IconName::Check) .size(IconSize::Small) diff --git a/crates/assistant2/src/context_picker/thread_context_picker.rs b/crates/assistant2/src/context_picker/thread_context_picker.rs index 16c05d5405..e6a89f8692 100644 --- a/crates/assistant2/src/context_picker/thread_context_picker.rs +++ b/crates/assistant2/src/context_picker/thread_context_picker.rs @@ -209,9 +209,13 @@ pub fn render_thread_context_entry( }); h_flex() - .gap_1() + .gap_1p5() .w_full() - .child(Icon::new(IconName::MessageCircle).size(IconSize::Small)) + .child( + Icon::new(IconName::MessageCircle) + .size(IconSize::XSmall) + .color(Color::Muted), + ) .child(Label::new(thread.summary.clone())) .child(div().w_full()) .when(added, |el| { diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 9516cc665a..87705f179b 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -540,7 +540,7 @@ impl Render for ContextMenu { }; let label_element = if let Some(icon_name) = icon { h_flex() - .gap_2() + .gap_1p5() .when(*icon_position == IconPosition::Start, |flex| { flex.child( Icon::new(*icon_name)