mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Fix rustfmt
This commit is contained in:
parent
1f51f74670
commit
260a753005
@ -284,6 +284,10 @@ impl Render for FeedbackModal {
|
|||||||
let open_community_repo =
|
let open_community_repo =
|
||||||
cx.listener(|_, _, cx| cx.dispatch_action(Box::new(OpenZedCommunityRepo)));
|
cx.listener(|_, _, cx| cx.dispatch_action(Box::new(OpenZedCommunityRepo)));
|
||||||
|
|
||||||
|
// Moved this here because providing it inline breaks rustfmt
|
||||||
|
let provide_an_email_address =
|
||||||
|
"Provide an email address if you want us to be able to reply.";
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.elevation_3(cx)
|
.elevation_3(cx)
|
||||||
.key_context("GiveFeedback")
|
.key_context("GiveFeedback")
|
||||||
@ -293,103 +297,105 @@ impl Render for FeedbackModal {
|
|||||||
.h(rems(32.))
|
.h(rems(32.))
|
||||||
.p_4()
|
.p_4()
|
||||||
.gap_4()
|
.gap_4()
|
||||||
|
.child(v_stack().child(
|
||||||
|
// TODO: Add Headline component to `ui2`
|
||||||
|
div().text_xl().child("Share Feedback"),
|
||||||
|
))
|
||||||
.child(
|
.child(
|
||||||
v_stack()
|
div()
|
||||||
.child(
|
.flex_1()
|
||||||
// TODO: Add Headline component to `ui2`
|
|
||||||
div().text_xl().child("Share Feedback"))
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
div()
|
|
||||||
.flex_1()
|
|
||||||
.bg(cx.theme().colors().editor_background)
|
|
||||||
.p_2()
|
|
||||||
.border()
|
|
||||||
.rounded_md()
|
|
||||||
.border_color(cx.theme().colors().border)
|
|
||||||
.child(self.feedback_editor.clone()),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
div().child(
|
|
||||||
Label::new(
|
|
||||||
if self.character_count < *FEEDBACK_CHAR_LIMIT.start() {
|
|
||||||
format!("Feedback must be at least {} characters.", FEEDBACK_CHAR_LIMIT.start())
|
|
||||||
} else if self.character_count > *FEEDBACK_CHAR_LIMIT.end() {
|
|
||||||
format!("Feedback must be less than {} characters.", FEEDBACK_CHAR_LIMIT.end())
|
|
||||||
} else {
|
|
||||||
format!(
|
|
||||||
"Characters: {}",
|
|
||||||
*FEEDBACK_CHAR_LIMIT.end() - self.character_count
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.color(
|
|
||||||
if valid_character_count {
|
|
||||||
Color::Success
|
|
||||||
} else {
|
|
||||||
Color::Error
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
.child(
|
|
||||||
h_stack()
|
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
.p_2()
|
.p_2()
|
||||||
.border()
|
.border()
|
||||||
.rounded_md()
|
.rounded_md()
|
||||||
.border_color(cx.theme().colors().border)
|
.border_color(cx.theme().colors().border)
|
||||||
.child(self.email_address_editor.clone()))
|
.child(self.feedback_editor.clone()),
|
||||||
|
)
|
||||||
.child(
|
.child(
|
||||||
h_stack()
|
div()
|
||||||
.justify_between()
|
.child(
|
||||||
.gap_1()
|
Label::new(if self.character_count < *FEEDBACK_CHAR_LIMIT.start() {
|
||||||
.child(Button::new("community_repo", "Community Repo")
|
format!(
|
||||||
.style(ButtonStyle::Transparent)
|
"Feedback must be at least {} characters.",
|
||||||
.icon(Icon::ExternalLink)
|
FEEDBACK_CHAR_LIMIT.start()
|
||||||
.icon_position(IconPosition::End)
|
)
|
||||||
.icon_size(IconSize::Small)
|
} else if self.character_count > *FEEDBACK_CHAR_LIMIT.end() {
|
||||||
.on_click(open_community_repo)
|
format!(
|
||||||
)
|
"Feedback must be less than {} characters.",
|
||||||
.child(h_stack().gap_1()
|
FEEDBACK_CHAR_LIMIT.end()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
format!(
|
||||||
|
"Characters: {}",
|
||||||
|
*FEEDBACK_CHAR_LIMIT.end() - self.character_count
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.color(if valid_character_count {
|
||||||
|
Color::Success
|
||||||
|
} else {
|
||||||
|
Color::Error
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
h_stack()
|
||||||
|
.bg(cx.theme().colors().editor_background)
|
||||||
|
.p_2()
|
||||||
|
.border()
|
||||||
|
.rounded_md()
|
||||||
|
.border_color(cx.theme().colors().border)
|
||||||
|
.child(self.email_address_editor.clone()),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
h_stack()
|
||||||
|
.justify_between()
|
||||||
|
.gap_1()
|
||||||
.child(
|
.child(
|
||||||
Button::new("cancel_feedback", "Cancel")
|
Button::new("community_repo", "Community Repo")
|
||||||
.style(ButtonStyle::Subtle)
|
.style(ButtonStyle::Transparent)
|
||||||
.color(Color::Muted)
|
.icon(Icon::ExternalLink)
|
||||||
// TODO: replicate this logic when clicking outside the modal
|
.icon_position(IconPosition::End)
|
||||||
// TODO: Will require somehow overriding the modal dismal default behavior
|
.icon_size(IconSize::Small)
|
||||||
.map(|this| {
|
.on_click(open_community_repo),
|
||||||
if has_feedback {
|
|
||||||
this.on_click(dismiss_prompt)
|
|
||||||
} else {
|
|
||||||
this.on_click(dismiss)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::new("send_feedback", submit_button_text)
|
h_stack()
|
||||||
.color(Color::Accent)
|
.gap_1()
|
||||||
.style(ButtonStyle::Filled)
|
.child(
|
||||||
// TODO: Ensure that while submitting, "Sending..." is shown and disable the button
|
Button::new("cancel_feedback", "Cancel")
|
||||||
// TODO: If submit errors: show popup with error, don't close modal, set text back to "Send Feedback", and re-enable button
|
.style(ButtonStyle::Subtle)
|
||||||
// TODO: If submit is successful, close the modal
|
.color(Color::Muted)
|
||||||
.on_click(cx.listener(|this, _, cx| {
|
// TODO: replicate this logic when clicking outside the modal
|
||||||
let _ = this.submit(cx);
|
// TODO: Will require somehow overriding the modal dismal default behavior
|
||||||
}))
|
.map(|this| {
|
||||||
.tooltip(|cx| {
|
if has_feedback {
|
||||||
Tooltip::with_meta(
|
this.on_click(dismiss_prompt)
|
||||||
"Submit feedback to the Zed team.",
|
} else {
|
||||||
None,
|
this.on_click(dismiss)
|
||||||
"Provide an email address if you want us to be able to reply.",
|
}
|
||||||
cx,
|
}),
|
||||||
)
|
)
|
||||||
})
|
.child(
|
||||||
.when(!allow_submission, |this| this.disabled(true))
|
Button::new("send_feedback", submit_button_text)
|
||||||
|
.color(Color::Accent)
|
||||||
|
.style(ButtonStyle::Filled)
|
||||||
|
// TODO: Ensure that while submitting, "Sending..." is shown and disable the button
|
||||||
|
// TODO: If submit errors: show popup with error, don't close modal, set text back to "Send Feedback", and re-enable button
|
||||||
|
// TODO: If submit is successful, close the modal
|
||||||
|
.on_click(cx.listener(|this, _, cx| {
|
||||||
|
let _ = this.submit(cx);
|
||||||
|
}))
|
||||||
|
.tooltip(|cx| {
|
||||||
|
Tooltip::with_meta(
|
||||||
|
"Submit feedback to the Zed team.",
|
||||||
|
None,
|
||||||
|
provide_an_email_address,
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.when(!allow_submission, |this| this.disabled(true)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user