Add user-visible output for remote operations (#25849)

This PR adds toasts for reporting success and errors from remote git
operations. This PR also adds a focus handle to notifications, in
anticipation of making them keyboard accessible.

Release Notes:

- N/A

---------

Co-authored-by: julia <julia@zed.dev>
This commit is contained in:
Mikayla Maki 2025-03-03 01:20:15 -08:00 committed by GitHub
parent 508b9d3b5d
commit 73ac19958a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 713 additions and 192 deletions

View file

@ -47,7 +47,9 @@ use itertools::Itertools;
use language::{LanguageRegistry, Rope};
pub use modal_layer::*;
use node_runtime::NodeRuntime;
use notifications::{simple_message_notification::MessageNotification, DetachAndPromptErr};
use notifications::{
simple_message_notification::MessageNotification, DetachAndPromptErr, Notifications,
};
pub use pane::*;
pub use pane_group::*;
pub use persistence::{
@ -815,7 +817,7 @@ pub struct Workspace {
status_bar: Entity<StatusBar>,
modal_layer: Entity<ModalLayer>,
titlebar_item: Option<AnyView>,
notifications: Vec<(NotificationId, AnyView)>,
notifications: Notifications,
project: Entity<Project>,
follower_states: HashMap<PeerId, FollowerState>,
last_leaders_by_pane: HashMap<WeakEntity<Pane>, PeerId>,
@ -920,7 +922,7 @@ impl Workspace {
} => this.show_notification(
NotificationId::named(notification_id.clone()),
cx,
|cx| cx.new(|_| MessageNotification::new(message.clone())),
|cx| cx.new(|cx| MessageNotification::new(message.clone(), cx)),
),
project::Event::HideToast { notification_id } => {
@ -937,7 +939,11 @@ impl Workspace {
this.show_notification(
NotificationId::composite::<LanguageServerPrompt>(id as usize),
cx,
|cx| cx.new(|_| notifications::LanguageServerPrompt::new(request.clone())),
|cx| {
cx.new(|cx| {
notifications::LanguageServerPrompt::new(request.clone(), cx)
})
},
);
}
@ -5223,8 +5229,8 @@ fn notify_if_database_failed(workspace: WindowHandle<Workspace>, cx: &mut AsyncA
NotificationId::unique::<DatabaseFailedNotification>(),
cx,
|cx| {
cx.new(|_| {
MessageNotification::new("Failed to load the database file.")
cx.new(|cx| {
MessageNotification::new("Failed to load the database file.", cx)
.primary_message("File an Issue")
.primary_icon(IconName::Plus)
.primary_on_click(|_window, cx| cx.open_url(REPORT_ISSUE_URL))