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 5f256b42e1fde343b8194d199f52921e8ad01b7c..5b1b8927564f67c2bc56893881599fee16b15092 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 a76dc63d1a663993f02e4b6a88b200e4aea22f0c..1a40805a702c02e063a8bfa85bed3103b0dd3518 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 2082a43984a0cc0684526726ea3007443610976b..545b83aa718123dacae4d286811512972412d719 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 f4ff1851a30861fb1c0852ea8c3f6e7c00689bd6..03a6c7760cdce8a19ec1fc243fbc47d51d8a0988 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 b1b230bd05fd0a228fa7a2c6b2d1972bf8763630..4577db0bb8f678c3e0b1abac872f70bc24df5462 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 bdd191037c6ef3f8f543b02b34695b370019fac7..f434e114d268a795875b71d9af7a3d8494619bc4 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 158c53370aae3ed710a504c067c471b9d172f403..30624f5ee10bac0240443f256c8467175d1e1866 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 16c05d5405577f6fe9e4b4664f1b1c4292fc7a53..e6a89f8692ef02e5e4148f94b32569b0ddb6909d 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 9516cc665a537a0c6766daa79a462cc3935c87cc..87705f179b6dbba1c7024ca997f3e206e9d01227 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)