diff --git a/frontend/src/pages/home.rs b/frontend/src/pages/home.rs index f9a75f8..4476035 100644 --- a/frontend/src/pages/home.rs +++ b/frontend/src/pages/home.rs @@ -1,7 +1,7 @@ use gloo_net::http::Request; use web_sys::wasm_bindgen::convert::OptionIntoWasmAbi; use web_sys::wasm_bindgen::JsCast; -use web_sys::{HtmlElement, HtmlInputElement}; +use web_sys::HtmlElement; use yew::prelude::*; use yew::{classes, function_component, Callback, Html}; @@ -44,7 +44,6 @@ fn string_to_html(input: &[CharStatus]) -> Html { "flex", "flex-row", "gap-4", - "mt-4", "notranslate", ) } @@ -324,161 +323,192 @@ pub fn Home() -> Html { classes!( "flex", "flex-col", - "mt-4", "items-center", "h-[90vh]", + "pt-12", ) } >
-
-
- { - if *loading { - html!(

{"Loading..."}

) - } - else if *game_over { - - let (text, color) = match *result { - GameResult::Win => { - ("FOUND", "bg-green-600") - }, - GameResult::Lose => { - ("WANTED", "bg-red-600") + +
+ { for submitted_words.iter().map(|e| {string_to_html(e)})} +
+ +
+ { + if *loading { + html!(

{"Loading..."}

) } - }; - html! ( -
-

{ - text - }

-
    - { - word.chars().map(|e|{ + else if *game_over { - let text = e; - html!{ -
  • { + ("FOUND", "bg-green-600") + }, + GameResult::Lose => { + ("WANTED", "bg-red-600") + } + }; + html! ( +
    +

    { + text + }

    +
      + { + word.chars().map(|e|{ + + let text = e; + html!{ +
    • + - - {text} - -
    • - }}).collect::() - } -
    -
    - ) - } - else if !*game_over { - node_refs.iter().enumerate().map(|(index, node_ref)| { - let on_focus = { - let curr_index = curr_index.clone(); - - Callback::from(move |e: FocusEvent| { - let target = e.target_unchecked_into::(); - if let Some(index) = target.get_attribute("tabindex") { - if let Ok(i) = index.parse::() { - curr_index.set(i); - } + > + {text} + +
  • + }}).collect::() } - - }) - }; - html! { - +
+
+ ) } - }).collect::() + else if !*game_over { + node_refs.iter().enumerate().map(|(index, node_ref)| { + let on_focus = { + let curr_index = curr_index.clone(); + + Callback::from(move |e: FocusEvent| { + let target = e.target_unchecked_into::(); + if let Some(index) = target.get_attribute("tabindex") { + if let Ok(i) = index.parse::() { + curr_index.set(i); + } + } + + }) + }; + html! { + + } + }).collect::() + } else { + html!(
) + } + } +
+ + { + if *loading { + html!{<>} } else { - html!(
) + html!{ +
+ +
+ } } } +
- -
- { for submitted_words.iter().map(|e| {string_to_html(e)})} -
-
- - + } } };