v0.10-frontend-compiles
This commit is contained in:
@@ -153,7 +153,6 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
p {
|
||||
(if *app_state.openlibrary.get() == false {
|
||||
view!{ cx,
|
||||
//span {(app_state.books.get().num_found)}
|
||||
ul {
|
||||
Keyed(
|
||||
iterable=docs,
|
||||
@@ -208,7 +207,6 @@ async fn ListOL<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
});
|
||||
|
||||
let docs = create_memo(cx, || app_state.books.get().iter().cloned().collect::<Vec<_>>());
|
||||
//let docs = create_signal(cx, vec![1, 2]);
|
||||
view! {cx,
|
||||
p {
|
||||
(if *app_state.openlibrary.get() == true {
|
||||
@@ -272,46 +270,27 @@ let inp_subject = create_signal(cx, String::new());
|
||||
let inp_time = create_signal(cx, String::new());
|
||||
let inp_isbn = create_signal(cx, String::new());
|
||||
|
||||
let addingbook = app_state.addingbook.get().clone();
|
||||
let pl_title = addingbook.title;
|
||||
let pl_olkey = addingbook.open_library_key.unwrap_or("".to_string());
|
||||
let pl_edition = addingbook.edition_count.unwrap_or(0).to_string();
|
||||
let pl_publishyear = addingbook.first_publish_year.unwrap_or(0).to_string();
|
||||
let pl_medianpage = addingbook.median_page_count.unwrap_or(0).to_string();
|
||||
let pl_goodread = addingbook.goodread_id.unwrap_or("".to_string());
|
||||
let pl_desc = addingbook.description.unwrap_or("".to_string());
|
||||
let pl_cover = addingbook.cover.unwrap_or("".to_string());
|
||||
let pl_location = addingbook.location.unwrap_or("".to_string());
|
||||
let pl_rating = addingbook.rating.unwrap_or(0).to_string();
|
||||
let pl_comment = addingbook.comments.unwrap_or("".to_string());
|
||||
let pl_author = addingbook.author_name.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
let pl_person = addingbook.person.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
let pl_place = addingbook.place.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
let pl_subject = addingbook.subject.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
let pl_time = addingbook.time.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
let pl_isbn = addingbook.isbn.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
|
||||
let handle_add = |_| {
|
||||
let authors: Vec<String> = *inp_author.get().split(",").map(|x| x.trim().to_string()).collect::<Vec<String>>();
|
||||
let persons: Vec<String> = *inp_person.get().split(",").map(str::to_string).collect::<Vec<String>>();
|
||||
let places: Vec<String> = *inp_place.get().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let subjects: Vec<String> = *inp_subject.get().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let times: Vec<String> = *inp_time.get().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let isbns: Vec<String> = *inp_isbn.get().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let authors: Vec<String> = (*inp_author.get()).clone().split(",").map(str::to_string).collect::<Vec<String>>();
|
||||
let persons: Vec<String> = (*inp_person.get()).clone().split(",").map(str::to_string).collect::<Vec<String>>();
|
||||
let places: Vec<String> = (*inp_place.get()).clone().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let subjects: Vec<String> = (*inp_subject.get()).clone().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let times: Vec<String> = (*inp_time.get()).clone().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let isbns: Vec<String> = (*inp_isbn.get()).clone().split(",").map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let record : BookUI = BookUI{
|
||||
id: 1,
|
||||
title: *inp_title.get(),
|
||||
open_library_key: Some(*inp_olkey.get()),
|
||||
title: (*inp_title.get()).clone(),
|
||||
open_library_key: Some((*inp_olkey.get()).clone()),
|
||||
edition_count: Some(inp_editioncount.get().parse::<i32>().unwrap()),
|
||||
first_publish_year: Some(inp_publishyear.get().parse::<i32>().unwrap()),
|
||||
median_page_count: Some(inp_medianpage.get().parse::<i32>().unwrap()),
|
||||
goodread_id: Some(*inp_goodread.get()),
|
||||
description: Some(*inp_desc.get().clone()),
|
||||
cover: Some(*inp_cover.get().clone()),
|
||||
location: Some(*inp_location.get().clone()),
|
||||
goodread_id: Some((*inp_goodread.get()).clone()),
|
||||
description: Some((*inp_desc.get()).clone()),
|
||||
cover: Some((*inp_cover.get()).clone()),
|
||||
location: Some((*inp_location.get()).clone()),
|
||||
time_added: Some("NA".to_string()),
|
||||
rating: Some(inp_rating.get().parse::<i32>().unwrap()),
|
||||
comments: Some(*inp_comments.get().clone()),
|
||||
comments: Some((*inp_comments.get()).clone()),
|
||||
author_name: Some(authors),
|
||||
person: Some(persons),
|
||||
place: Some(places),
|
||||
@@ -333,23 +312,23 @@ let pl_isbn = addingbook.isbn.unwrap_or(vec!["".to_string()]).join(", ");
|
||||
(if *app_state.adding.get() == true {
|
||||
view!{ cx,
|
||||
"Hello"
|
||||
input(bind:value=inp_title, placeholder=pl_title)
|
||||
input(bind:value=inp_olkey, placeholder=pl_olkey)
|
||||
input(bind:value=inp_editioncount, placeholder=pl_edition)
|
||||
input(bind:value=inp_publishyear, placeholder=pl_publishyear)
|
||||
input(bind:value=inp_medianpage, placeholder=pl_medianpage)
|
||||
input(bind:value=inp_goodread, placeholder=pl_goodread)
|
||||
input(bind:value=inp_desc, placeholder=pl_desc)
|
||||
input(bind:value=inp_cover, placeholder=pl_cover)
|
||||
input(bind:value=inp_location, placeholder=pl_location)
|
||||
input(bind:value=inp_rating, placeholder=pl_rating)
|
||||
input(bind:value=inp_comments, placeholder=pl_comment)
|
||||
input(bind:value=inp_author, placeholder=pl_author)
|
||||
input(bind:value=inp_person, placeholder=pl_person)
|
||||
input(bind:value=inp_place, placeholder=pl_place)
|
||||
input(bind:value=inp_subject, placeholder=pl_subject)
|
||||
input(bind:value=inp_time, placeholder=pl_time)
|
||||
input(bind:value=inp_isbn, placeholder=pl_isbn)
|
||||
input(bind:value=inp_title, placeholder= (*app_state.addingbook.get()).clone().title)
|
||||
input(bind:value=inp_olkey, placeholder= (*app_state.addingbook.get()).clone().open_library_key.unwrap_or("".to_string()))
|
||||
input(bind:value=inp_editioncount, placeholder= (*app_state.addingbook.get()).clone().edition_count.unwrap_or(0).to_string())
|
||||
input(bind:value=inp_publishyear, placeholder= (*app_state.addingbook.get()).clone().first_publish_year.unwrap_or(0).to_string())
|
||||
input(bind:value=inp_medianpage, placeholder= (*app_state.addingbook.get()).clone().median_page_count.unwrap_or(0).to_string())
|
||||
input(bind:value=inp_goodread, placeholder= (*app_state.addingbook.get()).clone().goodread_id.unwrap_or("".to_string()))
|
||||
input(bind:value=inp_desc, placeholder= (*app_state.addingbook.get()).clone().description.unwrap_or("".to_string()))
|
||||
input(bind:value=inp_cover, placeholder= (*app_state.addingbook.get()).clone().cover.unwrap_or("".to_string()))
|
||||
input(bind:value=inp_location, placeholder= (*app_state.addingbook.get()).clone().location.unwrap_or("".to_string()))
|
||||
input(bind:value=inp_rating, placeholder= (*app_state.addingbook.get()).clone().rating.unwrap_or(0).to_string())
|
||||
input(bind:value=inp_comments, placeholder= (*app_state.addingbook.get()).clone().comments.unwrap_or("".to_string()))
|
||||
input(bind:value=inp_author, placeholder=(*app_state.addingbook.get()).clone().author_name.unwrap_or(vec!["".to_string()]).join(", "))
|
||||
input(bind:value=inp_person, placeholder=(*app_state.addingbook.get()).clone().person.unwrap_or(vec!["".to_string()]).join(", "))
|
||||
input(bind:value=inp_place, placeholder=(*app_state.addingbook.get()).clone().place.unwrap_or(vec!["".to_string()]).join(", "))
|
||||
input(bind:value=inp_subject, placeholder=(*app_state.addingbook.get()).clone().subject.unwrap_or(vec!["".to_string()]).join(", "))
|
||||
input(bind:value=inp_time, placeholder=(*app_state.addingbook.get()).clone().time.unwrap_or(vec!["".to_string()]).join(", "))
|
||||
input(bind:value=inp_isbn, placeholder=(*app_state.addingbook.get()).clone().isbn.unwrap_or(vec!["".to_string()]).join(", "))
|
||||
button(class="add", on:click=handle_add){ "Add book to DB" }
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user