1use gpui::{
2 elements::{MouseEventHandler, ParentElement, Stack, Text},
3 CursorStyle, Element, ElementBox, Entity, MouseButton, RenderContext, View, ViewContext,
4};
5use settings::Settings;
6use workspace::{item::ItemHandle, StatusItemView};
7
8use crate::feedback_editor::GiveFeedback;
9
10pub struct DeployFeedbackButton;
11
12impl Entity for DeployFeedbackButton {
13 type Event = ();
14}
15
16impl View for DeployFeedbackButton {
17 fn ui_name() -> &'static str {
18 "DeployFeedbackButton"
19 }
20
21 fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> ElementBox {
22 Stack::new()
23 .with_child(
24 MouseEventHandler::<Self>::new(0, cx, |state, cx| {
25 let theme = &cx.global::<Settings>().theme;
26 let theme = &theme.workspace.status_bar.feedback;
27
28 Text::new("Give Feedback", theme.style_for(state, true).clone()).boxed()
29 })
30 .with_cursor_style(CursorStyle::PointingHand)
31 .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(GiveFeedback))
32 .boxed(),
33 )
34 .boxed()
35 }
36}
37
38impl StatusItemView for DeployFeedbackButton {
39 fn set_active_pane_item(&mut self, _: Option<&dyn ItemHandle>, _: &mut ViewContext<Self>) {}
40}