Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add link to community repo in feedback editor
Joseph Lyons37f910949d34
diff --git a/crates/feedback/src/feedback.rs b/crates/feedback/src/feedback.rsindex f95f24f5574..cd72cdf9508 100644--- a/crates/feedback/src/feedback.rs+++ b/crates/feedback/src/feedback.rs@@ -20,7 +20,12 @@ impl_actions!(zed, [OpenBrowser]);actions!(zed,- [CopySystemSpecsIntoClipboard, FileBugReport, RequestFeature]+ [+ CopySystemSpecsIntoClipboard,+ FileBugReport,+ RequestFeature,+ OpenZedCommunityRepo+ ]);pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {@@ -66,4 +71,11 @@ pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {});},);++ cx.add_action(+ |_: &mut Workspace, _: &OpenZedCommunityRepo, cx: &mut ViewContext<Workspace>| {+ let url = "https://github.com/zed-industries/community";+ cx.dispatch_action(OpenBrowser { url: url.into() });+ },+ );}diff --git a/crates/feedback/src/feedback_info_text.rs b/crates/feedback/src/feedback_info_text.rsindex 6693a7cb44f..5e0378b95ee 100644--- a/crates/feedback/src/feedback_info_text.rs+++ b/crates/feedback/src/feedback_info_text.rs@@ -1,10 +1,12 @@use gpui::{- elements::Label, Element, ElementBox, Entity, RenderContext, View, ViewContext, ViewHandle,+ elements::{Flex, Label, MouseEventHandler, ParentElement, Text},+ CursorStyle, Element, ElementBox, Entity, MouseButton, RenderContext, View, ViewContext,+ ViewHandle,};use settings::Settings;use workspace::{item::ItemHandle, ToolbarItemLocation, ToolbarItemView};-use crate::feedback_editor::FeedbackEditor;+use crate::{feedback_editor::FeedbackEditor, OpenZedCommunityRepo};pub struct FeedbackInfoText {active_item: Option<ViewHandle<FeedbackEditor>>,@@ -29,9 +31,44 @@ impl View for FeedbackInfoText {fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {let theme = cx.global::<Settings>().theme.clone();- let text = "We read whatever you submit here. For issues and discussions, visit the community repo on GitHub.";- Label::new(text, theme.feedback.info_text.text.clone())- .contained()++ Flex::row()+ .with_child(+ Text::new(+ "We read whatever you submit here. For issues and discussions, visit the ",+ theme.feedback.info_text.text.clone(),+ )+ .with_soft_wrap(false)+ .aligned()+ .boxed(),+ )+ .with_child(+ MouseEventHandler::<OpenZedCommunityRepo>::new(0, cx, |state, _| {+ let text = if state.hovered() {+ theme.feedback.link_hover_text.clone()+ } else {+ theme.feedback.link_text.clone()+ };++ Label::new("community repo", text.text)+ .contained()+ .aligned()+ .left()+ .clipped()+ .boxed()+ })+ .with_cursor_style(CursorStyle::PointingHand)+ .on_click(MouseButton::Left, |_, cx| {+ cx.dispatch_action(OpenZedCommunityRepo)+ })+ .boxed(),+ )+ .with_child(+ Text::new(" on GitHub.", theme.feedback.info_text.text.clone())+ .with_soft_wrap(false)+ .aligned()+ .boxed(),+ ).aligned().left().clipped()diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rsindex bc338bbe269..bc3b048010b 100644--- a/crates/theme/src/theme.rs+++ b/crates/theme/src/theme.rs@@ -812,6 +812,8 @@ pub struct FeedbackStyle {pub submit_button: Interactive<ContainedText>,pub button_margin: f32,pub info_text: ContainedText,+ pub link_text: ContainedText,+ pub link_hover_text: ContainedText,}#[derive(Clone, Deserialize, Default)]diff --git a/styles/src/styleTree/feedback.ts b/styles/src/styleTree/feedback.tsindex 46cb867ad90..34922b4d00b 100644--- a/styles/src/styleTree/feedback.ts+++ b/styles/src/styleTree/feedback.ts@@ -33,5 +33,7 @@ export default function feedback(colorScheme: ColorScheme) {},button_margin: 8,info_text: text(layer, "sans", "default", { size: "xs" }),+ link_text: text(layer, "sans", "default", { size: "xs", underline: true }),+ link_hover_text: text(layer, "sans", "hovered", { size: "xs", underline: true })};}