Add status bar link and Help menu item to open an issue on feedback repo
This commit is contained in:
parent
9d5111e86a
commit
8311458931
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_progress_message: TextStyle,
|
||||||
pub auto_update_done_message: TextStyle,
|
pub auto_update_done_message: TextStyle,
|
||||||
pub lsp_status: Interactive<StatusBarLspStatus>,
|
pub lsp_status: Interactive<StatusBarLspStatus>,
|
||||||
|
pub feedback: Interactive<TextStyle>,
|
||||||
pub sidebar_buttons: StatusBarSidebarButtons,
|
pub sidebar_buttons: StatusBarSidebarButtons,
|
||||||
pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,
|
pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,
|
||||||
pub diagnostic_message: Interactive<ContainedText>,
|
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),
|
action: Box::new(command_palette::Toggle),
|
||||||
},
|
},
|
||||||
MenuItem::Separator,
|
MenuItem::Separator,
|
||||||
|
MenuItem::Action {
|
||||||
|
name: "Give Feedback",
|
||||||
|
action: Box::new(crate::OpenBrowser {
|
||||||
|
url: super::feedback::NEW_ISSUE_URL.into(),
|
||||||
|
}),
|
||||||
|
},
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
name: "Zed.dev",
|
name: "Zed.dev",
|
||||||
action: Box::new(crate::OpenBrowser {
|
action: Box::new(crate::OpenBrowser {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod feedback;
|
||||||
pub mod languages;
|
pub mod languages;
|
||||||
pub mod menus;
|
pub mod menus;
|
||||||
pub mod settings_file;
|
pub mod settings_file;
|
||||||
|
@ -203,11 +204,13 @@ pub fn initialize_workspace(
|
||||||
});
|
});
|
||||||
let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new());
|
let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new());
|
||||||
let auto_update = cx.add_view(|cx| auto_update::AutoUpdateIndicator::new(cx));
|
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| {
|
workspace.status_bar().update(cx, |status_bar, cx| {
|
||||||
status_bar.add_left_item(diagnostic_summary, cx);
|
status_bar.add_left_item(diagnostic_summary, cx);
|
||||||
status_bar.add_left_item(lsp_status, cx);
|
status_bar.add_left_item(lsp_status, cx);
|
||||||
status_bar.add_right_item(cursor_position, cx);
|
status_bar.add_right_item(cursor_position, cx);
|
||||||
status_bar.add_right_item(auto_update, 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);
|
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"),
|
...text(theme, "sans", "muted"),
|
||||||
hover: text(theme, "sans", "secondary"),
|
hover: text(theme, "sans", "secondary"),
|
||||||
},
|
},
|
||||||
|
feedback: {
|
||||||
|
...text(theme, "sans", "muted"),
|
||||||
|
hover: text(theme, "sans", "active"),
|
||||||
|
},
|
||||||
diagnosticSummary: {
|
diagnosticSummary: {
|
||||||
height: 16,
|
height: 16,
|
||||||
iconWidth: 14,
|
iconWidth: 14,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue