Add delete library functionality

More reactivity
This commit is contained in:
aditya.chandel
2024-12-20 18:32:41 -07:00
parent e175a7e255
commit 36c85bfb06
24 changed files with 284 additions and 248 deletions
@@ -4,7 +4,7 @@
<div class="cover-container">
<div class="cover-wrapper">
<img [src]="coverImageSrc(book?.id)" class="book-cover placeholder" alt="Cover of {{ book?.metadata?.title }}" loading="lazy"/>
<div class="overlay" (click)="readBook(book?.id)">
<div class="overlay" (click)="readBook(book!)">
<p-button icon="pi pi-book" [rounded]="true"></p-button>
</div>
</div>
@@ -38,7 +38,7 @@
</h1>
<div class="button-group">
<p-button [rounded]="true" [raised]="true" [outlined]="true" (onClick)="openEditDialog(book?.id, book?.libraryId)" icon="pi pi-pencil"></p-button>
<p-button [rounded]="true" [raised]="true" [outlined]="true" (onClick)="readBook(book?.id)" icon="pi pi-eye"></p-button>
<p-button [rounded]="true" [raised]="true" [outlined]="true" (onClick)="readBook(book!)" icon="pi pi-eye"></p-button>
<p-button [rounded]="true" [raised]="true" [outlined]="true" icon="pi pi-download"></p-button>
</div>
</div>
@@ -1,6 +1,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {BookService} from '../../service/book.service';
import {LibraryAndBookService} from '../../service/library-and-book.service';
import {Book} from '../../model/book.model';
import {Button} from 'primeng/button';
import {NgForOf, NgIf} from '@angular/common';
@@ -30,7 +30,7 @@ export class BookMetadataComponent implements OnInit, OnDestroy {
private dialogSubscription?: Subscription;
constructor(
private bookService: BookService, private activatedRoute: ActivatedRoute,
private bookService: LibraryAndBookService, private activatedRoute: ActivatedRoute,
private dialogService: DialogService, private router: Router) {
}
@@ -106,11 +106,7 @@ export class BookMetadataComponent implements OnInit, OnDestroy {
}
}
readBook(id: number | undefined) {
const url = `/pdf-viewer/book/${id}`;
window.open(url, '_blank');
this.routeSubscription?.unsubscribe();
this.dialogSubscription?.unsubscribe();
this.dialogRef?.close();
readBook(book: Book) {
this.bookService.readBook(book);
}
}