v0.10-frontend-worksish

This commit is contained in:
2022-10-31 13:41:10 +05:30
parent cae044c830
commit 06af646ad4
3 changed files with 47 additions and 42 deletions

View File

@@ -255,23 +255,23 @@ pub fn BookOL<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
async fn AddingUI<G: Html>(cx: Scope<'_>) -> View<G> {
let app_state = use_context::<AppState>(cx);
let inp_title = create_signal(cx, String::new());
let inp_olkey = create_signal(cx, String::new());
let inp_editioncount = create_signal(cx, String::new());
let inp_publishyear = create_signal(cx, String::new());
let inp_medianpage = create_signal(cx, String::new());
let inp_goodread = create_signal(cx, String::new());
let inp_desc = create_signal(cx, String::new());
let inp_cover = create_signal(cx, String::new());
let inp_location = create_signal(cx, String::new());
let inp_rating = create_signal(cx, String::new());
let inp_comments = create_signal(cx, String::new());
let inp_author = create_signal(cx, String::new());
let inp_person = create_signal(cx, String::new());
let inp_place = create_signal(cx, String::new());
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 inp_title = create_signal(cx, (*app_state.addingbook.get()).clone().title);
let inp_olkey = create_signal(cx, (*app_state.addingbook.get()).clone().open_library_key.unwrap_or("".to_string()));
let inp_editioncount = create_signal(cx, (*app_state.addingbook.get()).clone().edition_count.unwrap_or(0).to_string());
let inp_publishyear = create_signal(cx, (*app_state.addingbook.get()).clone().first_publish_year.unwrap_or(0).to_string());
let inp_medianpage = create_signal(cx, (*app_state.addingbook.get()).clone().median_page_count.unwrap_or(0).to_string());
let inp_goodread = create_signal(cx, (*app_state.addingbook.get()).clone().goodread_id.unwrap_or("".to_string()));
let inp_desc = create_signal(cx, (*app_state.addingbook.get()).clone().description.unwrap_or("".to_string()));
let inp_cover = create_signal(cx, (*app_state.addingbook.get()).clone().cover.unwrap_or("".to_string()));
let inp_location = create_signal(cx, (*app_state.addingbook.get()).clone().location.unwrap_or("".to_string()));
let inp_rating = create_signal(cx, (*app_state.addingbook.get()).clone().location.unwrap_or("".to_string()));
let inp_comments = create_signal(cx, (*app_state.addingbook.get()).clone().comments.unwrap_or("".to_string()));
let inp_author = create_signal(cx, (*app_state.addingbook.get()).clone().author_name.unwrap_or(vec!["".to_string()]).join(", "));
let inp_person = create_signal(cx, (*app_state.addingbook.get()).clone().person.unwrap_or(vec!["".to_string()]).join(", "));
let inp_place = create_signal(cx, (*app_state.addingbook.get()).clone().place.unwrap_or(vec!["".to_string()]).join(", "));
let inp_subject = create_signal(cx, (*app_state.addingbook.get()).clone().subject.unwrap_or(vec!["".to_string()]).join(", "));
let inp_time = create_signal(cx, (*app_state.addingbook.get()).clone().time.unwrap_or(vec!["".to_string()]).join(", "));
let inp_isbn = create_signal(cx, (*app_state.addingbook.get()).clone().isbn.unwrap_or(vec!["".to_string()]).join(", "));
let handle_add = |_| {
info!("Adding book");
@@ -316,23 +316,23 @@ info!("Adding book");
p {
(if *app_state.adding.get() == true {
view!{ cx,
input(bind:value=inp_title, placeholder="Title" ,value = (*app_state.addingbook.get()).clone().title)
input(bind:value=inp_olkey, placeholder="OpenLibrary Key" ,value= (*app_state.addingbook.get()).clone().open_library_key.unwrap_or("".to_string()))
input(bind:value=inp_editioncount, placeholder="Number of editions" ,value= (*app_state.addingbook.get()).clone().edition_count.unwrap_or(0).to_string())
input(bind:value=inp_publishyear, placeholder="First publish year" ,value= (*app_state.addingbook.get()).clone().first_publish_year.unwrap_or(0).to_string())
input(bind:value=inp_medianpage, placeholder="Page count" ,value= (*app_state.addingbook.get()).clone().median_page_count.unwrap_or(0).to_string())
input(bind:value=inp_goodread, placeholder="GoodRead ID" ,value= (*app_state.addingbook.get()).clone().goodread_id.unwrap_or("".to_string()))
input(bind:value=inp_desc, placeholder="Description" ,value= (*app_state.addingbook.get()).clone().description.unwrap_or("".to_string()))
input(bind:value=inp_cover, placeholder="Cover URL" ,value= (*app_state.addingbook.get()).clone().cover.unwrap_or("".to_string()))
input(bind:value=inp_location, placeholder="Location" ,value= (*app_state.addingbook.get()).clone().location.unwrap_or("".to_string()))
input(bind:value=inp_rating, placeholder="Rating (/10)" ,value= (*app_state.addingbook.get()).clone().rating.unwrap_or(0).to_string())
input(bind:value=inp_comments, placeholder="Comments" ,value= (*app_state.addingbook.get()).clone().comments.unwrap_or("".to_string()))
input(bind:value=inp_author, placeholder="Authors" ,value=(*app_state.addingbook.get()).clone().author_name.unwrap_or(vec!["".to_string()]).join(", "))
input(bind:value=inp_person, placeholder="Persons" ,value=(*app_state.addingbook.get()).clone().person.unwrap_or(vec!["".to_string()]).join(", "))
input(bind:value=inp_place, placeholder="Places" ,value=(*app_state.addingbook.get()).clone().place.unwrap_or(vec!["".to_string()]).join(", "))
input(bind:value=inp_subject, placeholder="Subjects" ,value=(*app_state.addingbook.get()).clone().subject.unwrap_or(vec!["".to_string()]).join(", "))
input(bind:value=inp_time, placeholder="Times" ,value=(*app_state.addingbook.get()).clone().time.unwrap_or(vec!["".to_string()]).join(", "))
input(bind:value=inp_isbn, placeholder="ISBNs" ,value=(*app_state.addingbook.get()).clone().isbn.unwrap_or(vec!["".to_string()]).join(", "))
input(bind:value=inp_title, placeholder="Title" )
input(bind:value=inp_olkey, placeholder="OpenLibrary Key" )
input(bind:value=inp_editioncount, placeholder="Number of editions" )
input(bind:value=inp_publishyear, placeholder="First publish year" )
input(bind:value=inp_medianpage, placeholder="Page count" )
input(bind:value=inp_goodread, placeholder="GoodRead ID" )
input(bind:value=inp_desc, placeholder="Description" )
input(bind:value=inp_cover, placeholder="Cover URL" )
input(bind:value=inp_location, placeholder="Location" )
input(bind:value=inp_rating, placeholder="Rating (/10)" )
input(bind:value=inp_comments, placeholder="Comments" )
input(bind:value=inp_author, placeholder="Authors")
input(bind:value=inp_person, placeholder="Persons" )
input(bind:value=inp_place, placeholder="Places" )
input(bind:value=inp_subject, placeholder="Subjects" )
input(bind:value=inp_time, placeholder="Times" )
input(bind:value=inp_isbn, placeholder="ISBNs" )
button(class="add", on:click=handle_add){ "Add book to DB" }
}
} else {