Remove feedback modal (#39954)

Joseph T. Lyons created

The feedback modal did not match our keyboard-driven design. We can
revisit this later if we want, but for now, removing it makes sense. All
actions have been inlined in the `Help` menu to maintain
discoverability.

Additionally, not all feedback-based actions in the command palette were
namespaced under `feedback:`, and now they are, so they can all be found
there easily.

Release Notes:

- Notice: The `Give Feedback` modal has been removed. The options to
file bug reports, feature requests, email us, and open the Zed
repository can now be found within the `Help` menu directly. The command
palette actions have undergone the following changes:

- `feedback: give feedback` (removed)
- `feedback: file bug report` (no change)
- `zed: request feature` → `feedback: request feature`
- `zed: email zed` → `feedback: email zed`
- `zed: open zed repo` → `contribute: open zed repo`

Change summary

Cargo.lock                            |   2 
crates/feedback/Cargo.toml            |   4 
crates/feedback/src/feedback.rs       |  14 ---
crates/feedback/src/feedback_modal.rs | 113 -----------------------------
crates/zed/src/zed/app_menus.rs       |   6 +
crates/zed_actions/src/lib.rs         |   6 +
6 files changed, 12 insertions(+), 133 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -5889,9 +5889,7 @@ version = "0.1.0"
 dependencies = [
  "editor",
  "gpui",
- "menu",
  "system_specs",
- "ui",
  "urlencoding",
  "workspace",
  "workspace-hack",

crates/feedback/Cargo.toml 🔗

@@ -16,14 +16,12 @@ test-support = []
 
 [dependencies]
 gpui.workspace = true
-menu.workspace = true
 system_specs.workspace = true
-ui.workspace = true
 urlencoding.workspace = true
 util.workspace = true
+workspace-hack.workspace = true
 workspace.workspace = true
 zed_actions.workspace = true
-workspace-hack.workspace = true
 
 [dev-dependencies]
 editor = { workspace = true, features = ["test-support"] }

crates/feedback/src/feedback.rs 🔗

@@ -2,19 +2,13 @@ use gpui::{App, ClipboardItem, PromptLevel, actions};
 use system_specs::{CopySystemSpecsIntoClipboard, SystemSpecs};
 use util::ResultExt;
 use workspace::Workspace;
-use zed_actions::feedback::FileBugReport;
-
-pub mod feedback_modal;
+use zed_actions::feedback::{EmailZed, FileBugReport, RequestFeature};
 
 actions!(
     zed,
     [
-        /// Opens email client to send feedback to Zed support.
-        EmailZed,
         /// Opens the Zed repository on GitHub.
         OpenZedRepo,
-        /// Opens the feature request form.
-        RequestFeature,
     ]
 );
 
@@ -48,11 +42,7 @@ fn email_body(specs: &SystemSpecs) -> String {
 }
 
 pub fn init(cx: &mut App) {
-    cx.observe_new(|workspace: &mut Workspace, window, cx| {
-        let Some(window) = window else {
-            return;
-        };
-        feedback_modal::FeedbackModal::register(workspace, window, cx);
+    cx.observe_new(|workspace: &mut Workspace, _, _| {
         workspace
             .register_action(|_, _: &CopySystemSpecsIntoClipboard, window, cx| {
                 let specs = SystemSpecs::new(window, cx);

crates/feedback/src/feedback_modal.rs 🔗

@@ -1,113 +0,0 @@
-use gpui::{App, Context, DismissEvent, EventEmitter, FocusHandle, Focusable, Render, Window};
-use ui::{IconPosition, prelude::*};
-use workspace::{ModalView, Workspace};
-use zed_actions::feedback::GiveFeedback;
-
-use crate::{EmailZed, FileBugReport, OpenZedRepo, RequestFeature};
-
-pub struct FeedbackModal {
-    focus_handle: FocusHandle,
-}
-
-impl Focusable for FeedbackModal {
-    fn focus_handle(&self, _: &App) -> FocusHandle {
-        self.focus_handle.clone()
-    }
-}
-impl EventEmitter<DismissEvent> for FeedbackModal {}
-
-impl ModalView for FeedbackModal {}
-
-impl FeedbackModal {
-    pub fn register(workspace: &mut Workspace, _: &mut Window, cx: &mut Context<Workspace>) {
-        let _handle = cx.entity().downgrade();
-        workspace.register_action(move |workspace, _: &GiveFeedback, window, cx| {
-            workspace.toggle_modal(window, cx, move |_, cx| FeedbackModal::new(cx));
-        });
-    }
-
-    pub fn new(cx: &mut Context<Self>) -> Self {
-        Self {
-            focus_handle: cx.focus_handle(),
-        }
-    }
-
-    fn cancel(&mut self, _: &menu::Cancel, _: &mut Window, cx: &mut Context<Self>) {
-        cx.emit(DismissEvent)
-    }
-}
-
-impl Render for FeedbackModal {
-    fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
-        let open_zed_repo =
-            cx.listener(|_, _, window, cx| window.dispatch_action(Box::new(OpenZedRepo), cx));
-
-        v_flex()
-            .key_context("GiveFeedback")
-            .on_action(cx.listener(Self::cancel))
-            .elevation_3(cx)
-            .w_96()
-            .h_auto()
-            .p_4()
-            .gap_2()
-            .child(
-                h_flex()
-                    .w_full()
-                    .justify_between()
-                    .child(Headline::new("Give Feedback"))
-                    .child(
-                        IconButton::new("close-btn", IconName::Close)
-                            .icon_color(Color::Muted)
-                            .on_click(cx.listener(move |_, _, window, cx| {
-                                cx.spawn_in(window, async move |this, cx| {
-                                    this.update(cx, |_, cx| cx.emit(DismissEvent)).ok();
-                                })
-                                .detach();
-                            })),
-                    ),
-            )
-            .child(Label::new("Thanks for using Zed! To share your experience with us, reach for the channel that's the most appropriate:"))
-            .child(
-                Button::new("file-a-bug-report", "File a Bug Report")
-                    .full_width()
-                    .icon(IconName::Debug)
-                    .icon_size(IconSize::XSmall)
-                    .icon_color(Color::Muted)
-                    .icon_position(IconPosition::Start)
-                    .on_click(cx.listener(|_, _, window, cx| {
-                        window.dispatch_action(Box::new(FileBugReport), cx);
-                    })),
-            )
-            .child(
-                Button::new("request-a-feature", "Request a Feature")
-                    .full_width()
-                    .icon(IconName::Sparkle)
-                    .icon_size(IconSize::XSmall)
-                    .icon_color(Color::Muted)
-                    .icon_position(IconPosition::Start)
-                    .on_click(cx.listener(|_, _, window, cx| {
-                        window.dispatch_action(Box::new(RequestFeature), cx);
-                    })),
-            )
-            .child(
-                Button::new("send-us_an-email", "Send an Email")
-                    .full_width()
-                    .icon(IconName::Envelope)
-                    .icon_size(IconSize::XSmall)
-                    .icon_color(Color::Muted)
-                    .icon_position(IconPosition::Start)
-                    .on_click(cx.listener(|_, _, window, cx| {
-                        window.dispatch_action(Box::new(EmailZed), cx);
-                    })),
-            )
-            .child(
-                Button::new("zed_repository", "GitHub Repository")
-                    .full_width()
-                    .icon(IconName::Github)
-                    .icon_size(IconSize::XSmall)
-                    .icon_color(Color::Muted)
-                    .icon_position(IconPosition::Start)
-                    .on_click(open_zed_repo),
-            )
-    }
-}

crates/zed/src/zed/app_menus.rs 🔗

@@ -280,7 +280,10 @@ pub fn app_menus(cx: &mut App) -> Vec<Menu> {
                 MenuItem::action("View Telemetry", zed_actions::OpenTelemetryLog),
                 MenuItem::action("View Dependency Licenses", zed_actions::OpenLicenses),
                 MenuItem::action("Show Welcome", onboarding::ShowWelcome),
-                MenuItem::action("Give Feedback...", zed_actions::feedback::GiveFeedback),
+                MenuItem::separator(),
+                MenuItem::action("File Bug Report...", zed_actions::feedback::FileBugReport),
+                MenuItem::action("Request Feature...", zed_actions::feedback::RequestFeature),
+                MenuItem::action("Email Us...", zed_actions::feedback::EmailZed),
                 MenuItem::separator(),
                 MenuItem::action(
                     "Documentation",
@@ -288,6 +291,7 @@ pub fn app_menus(cx: &mut App) -> Vec<Menu> {
                         url: "https://zed.dev/docs".into(),
                     },
                 ),
+                MenuItem::action("Zed Repository", feedback::OpenZedRepo),
                 MenuItem::action(
                     "Zed Twitter",
                     super::OpenBrowser {

crates/zed_actions/src/lib.rs 🔗

@@ -219,10 +219,12 @@ pub mod feedback {
     actions!(
         feedback,
         [
+            /// Opens email client to send feedback to Zed support.
+            EmailZed,
             /// Opens the bug report form.
             FileBugReport,
-            /// Opens the feedback form.
-            GiveFeedback
+            /// Opens the feature request form.
+            RequestFeature
         ]
     );
 }