v0.15-WORKINGV2

This commit is contained in:
2022-12-04 10:12:17 +05:30
parent f54cdd82fb
commit 32fb36623b
3 changed files with 39 additions and 28 deletions

View File

@@ -89,45 +89,39 @@ body {
.card { .card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); /* this adds the "card" effect */ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); /* this adds the "card" effect */
padding: 16px; padding: 16px;
text-align: center; text-align: left;
height: 400px; height: 400px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
background-color: #f1f1f1; background-color: #f1f1f1;
#content img {
position: absolute;
top: 0px;
right: 0px;
}
} }
/* Style the counter cards */ /* Style the counter cards */
.card-openlibrary { .card-openlibrary {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); /* this adds the "card" effect */ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); /* this adds the "card" effect */
padding: 16px; padding: 16px;
text-align: center; text-align: left;
height: 200px; height: 200px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
background-color: #f1f1f1; background-color: #f1f1f1;
#content img {
position: absolute;
top: 0px;
right: 0px;
} }
.card img {
float: right;
width: 100px;
padding: 0 20px 20px 0;
} }
/*
.card-image { .card-openlibrary img {
padding: 16px; float: right;
position: relative; width: 100px;
top: 0px; padding: 0 20px 20px 0;
right: 0px;
width: 40%;
} }
*/
.card-title { .card-title {
padding: 16px; padding: 16px;
float: left;
text-align: left; text-align: left;
width: 60%; width: 60%;
font-weight: bold; font-weight: bold;
@@ -136,12 +130,17 @@ body {
.card-authors { .card-authors {
padding: 16px; padding: 16px;
float: left;
text-align: left; text-align: left;
width: 60%; width: 60%;
font-size: large; font-size: large;
} }
.card-desc {
padding: 2px;
text-align: left;
width: 100%;
}
.input-field { .input-field {
padding: 4px; padding: 4px;
@@ -208,4 +207,8 @@ body {
.main { .main {
margin-top: 80px; /* Add a top margin to avoid content overlay */ margin-top: 80px; /* Add a top margin to avoid content overlay */
} }
.input-field {
width: 100%;
}
} }

View File

@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;,"> <link rel="shortcut icon" type="image/x-icon" href="data:image/x-icon;,">
<link data-trunk rel="inline" href="css/index.css" /> <link data-trunk rel="css" href="css/index.css" />
<base data-trunk-public-url/> <base data-trunk-public-url/>
<title>Book Manager</title> <title>Book Manager</title>
</head> </head>

View File

@@ -167,6 +167,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
app_state.internalsearch.set(false); app_state.internalsearch.set(false);
info!("Fetching search {}\n", task.clone()); info!("Fetching search {}\n", task.clone());
app_state.books.set(Vec::new());
value.set("".to_string()); value.set("".to_string());
input_ref input_ref
.get::<DomNode>() .get::<DomNode>()
@@ -188,7 +189,7 @@ pub fn Header<G: Html>(cx: Scope) -> View<G> {
app_state.search.set(task); app_state.search.set(task);
app_state.openlibrary.set(false); app_state.openlibrary.set(false);
app_state.internalsearch.set(true); app_state.internalsearch.set(true);
app_state.books.set(Vec::new());
info!("Fetching search 2\n"); info!("Fetching search 2\n");
} }
} }
@@ -310,7 +311,6 @@ async fn ListDB<G: Html>(cx: Scope<'_>) -> View<G> {
app_state.openlibrary.track(); app_state.openlibrary.track();
app_state.internalsearch.track(); app_state.internalsearch.track();
app_state.refreshing.track(); app_state.refreshing.track();
app_state.pagenum.track();
info!( info!(
"The state changed. New value: {}", "The state changed. New value: {}",
@@ -391,6 +391,8 @@ pub fn BookDB<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
let loctitle = bookitem.bookitem.clone().title.clone(); let loctitle = bookitem.bookitem.clone().title.clone();
let locauthors = bookitem.bookitem.clone().author_name.clone().unwrap_or(vec!["".to_string()]).join(", "); let locauthors = bookitem.bookitem.clone().author_name.clone().unwrap_or(vec!["".to_string()]).join(", ");
let locdesc = bookitem.bookitem.clone().description.unwrap_or("".to_string()); let locdesc = bookitem.bookitem.clone().description.unwrap_or("".to_string());
let locloc = bookitem.bookitem.clone().location.unwrap_or("".to_string());
let coverurl = bookdisplay.clone().cover.clone().unwrap_or("None".to_string()); let coverurl = bookdisplay.clone().cover.clone().unwrap_or("None".to_string());
@@ -427,6 +429,7 @@ pub fn BookDB<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
button(class="info", on:click=handle_display){ "INFO+" } button(class="info", on:click=handle_display){ "INFO+" }
} }
div(class="card-main"){ div(class="card-main"){
img(src=coverurl,width="100")
div(class="card-title"){ div(class="card-title"){
(format!("{}",loctitle)) (format!("{}",loctitle))
@@ -435,11 +438,12 @@ pub fn BookDB<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
(format!("{}",locauthors)) (format!("{}",locauthors))
} }
//div(class="card-image"){ //div(class="card-image"){
img(src=coverurl,width="100")
//} //}
} }
div(class="card-desc"){ div(class="card-desc"){
(format!("{}",locloc))
br{}br{}
(format!("{}",locdesc)) (format!("{}",locdesc))
} }
@@ -453,6 +457,7 @@ pub fn BookDB<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
async fn ListOL<G: Html>(cx: Scope<'_>) -> View<G> { async fn ListOL<G: Html>(cx: Scope<'_>) -> View<G> {
let app_state = use_context::<AppState>(cx); let app_state = use_context::<AppState>(cx);
/*
create_effect(cx, || { create_effect(cx, || {
app_state.search.track(); app_state.search.track();
@@ -461,6 +466,7 @@ async fn ListOL<G: Html>(cx: Scope<'_>) -> View<G> {
app_state.search.get(), app_state.search.get(),
); );
}); });
*/
let docs = create_memo(cx, || app_state.books.get().iter().cloned().collect::<Vec<_>>()); let docs = create_memo(cx, || app_state.books.get().iter().cloned().collect::<Vec<_>>());
view! {cx, view! {cx,
@@ -503,6 +509,7 @@ pub fn BookOL<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
div(class="card-openlibrary"){ div(class="card-openlibrary"){
button(class="add", on:click=handle_add){ "ADD+" } button(class="add", on:click=handle_add){ "ADD+" }
div(class="card-main"){ div(class="card-main"){
img(src=coverurl,width="100")
div(class="card-title"){ div(class="card-title"){
(format!("{}",loctitle)) (format!("{}",loctitle))
@@ -511,7 +518,6 @@ pub fn BookOL<G: Html>(cx: Scope, bookitem: BookUIProp) -> View<G> {
(format!("{}",locauthors)) (format!("{}",locauthors))
} }
//div(class="card-image"){ //div(class="card-image"){
img(src=coverurl,width="100")
//} //}
} }
} }
@@ -622,6 +628,7 @@ info!("Adding book");
app_state.addingbook.set(BookUI::default()); app_state.addingbook.set(BookUI::default());
app_state.updating.set(false); app_state.updating.set(false);
app_state.adding.set(false); app_state.adding.set(false);
//app_state.books.set(vec![BookUI::default()]);
app_state.refreshing.set(true); app_state.refreshing.set(true);
@@ -913,6 +920,7 @@ async fn PageBar<G: Html>(cx: Scope<'_>) -> View<G> {
view!{ cx, view!{ cx,
label{"PAGE "} label{"PAGE "}
input(ref=input_ref,bind:value=currpg,on:keyup=handle_submit,class="page-input") input(ref=input_ref,bind:value=currpg,on:keyup=handle_submit,class="page-input")
label{(format!(" / {}",*app_state.maxpage.get()))}
(if *app_state.pagenum.get()>1 { (if *app_state.pagenum.get()>1 {
view!{cx, button(class="page", on:click=handle_sub){ "-" }} view!{cx, button(class="page", on:click=handle_sub){ "-" }}
} else { } else {