Skip to content

Commit 8b3eb98

Browse files
authoredMar 28, 2025··
assistant2: Adjust elements in the message editor (#27696)
Most notable change in this PR is the changing the default profiles' names to just "Write" and "Ask". Everything else is mostly design-related. Here's how it looks like: <img src="https://github.com/user-attachments/assets/791948c9-2d63-4523-9d54-08b63a00be6a" width="600" /> Release Notes: - N/A
1 parent d912b0d commit 8b3eb98

File tree

5 files changed

+59
-33
lines changed

5 files changed

+59
-33
lines changed
 

‎assets/icons/user_round_pen.svg

+1
Loading

‎assets/settings/default.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,10 @@
633633
// The model to use.
634634
"model": "claude-3-5-sonnet-latest"
635635
},
636-
"default_profile": "code-writer",
636+
"default_profile": "write",
637637
"profiles": {
638-
"read-only": {
639-
"name": "Read-only",
638+
"ask": {
639+
"name": "Ask",
640640
"tools": {
641641
"diagnostics": true,
642642
"fetch": true,
@@ -648,8 +648,8 @@
648648
"thinking": true
649649
}
650650
},
651-
"code-writer": {
652-
"name": "Code Writer",
651+
"write": {
652+
"name": "Write",
653653
"tools": {
654654
"bash": true,
655655
"batch-tool": true,

‎crates/assistant2/src/profile_selector.rs

+47-27
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use fs::Fs;
55
use gpui::{prelude::*, Action, Entity, FocusHandle, Subscription, WeakEntity};
66
use indexmap::IndexMap;
77
use settings::{update_settings_file, Settings as _, SettingsStore};
8-
use ui::{prelude::*, ContextMenu, ContextMenuEntry, PopoverMenu, PopoverMenuHandle, Tooltip};
8+
use ui::{
9+
prelude::*, ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu,
10+
PopoverMenuHandle,
11+
};
912
use util::ResultExt as _;
1013

1114
use crate::{ManageProfiles, ThreadStore, ToggleProfileSelector};
@@ -60,7 +63,7 @@ impl ProfileSelector {
6063
) -> Entity<ContextMenu> {
6164
ContextMenu::build(window, cx, |mut menu, _window, cx| {
6265
let settings = AssistantSettings::get_global(cx);
63-
let icon_position = IconPosition::Start;
66+
let icon_position = IconPosition::End;
6467

6568
menu = menu.header("Profiles");
6669
for (profile_id, profile) in self.profiles.clone() {
@@ -91,48 +94,65 @@ impl ProfileSelector {
9194
}
9295

9396
menu = menu.separator();
94-
menu = menu.item(
95-
ContextMenuEntry::new("Configure Profiles")
96-
.icon(IconName::Pencil)
97-
.icon_color(Color::Muted)
98-
.handler(move |window, cx| {
99-
window.dispatch_action(ManageProfiles.boxed_clone(), cx);
100-
}),
101-
);
97+
menu = menu.item(ContextMenuEntry::new("Configure Profiles").handler(
98+
move |window, cx| {
99+
window.dispatch_action(ManageProfiles.boxed_clone(), cx);
100+
},
101+
));
102102

103103
menu
104104
})
105105
}
106106
}
107107

108108
impl Render for ProfileSelector {
109-
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
109+
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
110110
let settings = AssistantSettings::get_global(cx);
111-
let profile = settings
112-
.profiles
113-
.get(&settings.default_profile)
111+
let profile_id = &settings.default_profile;
112+
let profile = settings.profiles.get(profile_id);
113+
114+
let selected_profile = profile
114115
.map(|profile| profile.name.clone())
115116
.unwrap_or_else(|| "Unknown".into());
116117

118+
let icon = match profile_id.as_ref() {
119+
"write" => IconName::Pencil,
120+
"ask" => IconName::MessageBubbles,
121+
_ => IconName::UserRoundPen,
122+
};
123+
117124
let this = cx.entity().clone();
118125
let focus_handle = self.focus_handle.clone();
119126
PopoverMenu::new("profile-selector")
120127
.menu(move |window, cx| {
121128
Some(this.update(cx, |this, cx| this.build_context_menu(window, cx)))
122129
})
123-
.trigger_with_tooltip(
124-
Button::new("profile-selector-button", profile)
125-
.style(ButtonStyle::Filled)
126-
.label_size(LabelSize::Small),
127-
move |window, cx| {
128-
Tooltip::for_action_in(
129-
"Change Profile",
130-
&ToggleProfileSelector,
131-
&focus_handle,
132-
window,
133-
cx,
134-
)
135-
},
130+
.trigger(
131+
ButtonLike::new("profile-selector-button").child(
132+
h_flex()
133+
.gap_1()
134+
.child(Icon::new(icon).size(IconSize::XSmall).color(Color::Muted))
135+
.child(
136+
Label::new(selected_profile)
137+
.size(LabelSize::Small)
138+
.color(Color::Muted),
139+
)
140+
.child(
141+
Icon::new(IconName::ChevronDown)
142+
.size(IconSize::XSmall)
143+
.color(Color::Muted),
144+
)
145+
.child(div().opacity(0.5).children({
146+
let focus_handle = focus_handle.clone();
147+
KeyBinding::for_action_in(
148+
&ToggleProfileSelector,
149+
&focus_handle,
150+
window,
151+
cx,
152+
)
153+
.map(|kb| kb.size(rems_from_px(10.)))
154+
})),
155+
),
136156
)
137157
.anchor(gpui::Corner::BottomLeft)
138158
.with_handle(self.menu_handle.clone())

‎crates/assistant2/src/ui/context_pill.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,14 @@ impl RenderOnce for ContextPill {
175175
} => base_pill
176176
.cursor_pointer()
177177
.pr_1()
178+
.when(*focused, |this| {
179+
this.bg(color.element_background.opacity(0.5))
180+
})
181+
.border_dashed()
178182
.border_color(if *focused {
179183
color.border_focused
180184
} else {
181-
color.border_variant.opacity(0.5)
185+
color.border
182186
})
183187
.hover(|style| style.bg(color.element_hover.opacity(0.5)))
184188
.child(

‎crates/icons/src/icons.rs

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ pub enum IconName {
225225
Unpin,
226226
Update,
227227
UserGroup,
228+
UserRoundPen,
228229
Visible,
229230
Wand,
230231
Warning,

0 commit comments

Comments
 (0)
Please sign in to comment.