|
|
|
@@ -139,7 +139,14 @@ async fn list_users() -> Result<HashMap<String, i32>, reqwasm::Error> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(res)
|
|
|
|
Ok(res)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
async fn refresh_index() -> Result<reqwasm::http::Response, reqwasm::Error> {
|
|
|
|
|
|
|
|
let backend_url: &'static str = dotenv!("BACKEND_URL");
|
|
|
|
|
|
|
|
let url = format!("{}/api/refresh_search_index", backend_url);
|
|
|
|
|
|
|
|
let resp = Request::get(&url).send().await?;
|
|
|
|
|
|
|
|
Ok(resp)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
async fn authentication_check() -> Result<bool, reqwasm::Error> {
|
|
|
|
async fn authentication_check() -> Result<bool, reqwasm::Error> {
|
|
|
|
let backend_url: &'static str = dotenv!("BACKEND_URL");
|
|
|
|
let backend_url: &'static str = dotenv!("BACKEND_URL");
|
|
|
|
let url = format!("{}/api/authentication_check", backend_url);
|
|
|
|
let url = format!("{}/api/authentication_check", backend_url);
|
|
|
|
@@ -408,7 +415,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
|
|
|
|
|
|
|
|
|
|
|
div(class="w-4/5 md:w-4/5 flex mb-2"){
|
|
|
|
div(class="w-4/5 md:w-4/5 flex mb-2"){
|
|
|
|
|
|
|
|
|
|
|
|
div(class="hidden md:inline-flex"){
|
|
|
|
div(class="hidden md:flex md:w-full"){
|
|
|
|
|
|
|
|
|
|
|
|
div(class="w-1/5 flex"){
|
|
|
|
div(class="w-1/5 flex"){
|
|
|
|
(if *app_state.editmode.get() == false {
|
|
|
|
(if *app_state.editmode.get() == false {
|
|
|
|
@@ -473,9 +480,9 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
|
|
|
view!{cx,
|
|
|
|
view!{cx,
|
|
|
|
(if *app_state.userid.get() != 0 {
|
|
|
|
(if *app_state.userid.get() != 0 {
|
|
|
|
view!{ cx,
|
|
|
|
view!{ cx,
|
|
|
|
div(class="w-2/5 flex"){
|
|
|
|
div(class="w-4/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" }}
|
|
|
|
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"){
|
|
|
|
div(class="min-w-100 inline-flex"){
|
|
|
|
input(ref=input_ref2,
|
|
|
|
input(ref=input_ref2,
|
|
|
|
class = "inline-flex h-full m-0 p-1 w-full",
|
|
|
|
class = "inline-flex h-full m-0 p-1 w-full",
|
|
|
|
placeholder="🔍 Search",
|
|
|
|
placeholder="🔍 Search",
|
|
|
|
@@ -490,7 +497,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
div(class="inline-flex md:hidden w-full"){
|
|
|
|
div(class="inline-flex w-full md:hidden md:w-0"){
|
|
|
|
button(on:click=click_menu_expand, 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-bars") }
|
|
|
|
button(on:click=click_menu_expand, 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-bars") }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -850,17 +857,20 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let window = web_sys::window().expect("Failed to get window");
|
|
|
|
|
|
|
|
let window_cl = window.clone();
|
|
|
|
let callback: Closure<dyn FnMut()> = Closure::new(move || {
|
|
|
|
let callback: Closure<dyn FnMut()> = Closure::new(move || {
|
|
|
|
//let csignal = csignal.clone();
|
|
|
|
//let csignal = csignal.clone();
|
|
|
|
//csignal.set(true);
|
|
|
|
//csignal.set(true);
|
|
|
|
let app_state2 = app_state2.clone();
|
|
|
|
let app_state2 = app_state2.clone();
|
|
|
|
if *app_state2.scrolling.get() == false {
|
|
|
|
if *app_state2.scrolling.get() == false {
|
|
|
|
app_state2.scrollevent.set(true);
|
|
|
|
if window_cl.inner_height().unwrap().as_f64().unwrap() + window_cl.scroll_y().unwrap() >= window_cl.document().unwrap().body().unwrap().offset_height().into() {
|
|
|
|
|
|
|
|
app_state2.scrollevent.set(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
info!("Got scroll event");
|
|
|
|
info!("Got scroll event");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let window = web_sys::window().expect("Failed to get window");
|
|
|
|
|
|
|
|
window
|
|
|
|
window
|
|
|
|
.add_event_listener_with_callback_and_bool(
|
|
|
|
.add_event_listener_with_callback_and_bool(
|
|
|
|
"scroll",
|
|
|
|
"scroll",
|
|
|
|
@@ -1013,7 +1023,7 @@ pub fn BookDB<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
|
|
|
app_state.displayingbook.set(bookdisplay_div.clone());
|
|
|
|
app_state.displayingbook.set(bookdisplay_div.clone());
|
|
|
|
};
|
|
|
|
};
|
|
|
|
view! { cx,
|
|
|
|
view! { cx,
|
|
|
|
div(class="column px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3"){
|
|
|
|
div(class="column px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3 hover:scale-110"){
|
|
|
|
|
|
|
|
|
|
|
|
div(class="card-buttons flex gap-x-3"){
|
|
|
|
div(class="card-buttons flex gap-x-3"){
|
|
|
|
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") }
|
|
|
|
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") }
|
|
|
|
@@ -1085,7 +1095,7 @@ pub fn BookDB_View<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
|
|
|
app_state.displayingbook.set(bookdisplay_div.clone());
|
|
|
|
app_state.displayingbook.set(bookdisplay_div.clone());
|
|
|
|
};
|
|
|
|
};
|
|
|
|
view! { cx,
|
|
|
|
view! { cx,
|
|
|
|
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="col-span-1 px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3 hover:scale-110", on:click=handle_display_div){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
div(class="card-buttons"){
|
|
|
|
div(class="card-buttons"){
|
|
|
|
@@ -1185,7 +1195,7 @@ pub fn BookOL<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
|
|
|
|
app_state.addingbook.set(book_div.clone());
|
|
|
|
app_state.addingbook.set(book_div.clone());
|
|
|
|
};
|
|
|
|
};
|
|
|
|
view! { cx,
|
|
|
|
view! { cx,
|
|
|
|
div(class="column px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3",on:click=handle_add_div){
|
|
|
|
div(class="column px-4 py-4 bg-gray-200 border-2 border-gray-400 rounded m-3 hover:scale-110",on:click=handle_add_div){
|
|
|
|
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_add){ i(class="fa-solid fa-plus") }
|
|
|
|
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_add){ i(class="fa-solid fa-plus") }
|
|
|
|
|
|
|
|
|
|
|
|
div(class="card-main"){
|
|
|
|
div(class="card-main"){
|
|
|
|
@@ -1991,7 +2001,17 @@ async fn PageBar<G: Html>(cx: Scope<'_>) -> View<G> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
let handle_refresh = move |_| {
|
|
|
|
|
|
|
|
spawn_local(async move {
|
|
|
|
|
|
|
|
refresh_index().await.expect("Couldn't refresh index");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
|
|
view! {cx,
|
|
|
|
view! {cx,
|
|
|
|
|
|
|
|
//button( class="bg-gray-300 hover:bg-gray-200 text-gray-800 font-bold px-4 rounded inline-flex items-center", on:click=handle_refresh) {"REFRESH"}
|
|
|
|
|
|
|
|
|
|
|
|
(if (*app_state.openlibrary.get() == false || *app_state.internalsearch.get() == true) && !app_state.books.get().is_empty() {
|
|
|
|
(if (*app_state.openlibrary.get() == false || *app_state.internalsearch.get() == true) && !app_state.books.get().is_empty() {
|
|
|
|
view!{ cx,
|
|
|
|
view!{ cx,
|
|
|
|
div(class="bg-gray-300 text-gray-800 font-bold px-1 rounded inline-flex items-center w-max"){
|
|
|
|
div(class="bg-gray-300 text-gray-800 font-bold px-1 rounded inline-flex items-center w-max"){
|
|
|
|
|