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

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<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/>
<title>Book Manager</title>
</head>

View File

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