1use gpui::{elements::*, CursorStyle, Entity, MouseButton, RenderContext, View, ViewContext};
2use settings::Settings;
3use workspace::{item::ItemHandle, StatusItemView};
4
5use crate::feedback_editor::GiveFeedback;
6
7pub struct DeployFeedbackButton;
8
9impl Entity for DeployFeedbackButton {
10 type Event = ();
11}
12
13impl View for DeployFeedbackButton {
14 fn ui_name() -> &'static str {
15 "DeployFeedbackButton"
16 }
17
18 fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> ElementBox {
19 Stack::new()
20 .with_child(
21 MouseEventHandler::<Self>::new(0, cx, |state, cx| {
22 let theme = &cx.global::<Settings>().theme;
23 let style = &theme.workspace.status_bar.feedback.style_for(state, false);
24 Svg::new("icons/speech_bubble_12.svg")
25 .with_color(style.color)
26 .constrained()
27 .with_width(style.icon_width)
28 .aligned()
29 .constrained()
30 .with_width(style.button_width)
31 .with_height(style.button_width)
32 .contained()
33 .with_style(style.container)
34 .boxed()
35 })
36 .with_cursor_style(CursorStyle::PointingHand)
37 .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(GiveFeedback))
38 .boxed(),
39 )
40 .boxed()
41 }
42}
43
44impl StatusItemView for DeployFeedbackButton {
45 fn set_active_pane_item(&mut self, _: Option<&dyn ItemHandle>, _: &mut ViewContext<Self>) {}
46}