Add delete library functionality
More reactivity
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@
|
||||
<div class="book-info">
|
||||
<h4>{{ book.metadata.title }}</h4>
|
||||
<p>{{ getAuthorNames(book) }}</p>
|
||||
<p-button [rounded]="true" 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)"></p-button>
|
||||
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book.id, book.libraryId)"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-5
@@ -1,6 +1,6 @@
|
||||
import {Component, OnInit, ViewChild, ElementRef, Input, computed, signal} from '@angular/core';
|
||||
import {Book} from '../../model/book.model';
|
||||
import {BookService} from '../../service/book.service';
|
||||
import {LibraryAndBookService} from '../../service/library-and-book.service';
|
||||
import {Button} from 'primeng/button';
|
||||
import {InfiniteScrollDirective} from 'ngx-infinite-scroll';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
@@ -27,7 +27,7 @@ export class DashboardScrollerComponent implements OnInit {
|
||||
return this.bookListType === 'lastRead' ? this.bookService.lastReadBooks() : this.bookService.latestAddedBooks();
|
||||
});
|
||||
|
||||
constructor(private bookService: BookService, private router: Router) {
|
||||
constructor(private bookService: LibraryAndBookService, private router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -50,9 +50,8 @@ export class DashboardScrollerComponent implements OnInit {
|
||||
return book.metadata.authors?.map((author) => author.name).join(', ') || 'No authors available';
|
||||
}
|
||||
|
||||
openBook(bookId: number): void {
|
||||
const url = `/pdf-viewer/book/${bookId}`;
|
||||
window.open(url, '_blank');
|
||||
openBook(book: Book): void {
|
||||
this.bookService.readBook(book);
|
||||
}
|
||||
|
||||
openBookInfo(bookId: number, libraryId: number) {
|
||||
|
||||
Reference in New Issue
Block a user