mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-28 21:32:39 +00:00
Add feedback information text
This commit is contained in:
parent
654ee48feb
commit
bbe8297297
2 changed files with 55 additions and 1 deletions
|
@ -509,3 +509,55 @@ impl ToolbarItemView for SubmitFeedbackButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct FeedbackInfoText {
|
||||||
|
active_item: Option<ViewHandle<FeedbackEditor>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FeedbackInfoText {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
active_item: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Entity for FeedbackInfoText {
|
||||||
|
type Event = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
impl View for FeedbackInfoText {
|
||||||
|
fn ui_name() -> &'static str {
|
||||||
|
"FeedbackInfoText"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
|
Label::new(
|
||||||
|
"We read whatever you submit here. For issues and discussions, visit the community repo on GitHub.".to_string(),
|
||||||
|
theme.workspace.titlebar.outdated_warning.text.clone(),
|
||||||
|
)
|
||||||
|
.contained()
|
||||||
|
.with_style(theme.workspace.titlebar.outdated_warning.container)
|
||||||
|
.aligned()
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToolbarItemView for FeedbackInfoText {
|
||||||
|
fn set_active_pane_item(
|
||||||
|
&mut self,
|
||||||
|
active_pane_item: Option<&dyn ItemHandle>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> workspace::ToolbarItemLocation {
|
||||||
|
cx.notify();
|
||||||
|
if let Some(feedback_editor) = active_pane_item.and_then(|i| i.downcast::<FeedbackEditor>())
|
||||||
|
{
|
||||||
|
self.active_item = Some(feedback_editor);
|
||||||
|
ToolbarItemLocation::PrimaryLeft { flex: None }
|
||||||
|
} else {
|
||||||
|
self.active_item = None;
|
||||||
|
ToolbarItemLocation::Hidden
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use collections::VecDeque;
|
||||||
pub use editor;
|
pub use editor;
|
||||||
use editor::{Editor, MultiBuffer};
|
use editor::{Editor, MultiBuffer};
|
||||||
|
|
||||||
use feedback::feedback_editor::SubmitFeedbackButton;
|
use feedback::feedback_editor::{FeedbackInfoText, SubmitFeedbackButton};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions,
|
||||||
|
@ -290,6 +290,8 @@ pub fn initialize_workspace(
|
||||||
toolbar.add_item(project_search_bar, cx);
|
toolbar.add_item(project_search_bar, cx);
|
||||||
let submit_feedback_button = cx.add_view(|_| SubmitFeedbackButton::new());
|
let submit_feedback_button = cx.add_view(|_| SubmitFeedbackButton::new());
|
||||||
toolbar.add_item(submit_feedback_button, cx);
|
toolbar.add_item(submit_feedback_button, cx);
|
||||||
|
let feedback_info_text = cx.add_view(|_| FeedbackInfoText::new());
|
||||||
|
toolbar.add_item(feedback_info_text, cx);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue