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

@ -1114,11 +1114,14 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contex
NotificationId::unique::<OpenLogError>(),
cx,
|cx| {
cx.new(|_| {
MessageNotification::new(format!(
"Unable to access/open log file at path {:?}",
paths::log_file().as_path()
))
cx.new(|cx| {
MessageNotification::new(
format!(
"Unable to access/open log file at path {:?}",
paths::log_file().as_path()
),
cx,
)
})
},
);
@ -1323,8 +1326,8 @@ fn show_keymap_file_json_error(
let message: SharedString =
format!("JSON parse error in keymap file. Bindings not reloaded.\n\n{error}").into();
show_app_notification(notification_id, cx, move |cx| {
cx.new(|_cx| {
MessageNotification::new(message.clone())
cx.new(|cx| {
MessageNotification::new(message.clone(), cx)
.primary_message("Open Keymap File")
.primary_on_click(|window, cx| {
window.dispatch_action(zed_actions::OpenKeymap.boxed_clone(), cx);
@ -1381,8 +1384,8 @@ fn show_markdown_app_notification<F>(
let parsed_markdown = parsed_markdown.clone();
let primary_button_message = primary_button_message.clone();
let primary_button_on_click = primary_button_on_click.clone();
cx.new(move |_cx| {
MessageNotification::new_from_builder(move |window, cx| {
cx.new(move |cx| {
MessageNotification::new_from_builder(cx, move |window, cx| {
gpui::div()
.text_xs()
.child(markdown_preview::markdown_renderer::render_parsed_markdown(
@ -1441,8 +1444,8 @@ pub fn handle_settings_changed(error: Option<anyhow::Error>, cx: &mut App) {
return;
}
show_app_notification(id, cx, move |cx| {
cx.new(|_cx| {
MessageNotification::new(format!("Invalid user settings file\n{error}"))
cx.new(|cx| {
MessageNotification::new(format!("Invalid user settings file\n{error}"), cx)
.primary_message("Open Settings File")
.primary_icon(IconName::Settings)
.primary_on_click(|window, cx| {
@ -1580,7 +1583,7 @@ fn open_local_file(
struct NoOpenFolders;
workspace.show_notification(NotificationId::unique::<NoOpenFolders>(), cx, |cx| {
cx.new(|_| MessageNotification::new("This project has no folders open."))
cx.new(|cx| MessageNotification::new("This project has no folders open.", cx))
})
}
}