From e0117b290510bf0f5182b906d183c2dd7b7f66c0 Mon Sep 17 00:00:00 2001 From: Vinod J M Date: Sat, 14 Jan 2023 17:00:38 +0530 Subject: [PATCH] Load more fixes --- frontend/src/main.rs | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/frontend/src/main.rs b/frontend/src/main.rs index c7527f2..dad01da 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -837,14 +837,18 @@ async fn ListDB(cx: Scope<'_>) -> View { 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 = 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(cx: Scope<'_>) -> View { }, 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(cx: Scope<'_>) -> View { }, 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, ""} - }) + } }