mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
Merge pull request #1134 from zed-industries/feedback-button
Add status bar link and help menu item to open an issue on feedback repo
This commit is contained in:
commit
6efd4e0da6
5 changed files with 65 additions and 0 deletions
|
@ -157,6 +157,7 @@ pub struct StatusBar {
|
|||
pub auto_update_progress_message: TextStyle,
|
||||
pub auto_update_done_message: TextStyle,
|
||||
pub lsp_status: Interactive<StatusBarLspStatus>,
|
||||
pub feedback: Interactive<TextStyle>,
|
||||
pub sidebar_buttons: StatusBarSidebarButtons,
|
||||
pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,
|
||||
pub diagnostic_message: Interactive<ContainedText>,
|
||||
|
|
51
crates/zed/src/feedback.rs
Normal file
51
crates/zed/src/feedback.rs
Normal file
|
@ -0,0 +1,51 @@
|
|||
use crate::OpenBrowser;
|
||||
use gpui::{
|
||||
elements::{MouseEventHandler, Text},
|
||||
platform::CursorStyle,
|
||||
Element, Entity, RenderContext, View,
|
||||
};
|
||||
use settings::Settings;
|
||||
use workspace::StatusItemView;
|
||||
|
||||
pub const NEW_ISSUE_URL: &'static str =
|
||||
"https://github.com/zed-industries/feedback/issues/new/choose";
|
||||
|
||||
pub struct FeedbackLink;
|
||||
|
||||
impl Entity for FeedbackLink {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
impl View for FeedbackLink {
|
||||
fn ui_name() -> &'static str {
|
||||
"FeedbackLink"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> gpui::ElementBox {
|
||||
MouseEventHandler::new::<Self, _, _>(0, cx, |state, cx| {
|
||||
let theme = &cx.global::<Settings>().theme;
|
||||
let theme = &theme.workspace.status_bar.feedback;
|
||||
Text::new(
|
||||
"Give Feedback".to_string(),
|
||||
theme.style_for(state, false).clone(),
|
||||
)
|
||||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(|_, _, cx| {
|
||||
cx.dispatch_action(OpenBrowser {
|
||||
url: NEW_ISSUE_URL.into(),
|
||||
})
|
||||
})
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
impl StatusItemView for FeedbackLink {
|
||||
fn set_active_pane_item(
|
||||
&mut self,
|
||||
_: Option<&dyn workspace::ItemHandle>,
|
||||
_: &mut gpui::ViewContext<Self>,
|
||||
) {
|
||||
}
|
||||
}
|
|
@ -253,6 +253,12 @@ pub fn menus() -> Vec<Menu<'static>> {
|
|||
action: Box::new(command_palette::Toggle),
|
||||
},
|
||||
MenuItem::Separator,
|
||||
MenuItem::Action {
|
||||
name: "Give Feedback",
|
||||
action: Box::new(crate::OpenBrowser {
|
||||
url: super::feedback::NEW_ISSUE_URL.into(),
|
||||
}),
|
||||
},
|
||||
MenuItem::Action {
|
||||
name: "Zed.dev",
|
||||
action: Box::new(crate::OpenBrowser {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
mod feedback;
|
||||
pub mod languages;
|
||||
pub mod menus;
|
||||
pub mod settings_file;
|
||||
|
@ -203,11 +204,13 @@ pub fn initialize_workspace(
|
|||
});
|
||||
let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new());
|
||||
let auto_update = cx.add_view(|cx| auto_update::AutoUpdateIndicator::new(cx));
|
||||
let feedback_link = cx.add_view(|_| feedback::FeedbackLink);
|
||||
workspace.status_bar().update(cx, |status_bar, cx| {
|
||||
status_bar.add_left_item(diagnostic_summary, cx);
|
||||
status_bar.add_left_item(lsp_status, cx);
|
||||
status_bar.add_right_item(cursor_position, cx);
|
||||
status_bar.add_right_item(auto_update, cx);
|
||||
status_bar.add_right_item(feedback_link, cx);
|
||||
});
|
||||
|
||||
auto_update::notify_of_any_new_update(cx.weak_handle(), cx);
|
||||
|
|
|
@ -43,6 +43,10 @@ export default function statusBar(theme: Theme) {
|
|||
...text(theme, "sans", "muted"),
|
||||
hover: text(theme, "sans", "secondary"),
|
||||
},
|
||||
feedback: {
|
||||
...text(theme, "sans", "muted"),
|
||||
hover: text(theme, "sans", "active"),
|
||||
},
|
||||
diagnosticSummary: {
|
||||
height: 16,
|
||||
iconWidth: 14,
|
||||
|
|
Loading…
Reference in a new issue