Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Align feedback button styles with other sidebar buttons Make feedback button reflect whether you're in a feedback buffer
Mikayla Makic8de73897214
diff --git a/crates/feedback/src/deploy_feedback_button.rs b/crates/feedback/src/deploy_feedback_button.rsindex 7519d2d06e6..222c542eed4 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, Vuse 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::<Self>::new(0, cx, |state, cx| {let theme = &cx.global::<Settings>().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<Self>) {}+ fn set_active_pane_item(&mut self, item: Option<&dyn ItemHandle>, cx: &mut ViewContext<Self>) {+ if let Some(item) = item {+ if let Some(_) = item.downcast::<FeedbackEditor>() {+ self.active = true;+ cx.notify();+ return;+ }+ }+ self.active = false;+ cx.notify();+ }}diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rsindex 87504d6cd98..70ee22d37d4 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<StatusBarLspStatus>,- pub feedback: Interactive<IconButton>,pub sidebar_buttons: StatusBarSidebarButtons,pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,pub diagnostic_message: Interactive<ContainedText>,diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rsindex d742c733e52..79ec9b41185 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.tsindex e5c07c07c2b..9fa427d302f 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,