diff --git a/crates/feedback/src/deploy_feedback_button.rs b/crates/feedback/src/deploy_feedback_button.rs index 7519d2d06e..222c542eed 100644 --- a/crates/feedback/src/deploy_feedback_button.rs +++ b/crates/feedback/src/deploy_feedback_button.rs @@ -2,39 +2,58 @@ use gpui::{elements::*, CursorStyle, Entity, MouseButton, RenderContext, View, V use settings::Settings; use workspace::{item::ItemHandle, StatusItemView}; -use crate::feedback_editor::GiveFeedback; +use crate::feedback_editor::{FeedbackEditor, GiveFeedback}; -pub struct DeployFeedbackButton; +pub struct DeployFeedbackButton { + active: bool, +} impl Entity for DeployFeedbackButton { type Event = (); } +impl DeployFeedbackButton { + pub fn new() -> Self { + DeployFeedbackButton { active: false } + } +} + impl View for DeployFeedbackButton { fn ui_name() -> &'static str { "DeployFeedbackButton" } fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> ElementBox { + let active = self.active; Stack::new() .with_child( MouseEventHandler::::new(0, cx, |state, cx| { let theme = &cx.global::().theme; - let style = &theme.workspace.status_bar.feedback.style_for(state, false); + let style = &theme + .workspace + .status_bar + .sidebar_buttons + .item + .style_for(state, active); + Svg::new("icons/speech_bubble_12.svg") - .with_color(style.color) + .with_color(style.icon_color) .constrained() - .with_width(style.icon_width) + .with_width(style.icon_size) .aligned() .constrained() - .with_width(style.button_width) - .with_height(style.button_width) + .with_width(style.icon_size) + .with_height(style.icon_size) .contained() .with_style(style.container) .boxed() }) .with_cursor_style(CursorStyle::PointingHand) - .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(GiveFeedback)) + .on_click(MouseButton::Left, move |_, cx| { + if !active { + cx.dispatch_action(GiveFeedback) + } + }) .boxed(), ) .boxed() @@ -42,5 +61,15 @@ impl View for DeployFeedbackButton { } impl StatusItemView for DeployFeedbackButton { - fn set_active_pane_item(&mut self, _: Option<&dyn ItemHandle>, _: &mut ViewContext) {} + fn set_active_pane_item(&mut self, item: Option<&dyn ItemHandle>, cx: &mut ViewContext) { + if let Some(item) = item { + if let Some(_) = item.downcast::() { + self.active = true; + cx.notify(); + return; + } + } + self.active = false; + cx.notify(); + } } diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 87504d6cd9..70ee22d37d 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -281,7 +281,6 @@ pub struct StatusBar { pub auto_update_progress_message: TextStyle, pub auto_update_done_message: TextStyle, pub lsp_status: Interactive, - pub feedback: Interactive, pub sidebar_buttons: StatusBarSidebarButtons, pub diagnostic_summary: Interactive, pub diagnostic_message: Interactive, diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index d742c733e5..79ec9b4118 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -339,10 +339,13 @@ pub fn initialize_workspace( let activity_indicator = activity_indicator::ActivityIndicator::new(workspace, app_state.languages.clone(), cx); let active_buffer_language = cx.add_view(|_| language_selector::ActiveBufferLanguage::new()); + let feedback_button = + cx.add_view(|_| feedback::deploy_feedback_button::DeployFeedbackButton::new()); let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new()); workspace.status_bar().update(cx, |status_bar, cx| { status_bar.add_left_item(diagnostic_summary, cx); status_bar.add_left_item(activity_indicator, cx); + status_bar.add_right_item(feedback_button, cx); status_bar.add_right_item(active_buffer_language, cx); status_bar.add_right_item(cursor_position, cx); }); diff --git a/styles/src/styleTree/statusBar.ts b/styles/src/styleTree/statusBar.ts index e5c07c07c2..9fa427d302 100644 --- a/styles/src/styleTree/statusBar.ts +++ b/styles/src/styleTree/statusBar.ts @@ -51,15 +51,6 @@ export default function statusBar(colorScheme: ColorScheme) { ...text(layer, "sans"), hover: text(layer, "sans", "hovered"), }, - feedback: { - margin: { left: 2 }, - color: foreground(layer, "variant"), - iconWidth: 14, - buttonWidth: 14, - hover: { - color: foreground(layer, "on"), - }, - }, diagnosticSummary: { height: 20, iconWidth: 16,