assistant2: Use different icons in the notification popover depending on status (#27493)
Using a check green icon for "success, you're changes are applied" and the info, muted icon for just "there are news". <img src="https://github.com/user-attachments/assets/6b7e06bc-ca03-40fd-8962-7e21f5cd85d9" width="500"/> <img src="https://github.com/user-attachments/assets/347ac8ac-792f-4e18-94d5-69bb9d5270e8" width="500"/> Release Notes: - N/A
This commit is contained in:
parent
39af3b434a
commit
1d9c581ae0
2 changed files with 25 additions and 7 deletions
|
@ -376,11 +376,23 @@ impl ActiveThread {
|
||||||
}
|
}
|
||||||
ThreadEvent::DoneStreaming => {
|
ThreadEvent::DoneStreaming => {
|
||||||
if !self.thread().read(cx).is_generating() {
|
if !self.thread().read(cx).is_generating() {
|
||||||
self.show_notification("Your changes have been applied.", window, cx);
|
self.show_notification(
|
||||||
|
"Your changes have been applied.",
|
||||||
|
IconName::Check,
|
||||||
|
Color::Success,
|
||||||
|
window,
|
||||||
|
cx,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThreadEvent::ToolConfirmationNeeded => {
|
ThreadEvent::ToolConfirmationNeeded => {
|
||||||
self.show_notification("There's a tool confirmation needed.", window, cx);
|
self.show_notification(
|
||||||
|
"There's a tool confirmation needed.",
|
||||||
|
IconName::Info,
|
||||||
|
Color::Muted,
|
||||||
|
window,
|
||||||
|
cx,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
ThreadEvent::StreamedAssistantText(message_id, text) => {
|
ThreadEvent::StreamedAssistantText(message_id, text) => {
|
||||||
if let Some(rendered_message) = self.rendered_messages_by_id.get_mut(&message_id) {
|
if let Some(rendered_message) = self.rendered_messages_by_id.get_mut(&message_id) {
|
||||||
|
@ -511,6 +523,8 @@ impl ActiveThread {
|
||||||
fn show_notification(
|
fn show_notification(
|
||||||
&mut self,
|
&mut self,
|
||||||
caption: impl Into<SharedString>,
|
caption: impl Into<SharedString>,
|
||||||
|
icon: IconName,
|
||||||
|
icon_color: Color,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<'_, ActiveThread>,
|
cx: &mut Context<'_, ActiveThread>,
|
||||||
) {
|
) {
|
||||||
|
@ -525,7 +539,7 @@ impl ActiveThread {
|
||||||
|
|
||||||
if let Some(screen_window) = cx
|
if let Some(screen_window) = cx
|
||||||
.open_window(options, |_, cx| {
|
.open_window(options, |_, cx| {
|
||||||
cx.new(|_| ToolReadyPopUp::new(caption.clone()))
|
cx.new(|_| ToolReadyPopUp::new(caption.clone(), icon, icon_color))
|
||||||
})
|
})
|
||||||
.log_err()
|
.log_err()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,12 +9,16 @@ use ui::{prelude::*, Render};
|
||||||
|
|
||||||
pub struct ToolReadyPopUp {
|
pub struct ToolReadyPopUp {
|
||||||
caption: SharedString,
|
caption: SharedString,
|
||||||
|
icon: IconName,
|
||||||
|
icon_color: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToolReadyPopUp {
|
impl ToolReadyPopUp {
|
||||||
pub fn new(caption: impl Into<SharedString>) -> Self {
|
pub fn new(caption: impl Into<SharedString>, icon: IconName, icon_color: Color) -> Self {
|
||||||
Self {
|
Self {
|
||||||
caption: caption.into(),
|
caption: caption.into(),
|
||||||
|
icon,
|
||||||
|
icon_color,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,9 +86,9 @@ impl Render for ToolReadyPopUp {
|
||||||
.gap_2()
|
.gap_2()
|
||||||
.child(
|
.child(
|
||||||
h_flex().h(line_height).justify_center().child(
|
h_flex().h(line_height).justify_center().child(
|
||||||
Icon::new(IconName::Info)
|
Icon::new(self.icon)
|
||||||
.size(IconSize::Small)
|
.color(self.icon_color)
|
||||||
.color(Color::Muted),
|
.size(IconSize::Small),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue