Checkpoint

This commit is contained in:
aditya.chandel
2024-12-15 18:03:31 -07:00
parent 96a04621e1
commit 95e0d27de4
68 changed files with 1234 additions and 431 deletions
@@ -9,11 +9,12 @@
(scroll)="onScroll($event)">
<div class="book-item" *ngFor="let book of books">
<img [src]="coverImageSrc(book.id)" class="book-cover" alt="Cover of {{ book.title }}" loading="lazy"/>
<img [src]="coverImageSrc(book.id)" class="book-cover" alt="Cover of {{ book.metadata.title }}" loading="lazy"/>
<div class="book-info">
<h4>{{ book.title }}</h4>
<h4>{{ book.metadata.title }}</h4>
<p>{{ getAuthorNames(book) }}</p>
<p-button label="View" icon="pi pi-eye" class="view-btn" (click)="openBook(book.id)"></p-button>
<p-button [rounded]="true" icon="pi pi-eye" class="view-btn" (click)="openBook(book.id)"></p-button>
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book.id)"></p-button>
</div>
</div>
</div>
@@ -61,7 +61,7 @@ h4 {
p {
color: var(--text-color-secondary);
font-size: 0.7rem;
font-size: 0.8rem;
line-height: 1.2;
margin: 0;
white-space: nowrap;
@@ -69,15 +69,20 @@ p {
text-overflow: ellipsis;
}
.view-btn {
.view-btn, .read-btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transform: translate(-50%, -20%);
display: none;
z-index: 1;
margin: -60px 0;
}
.book-item:hover .view-btn {
display: block;
}
.book-item:hover .read-btn {
display: block;
top: 75%;
}
@@ -4,6 +4,7 @@ import {BookService} from '../../service/book.service';
import {Button} from 'primeng/button';
import {InfiniteScrollDirective} from 'ngx-infinite-scroll';
import {NgForOf} from '@angular/common';
import {Router} from '@angular/router';
@Component({
selector: 'app-dashboard-scroller',
@@ -26,7 +27,7 @@ export class DashboardScrollerComponent implements OnInit {
@ViewChild('scrollContainer') scrollContainer!: ElementRef;
constructor(private bookService: BookService) {
constructor(private bookService: BookService, private router: Router) {
}
ngOnInit(): void {
@@ -67,7 +68,7 @@ export class DashboardScrollerComponent implements OnInit {
}
getAuthorNames(book: Book): string {
return book.authors?.map((author) => author.name).join(', ') || 'No authors available';
return book.metadata.authors?.map((author) => author.name).join(', ') || 'No authors available';
}
openBook(bookId: number): void {
@@ -83,4 +84,8 @@ export class DashboardScrollerComponent implements OnInit {
this.loadMore();
}
}
openBookInfo(bookId: number) {
this.router.navigate(['/book', bookId, 'info']);
}
}