diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-27 16:47:29 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-27 16:47:51 +0200 |
commit | 02333e4a1ca6f1e260693b0bf6b580d5844fcb92 (patch) | |
tree | 10eeeb714958cd263b9ea7fa6fa757eb97518916 /frontend | |
parent | Frontend: Fetch results from indexer (diff) | |
download | OSSE-02333e4a1ca6f1e260693b0bf6b580d5844fcb92.tar.gz OSSE-02333e4a1ca6f1e260693b0bf6b580d5844fcb92.tar.bz2 OSSE-02333e4a1ca6f1e260693b0bf6b580d5844fcb92.zip |
Frontend: Use display_results() function for rendering CrawledResources
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/src/main.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/frontend/src/main.rs b/frontend/src/main.rs index 26fb7e4..fd28d89 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -42,6 +42,19 @@ fn osse() -> Html { results: vec![], }); + let display_results = |results: &Vec<CrawledResource>| -> Html { + results + .into_iter() + .map(|r| { + html! { + <div key={r.url.to_owned()}> + <a href={r.url.to_owned()}>{r.url.to_owned()}{"--"}{r.priority}</a> + </div> + } + }) + .collect::<Html>() + }; + let search_query_changed = { let cloned_state = state.clone(); Callback::from(move |event: InputEvent| { @@ -112,11 +125,7 @@ fn osse() -> Html { </div> </form> <section> - {curr_state.results.into_iter().map(|r| { - html!{ - <div key={r.url.to_owned()}>{ format!("Result: {:?}!", r) }</div> - } - }).collect::<Html>()} + {display_results(&curr_state.results)} </section> </div> </div> |