Add a way to clear activity indicator (#30156)
Follow-up of https://github.com/zed-industries/zed/pull/30015 * Restyles the dismiss and close buttons a bit: change the dismiss icon and add tooltips with the bindings to both * Allows ESC to clear any status that's in the activity indicator now, if all notifications are cleared: this won't suppress any further status additions though, so statuses may resurface later Release Notes: - Added a way to clear activity indicator
This commit is contained in:
parent
77ac82587a
commit
6e19c9b141
5 changed files with 88 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{Toast, Workspace};
|
||||
use crate::{SuppressNotification, Toast, Workspace};
|
||||
use gpui::{
|
||||
AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent,
|
||||
Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task, svg,
|
||||
|
@ -290,8 +290,15 @@ impl Render for LanguageServerPrompt {
|
|||
h_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
IconButton::new("suppress", IconName::XCircle)
|
||||
.tooltip(Tooltip::text("Do not show until restart"))
|
||||
IconButton::new("suppress", IconName::SquareMinus)
|
||||
.tooltip(|window, cx| {
|
||||
Tooltip::for_action(
|
||||
"Do not show until restart",
|
||||
&SuppressNotification,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.on_click(
|
||||
cx.listener(|_, _, _, cx| cx.emit(SuppressEvent)),
|
||||
),
|
||||
|
@ -308,9 +315,20 @@ impl Render for LanguageServerPrompt {
|
|||
})
|
||||
.tooltip(Tooltip::text("Copy Description")),
|
||||
)
|
||||
.child(IconButton::new("close", IconName::Close).on_click(
|
||||
cx.listener(|_, _, _, cx| cx.emit(gpui::DismissEvent)),
|
||||
)),
|
||||
.child(
|
||||
IconButton::new("close", IconName::Close)
|
||||
.tooltip(|window, cx| {
|
||||
Tooltip::for_action(
|
||||
"Close",
|
||||
&menu::Cancel,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.on_click(cx.listener(|_, _, _, cx| {
|
||||
cx.emit(gpui::DismissEvent)
|
||||
})),
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(Label::new(request.message.to_string()).size(LabelSize::Small))
|
||||
|
@ -443,6 +461,8 @@ pub mod simple_message_notification {
|
|||
};
|
||||
use ui::{Tooltip, prelude::*};
|
||||
|
||||
use crate::SuppressNotification;
|
||||
|
||||
use super::{Notification, SuppressEvent};
|
||||
|
||||
pub struct MessageNotification {
|
||||
|
@ -640,8 +660,15 @@ pub mod simple_message_notification {
|
|||
.gap_2()
|
||||
.when(self.show_suppress_button, |this| {
|
||||
this.child(
|
||||
IconButton::new("suppress", IconName::XCircle)
|
||||
.tooltip(Tooltip::text("Do not show until restart"))
|
||||
IconButton::new("suppress", IconName::SquareMinus)
|
||||
.tooltip(|window, cx| {
|
||||
Tooltip::for_action(
|
||||
"Do not show until restart",
|
||||
&SuppressNotification,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.on_click(cx.listener(|_, _, _, cx| {
|
||||
cx.emit(SuppressEvent);
|
||||
})),
|
||||
|
@ -649,9 +676,18 @@ pub mod simple_message_notification {
|
|||
})
|
||||
.when(self.show_close_button, |this| {
|
||||
this.child(
|
||||
IconButton::new("close", IconName::Close).on_click(
|
||||
cx.listener(|this, _, _, cx| this.dismiss(cx)),
|
||||
),
|
||||
IconButton::new("close", IconName::Close)
|
||||
.tooltip(|window, cx| {
|
||||
Tooltip::for_action(
|
||||
"Close",
|
||||
&menu::Cancel,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
.on_click(
|
||||
cx.listener(|this, _, _, cx| this.dismiss(cx)),
|
||||
),
|
||||
)
|
||||
}),
|
||||
),
|
||||
|
|
|
@ -869,6 +869,7 @@ pub enum Event {
|
|||
},
|
||||
ZoomChanged,
|
||||
ModalOpened,
|
||||
ClearActivityIndicator,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -5496,6 +5497,7 @@ impl Workspace {
|
|||
return;
|
||||
}
|
||||
|
||||
cx.emit(Event::ClearActivityIndicator);
|
||||
cx.propagate();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue