Backend and frontend fixes
This commit is contained in:
@@ -291,6 +291,8 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
app_state.search.set(task);
|
||||
app_state.openlibrary.set(false);
|
||||
app_state.internalsearch.set(true);
|
||||
app_state.pagenum.set(1);
|
||||
app_state.pagedisplay.set(1);
|
||||
app_state.refreshing.set(true);
|
||||
info!("Fetching search 2\n");
|
||||
}
|
||||
@@ -300,6 +302,8 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
let click_listall = |_| {
|
||||
app_state.openlibrary.set(false);
|
||||
app_state.internalsearch.set(false);
|
||||
app_state.pagenum.set(1);
|
||||
app_state.pagedisplay.set(1);
|
||||
app_state.refreshing.set(true);
|
||||
};
|
||||
|
||||
@@ -432,7 +436,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
(if *app_state.editmode.get() == true {
|
||||
view!{ cx,
|
||||
|
||||
div(class="w-1/2 flex"){
|
||||
div(class="w-2/5 flex"){
|
||||
(if *app_state.userid.get() != 0 {
|
||||
view!{ cx,
|
||||
button(on:click=click_listall, class="bg-gray-300 hover:bg-gray-200 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center") { i(class="fa-solid fa-layer-group") span(class="inline-block"){"All" }}
|
||||
@@ -447,7 +451,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
view!{cx, ""}
|
||||
})
|
||||
}
|
||||
div(class="w-1/2 flex"){
|
||||
div(class="w-2/5 flex"){
|
||||
button(on:click=click_addbook, class="bg-gray-300 hover:bg-gray-200 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center") { i(class="fa-solid fa-circle-plus") span(class="inline-block"){"Add" }}
|
||||
//button(on:click=click_addbook) { "+ Add New" }
|
||||
//input(ref=input_ref3,
|
||||
@@ -469,6 +473,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
view!{cx,
|
||||
(if *app_state.userid.get() != 0 {
|
||||
view!{ cx,
|
||||
div(class="w-2/5 flex"){
|
||||
button(on:click=click_listall, class="bg-gray-300 hover:bg-gray-200 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center") { i(class="fa-solid fa-layer-group") span(class="inline-block"){"All" }}
|
||||
div(class="min-w-40 inline-flex"){
|
||||
input(ref=input_ref2,
|
||||
@@ -477,7 +482,9 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
||||
bind:value=value2,
|
||||
on:keyup=handle_submit_seachall,
|
||||
)}
|
||||
}} else {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
view!{cx, ""}
|
||||
})
|
||||
}
|
||||
@@ -794,7 +801,8 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
let mut currbooks = (*app_state_scr.clone().books.get()).clone();
|
||||
currbooks.extend(res.books.iter().cloned());
|
||||
app_state_scr.books.set(currbooks);
|
||||
app_state_scr.maxpage.set(res.num_pages)
|
||||
app_state_scr.maxpage.set(res.num_pages);
|
||||
app_state_scr.scrolling.set(false);
|
||||
});
|
||||
} else {
|
||||
info!("IntSearch triggered2");
|
||||
@@ -810,10 +818,10 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
let mut currbooks = (*app_state_scr.clone().books.get()).clone();
|
||||
currbooks.extend(res.books.iter().cloned());
|
||||
app_state_scr.books.set(currbooks);
|
||||
app_state_scr.maxpage.set(res.num_pages)
|
||||
app_state_scr.maxpage.set(res.num_pages);
|
||||
app_state_scr.scrolling.set(false);
|
||||
});
|
||||
}
|
||||
app_state.scrolling.set(false);
|
||||
}
|
||||
} else {
|
||||
//info!("LibrarySearch triggered?");
|
||||
@@ -837,7 +845,7 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
|
||||
let handle_load_more = move |_| {
|
||||
let app_state = app_state.clone();
|
||||
if *app_state.scrolling.get() == true {
|
||||
if *app_state.scrolling.get() == false {
|
||||
app_state.scrollevent.set(true);
|
||||
}
|
||||
};
|
||||
@@ -846,7 +854,7 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
//let csignal = csignal.clone();
|
||||
//csignal.set(true);
|
||||
let app_state2 = app_state2.clone();
|
||||
if *app_state2.scrolling.get() == true {
|
||||
if *app_state2.scrolling.get() == false {
|
||||
app_state2.scrollevent.set(true);
|
||||
}
|
||||
info!("Got scroll event");
|
||||
@@ -879,13 +887,21 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
key =|x| x.id )
|
||||
}
|
||||
br{}
|
||||
(if *app_state.maxpage.get() > 1 && *app_state.maxpage.get() > *app_state.pagedisplay.get() {
|
||||
(if *app_state.scrolling.get() == true {
|
||||
view!{ cx,
|
||||
div(class="flex flex-col items-center"){
|
||||
button(class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center",on:click=handle_load_more){ "Load More" }
|
||||
div(class="flex flex-col items-center m-5"){
|
||||
div(class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center"){ "Loading ..." }
|
||||
}
|
||||
}} else {
|
||||
view!{ cx, ""}
|
||||
view!{ cx,
|
||||
(if *app_state.maxpage.get() > 1 && *app_state.maxpage.get() > *app_state.pagedisplay.get() {
|
||||
view!{ cx,
|
||||
div(class="flex flex-col items-center m-5"){
|
||||
button(class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center",on:click=handle_load_more){ "Load More" }
|
||||
}
|
||||
}} else {
|
||||
view!{ cx, ""}
|
||||
})}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -901,13 +917,22 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
||||
key =|x| x.id )
|
||||
}
|
||||
br{}
|
||||
(if *app_state.maxpage.get() > 1 && *app_state.maxpage.get() > *app_state.pagedisplay.get() {
|
||||
|
||||
(if *app_state.scrolling.get() == true {
|
||||
view!{ cx,
|
||||
div(class="flex flex-col items-center"){
|
||||
button(class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center",on:click=handle_load_more){ "Load More" }
|
||||
div(class="flex flex-col items-center m-5"){
|
||||
div(class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center"){ "Loading ..." }
|
||||
}
|
||||
}} else {
|
||||
view!{ cx, ""}
|
||||
view!{ cx,
|
||||
(if *app_state.maxpage.get() > 1 && *app_state.maxpage.get() > *app_state.pagedisplay.get() {
|
||||
view!{ cx,
|
||||
div(class="flex flex-col items-center m-5"){
|
||||
button(class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center",on:click=handle_load_more){ "Load More" }
|
||||
}
|
||||
}} else {
|
||||
view!{ cx, ""}
|
||||
})}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -941,7 +966,7 @@ pub fn BookDB<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
||||
.description
|
||||
.unwrap_or("".to_string());
|
||||
let locloc = bookitem.bookitem.clone().location.unwrap_or("".to_string());
|
||||
if locdesc.clone().len() > 200 {
|
||||
if locdesc.clone().chars().count() > 200 {
|
||||
locdesc = format!("{:.200}...", locdesc.clone())
|
||||
}
|
||||
//let locref = create_rc_signal(false);
|
||||
@@ -1038,7 +1063,7 @@ pub fn BookDB_View<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
||||
.description
|
||||
.unwrap_or("".to_string());
|
||||
let locloc = bookitem.bookitem.clone().location.unwrap_or("".to_string());
|
||||
if locdesc.clone().len() > 200 {
|
||||
if locdesc.clone().chars().count() > 200 {
|
||||
locdesc = format!("{:.200}...", locdesc.clone())
|
||||
}
|
||||
|
||||
@@ -1060,7 +1085,7 @@ pub fn BookDB_View<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
||||
app_state.displayingbook.set(bookdisplay_div.clone());
|
||||
};
|
||||
view! { cx,
|
||||
div(class="col-span-1 px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3"){
|
||||
div(class="col-span-1 px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3", on:click=handle_display_div){
|
||||
|
||||
|
||||
div(class="card-buttons"){
|
||||
@@ -1068,7 +1093,7 @@ pub fn BookDB_View<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
||||
button( class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 border-black-500 rounded inline-flex items-center", on:click=handle_display){ i(class="fa-solid fa-circle-info") }
|
||||
|
||||
}
|
||||
div(class="card-main", on:click=handle_display_div){
|
||||
div(class="card-main"){
|
||||
img(class="float-right m-1",src=coverurl,width="100")
|
||||
|
||||
div(class="card-title font-bold text-lg"){
|
||||
@@ -2226,7 +2251,6 @@ fn App<G: Html>(cx: Scope) -> View<G> {
|
||||
ListOL {}
|
||||
ListDB{}
|
||||
}
|
||||
//PageBar{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user