ZIm/crates/feedback/src/feedback.rs
Joseph T. Lyons a03fecafbb
Remove feedback button from status bar (#9100)
This PR removes the feedback button from the status bar, as Nathan and I
discussed. We discussed the fact that we likely no longer need to take
up valuable screen real estate for this, with where Zed as at now.

This PR also moves the `Share Feedback...` collab menu item to the
`Help` menu, as that's where VS Code puts their action to send in-app
feedback (which might help with future discoverability) and renames it
to `Give Feedback...`, to make it consistent with the name of the
command palette action.

Release Notes:

- Removed the feedback button from the status bar.
2024-03-09 06:15:08 -05:00

66 lines
2 KiB
Rust

use gpui::{actions, AppContext, ClipboardItem, PromptLevel};
use system_specs::SystemSpecs;
use workspace::Workspace;
pub mod feedback_modal;
actions!(feedback, [GiveFeedback, SubmitFeedback]);
mod system_specs;
actions!(
zed,
[
CopySystemSpecsIntoClipboard,
FileBugReport,
RequestFeature,
OpenZedRepo
]
);
const fn zed_repo_url() -> &'static str {
"https://github.com/zed-industries/zed"
}
const fn request_feature_url() -> &'static str {
"https://github.com/zed-industries/zed/issues/new?assignees=&labels=enhancement%2Ctriage&template=0_feature_request.yml"
}
fn file_bug_report_url(specs: &SystemSpecs) -> String {
format!(
"https://github.com/zed-industries/zed/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml&environment={}",
urlencoding::encode(&specs.to_string())
)
}
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(|workspace: &mut Workspace, cx| {
feedback_modal::FeedbackModal::register(workspace, cx);
workspace
.register_action(|_, _: &CopySystemSpecsIntoClipboard, cx| {
let specs = SystemSpecs::new(&cx).to_string();
let prompt = cx.prompt(
PromptLevel::Info,
"Copied into clipboard",
Some(&specs),
&["OK"],
);
cx.spawn(|_, _cx| async move {
prompt.await.ok();
})
.detach();
cx.write_to_clipboard(ClipboardItem::new(specs.clone()));
})
.register_action(|_, _: &RequestFeature, cx| {
cx.open_url(request_feature_url());
})
.register_action(move |_, _: &FileBugReport, cx| {
cx.open_url(&file_bug_report_url(&SystemSpecs::new(&cx)));
})
.register_action(move |_, _: &OpenZedRepo, cx| {
cx.open_url(zed_repo_url());
});
})
.detach();
}