Show negative numbers after limit is hit
This commit is contained in:
parent
9abf5a1bf2
commit
33c41fb5e1
1 changed files with 3 additions and 8 deletions
|
@ -32,7 +32,7 @@ const DEV_MODE: bool = false;
|
||||||
|
|
||||||
const DATABASE_KEY_NAME: &str = "email_address";
|
const DATABASE_KEY_NAME: &str = "email_address";
|
||||||
const EMAIL_REGEX: &str = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b";
|
const EMAIL_REGEX: &str = r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b";
|
||||||
const FEEDBACK_CHAR_LIMIT: RangeInclusive<usize> = 10..=5000;
|
const FEEDBACK_CHAR_LIMIT: RangeInclusive<i32> = 10..=5000;
|
||||||
const FEEDBACK_SUBMISSION_ERROR_TEXT: &str =
|
const FEEDBACK_SUBMISSION_ERROR_TEXT: &str =
|
||||||
"Feedback failed to submit, see error log for details.";
|
"Feedback failed to submit, see error log for details.";
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ pub struct FeedbackModal {
|
||||||
email_address_editor: View<Editor>,
|
email_address_editor: View<Editor>,
|
||||||
awaiting_submission: bool,
|
awaiting_submission: bool,
|
||||||
user_submitted: bool,
|
user_submitted: bool,
|
||||||
character_count: usize,
|
character_count: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FocusableView for FeedbackModal {
|
impl FocusableView for FeedbackModal {
|
||||||
|
@ -154,7 +154,7 @@ impl FeedbackModal {
|
||||||
.as_singleton()
|
.as_singleton()
|
||||||
.expect("Feedback editor is never a multi-buffer")
|
.expect("Feedback editor is never a multi-buffer")
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.len();
|
.len() as i32;
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -344,11 +344,6 @@ impl Render for FeedbackModal {
|
||||||
"Feedback must be at least {} characters.",
|
"Feedback must be at least {} characters.",
|
||||||
FEEDBACK_CHAR_LIMIT.start()
|
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 {
|
} else {
|
||||||
format!(
|
format!(
|
||||||
"Characters: {}",
|
"Characters: {}",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue