Get feedback2 compiling

Co-Authored-By: Joseph T. Lyons <19867440+JosephTLyons@users.noreply.github.com>
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Nate Butler 2023-11-30 16:07:54 -05:00
parent 5098fafa02
commit 8b7be8f614
8 changed files with 313 additions and 206 deletions

View file

@ -1,10 +1,7 @@
// use crate::feedback_editor::{FeedbackEditor, SubmitFeedback};
// use crate::{feedback_editor::SubmitFeedback, feedback_modal::FeedbackModal};
// use anyhow::Result;
// use gpui::{
// elements::{Label, MouseEventHandler},
// platform::{CursorStyle, MouseButton},
// AnyElement, AppContext, Element, Entity, Task, View, ViewContext, ViewHandle,
// };
// use gpui::{AppContext, Render, Task, View, ViewContext};
// use ui::IconButton;
// use workspace::{item::ItemHandle, ToolbarItemLocation, ToolbarItemView};
// pub fn init(cx: &mut AppContext) {
@ -12,7 +9,7 @@
// }
// pub struct SubmitFeedbackButton {
// pub(crate) active_item: Option<ViewHandle<FeedbackEditor>>,
// pub(crate) active_item: Option<View<FeedbackModal>>,
// }
// impl SubmitFeedbackButton {
@ -35,60 +32,67 @@
// }
// }
// impl Entity for SubmitFeedbackButton {
// type Event = ();
// }
// impl Render for SubmitFeedbackbutton {
// type Element;
// impl View for SubmitFeedbackButton {
// fn ui_name() -> &'static str {
// "SubmitFeedbackButton"
// }
// fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
// let theme = theme::current(cx).clone();
// let allow_submission = self
// .active_item
// .as_ref()
// .map_or(true, |i| i.read(cx).allow_submission);
// enum SubmitFeedbackButton {}
// MouseEventHandler::new::<SubmitFeedbackButton, _>(0, cx, |state, _| {
// let text;
// let style = if allow_submission {
// text = "Submit as Markdown";
// theme.feedback.submit_button.style_for(state)
// } else {
// text = "Submitting...";
// theme
// .feedback
// .submit_button
// .disabled
// .as_ref()
// .unwrap_or(&theme.feedback.submit_button.default)
// };
// Label::new(text, style.text.clone())
// .contained()
// .with_style(style.container)
// })
// .with_cursor_style(CursorStyle::PointingHand)
// .on_click(MouseButton::Left, |_, this, cx| {
// this.submit(&Default::default(), cx);
// })
// .aligned()
// .contained()
// .with_margin_left(theme.feedback.button_margin)
// .with_tooltip::<Self>(
// 0,
// "cmd-s",
// Some(Box::new(SubmitFeedback)),
// theme.tooltip.clone(),
// cx,
// )
// .into_any()
// fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
// todo!();
// // IconButton::new("give-feedback", Icon::Envelope)
// // .style(ui::ButtonStyle::Subtle)
// // .on_click(|_, cx| cx.dispatch_action(GiveFeedback))
// }
// }
// // impl View for SubmitFeedbackButton {
// // fn ui_name() -> &'static str {
// // "SubmitFeedbackButton"
// // }
// // fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
// // let theme = theme::current(cx).clone();
// // let allow_submission = self
// // .active_item
// // .as_ref()
// // .map_or(true, |i| i.read(cx).allow_submission);
// // enum SubmitFeedbackButton {}
// // MouseEventHandler::new::<SubmitFeedbackButton, _>(0, cx, |state, _| {
// // let text;
// // let style = if allow_submission {
// // text = "Submit as Markdown";
// // theme.feedback.submit_button.style_for(state)
// // } else {
// // text = "Submitting...";
// // theme
// // .feedback
// // .submit_button
// // .disabled
// // .as_ref()
// // .unwrap_or(&theme.feedback.submit_button.default)
// // };
// // Label::new(text, style.text.clone())
// // .contained()
// // .with_style(style.container)
// // })
// // .with_cursor_style(CursorStyle::PointingHand)
// // .on_click(MouseButton::Left, |_, this, cx| {
// // this.submit(&Default::default(), cx);
// // })
// // .aligned()
// // .contained()
// // .with_margin_left(theme.feedback.button_margin)
// // .with_tooltip::<Self>(
// // 0,
// // "cmd-s",
// // Some(Box::new(SubmitFeedback)),
// // theme.tooltip.clone(),
// // cx,
// // )
// // .into_any()
// // }
// // }
// impl ToolbarItemView for SubmitFeedbackButton {
// fn set_active_pane_item(
// &mut self,