Load more fixes

This commit is contained in:
2023-01-14 17:00:38 +05:30
parent 6a134d8128
commit e0117b2905

View File

@@ -837,14 +837,18 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
let handle_load_more = move |_| {
let app_state = app_state.clone();
app_state.scrollevent.set(true);
if *app_state.scrolling.get() == true {
app_state.scrollevent.set(true);
}
};
let callback: Closure<dyn FnMut()> = Closure::new(move || {
//let csignal = csignal.clone();
//csignal.set(true);
let app_state2 = app_state2.clone();
app_state2.scrollevent.set(true);
if *app_state2.scrolling.get() == true {
app_state2.scrollevent.set(true);
}
info!("Got scroll event");
});
@@ -874,6 +878,15 @@ 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() {
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" }
}
}} else {
view!{ cx, ""}
})
}
} else if *app_state.openlibrary.get() == false && *app_state.editmode.get() == true {
@@ -887,21 +900,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() {
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" }
}
}} else {
view!{ cx, ""}
})
}
} else {
view!{cx, ""}
}
)
br{}
(if *app_state.maxpage.get() > 1 && *app_state.maxpage.get() > *app_state.pagedisplay.get() {
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" }
}
}} else {
view!{ cx, ""}
})
}
}