Move character counter up above editor in feedback modal

This commit is contained in:
Joseph T. Lyons 2023-12-08 13:07:16 -05:00
parent 4596e7a68a
commit 63cc9e5068

View file

@ -301,6 +301,29 @@ impl Render for FeedbackModal {
// TODO: Add Headline component to `ui2` // TODO: Add Headline component to `ui2`
div().text_xl().child("Share Feedback"), div().text_xl().child("Share Feedback"),
)) ))
.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( .child(
div() div()
.flex_1() .flex_1()
@ -313,29 +336,6 @@ impl Render for FeedbackModal {
) )
.child( .child(
div() 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( .child(
h_stack() h_stack()
.bg(cx.theme().colors().editor_background) .bg(cx.theme().colors().editor_background)