fix(frontend): replay button disabled
fix(frontend): replay button disabled
This commit is contained in:
commit
48c1c53299
@ -338,6 +338,7 @@ pub fn Home() -> Html {
|
|||||||
|
|
||||||
Callback::from(move |e: InputEvent| {
|
Callback::from(move |e: InputEvent| {
|
||||||
if let Some(value) = e.data() {
|
if let Some(value) = e.data() {
|
||||||
|
let value = value.to_uppercase();
|
||||||
let index = *curr_index;
|
let index = *curr_index;
|
||||||
let mut values = (*input_values).clone();
|
let mut values = (*input_values).clone();
|
||||||
|
|
||||||
@ -351,7 +352,7 @@ pub fn Home() -> Html {
|
|||||||
curr_index.set(new_index);
|
curr_index.set(new_index);
|
||||||
set_focus(new_index);
|
set_focus(new_index);
|
||||||
} else if value.len() == 1 && value.chars().all(char::is_alphabetic) {
|
} else if value.len() == 1 && value.chars().all(char::is_alphabetic) {
|
||||||
values[index] = value.to_uppercase();
|
values[index] = value;
|
||||||
input_values.set(values);
|
input_values.set(values);
|
||||||
if index < *length {
|
if index < *length {
|
||||||
let new_index = index + 1;
|
let new_index = index + 1;
|
||||||
@ -545,10 +546,10 @@ pub fn Home() -> Html {
|
|||||||
"flex",
|
"flex",
|
||||||
"items-center",
|
"items-center",
|
||||||
"justify-center",
|
"justify-center",
|
||||||
{if input_values.iter().any(std::string::String::is_empty) {"bg-gray-700"} else {"bg-green-600"}},
|
{if input_values.iter().any(std::string::String::is_empty) && !*game_over {"bg-gray-700"} else {"bg-green-600"}},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
onclick={if input_values.iter().any(std::string::String::is_empty) {on_disabled} else {on_submit}} type="submit">
|
onclick={if input_values.iter().any(std::string::String::is_empty) && !*game_over {on_disabled} else {on_submit}} type="submit">
|
||||||
{
|
{
|
||||||
if *game_over {
|
if *game_over {
|
||||||
html!{
|
html!{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user