Move book metadata view to tab and remove the routed page
This commit is contained in:
+2
@@ -55,6 +55,8 @@ public class BookMetadataService {
|
||||
metadata.setIsbn13(newMetadata.getIsbn13());
|
||||
metadata.setDescription(newMetadata.getDescription());
|
||||
metadata.setPageCount(newMetadata.getPageCount());
|
||||
metadata.setRating(newMetadata.getRating());
|
||||
metadata.setReviewCount(newMetadata.getReviewCount());
|
||||
if (newMetadata.getAuthors() != null && !newMetadata.getAuthors().isEmpty()) {
|
||||
List<Author> authors = newMetadata.getAuthors().stream()
|
||||
.map(authorName -> authorRepository.findByName(authorName)
|
||||
|
||||
+2
@@ -27,6 +27,8 @@ public class BookMetadataTransformer {
|
||||
.language(bookMetadata.getLanguage())
|
||||
.pageCount(bookMetadata.getPageCount())
|
||||
.publishedDate(bookMetadata.getPublishedDate())
|
||||
.rating(bookMetadata.getRating())
|
||||
.reviewCount(bookMetadata.getReviewCount())
|
||||
.authors(bookMetadata.getAuthors() == null ? null : bookMetadata.getAuthors().stream().map(AuthorTransformer::toAuthorDTO).collect(Collectors.toList()))
|
||||
.categories(bookMetadata.getCategories() == null ? null : bookMetadata.getCategories().stream().map(CategoryTransformer::categoryDTO).collect(Collectors.toList()))
|
||||
.build();
|
||||
|
||||
@@ -2,7 +2,6 @@ import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {PdfViewerComponent} from './book/component/pdf-viewer/pdf-viewer.component';
|
||||
import {DashboardComponent} from './book/component/dashboard/dashboard.component';
|
||||
import {BookMetadataComponent} from './book/component/book-metadata/book-metadata.component';
|
||||
import {BookBrowserComponent} from './book/component/book-browser/book-browser.component';
|
||||
import {AppLayoutComponent} from './book/component/layout/app.layout.component';
|
||||
|
||||
@@ -21,9 +20,6 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'shelf/:shelfId/books', component: BookBrowserComponent,
|
||||
},
|
||||
{
|
||||
path: 'library/:libraryId/book/:bookId/info', component: BookMetadataComponent,
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div *ngIf="bookMetadata$ | async as bookMetadata" class="container pt-4 flex flex-col h-full">
|
||||
<div *ngIf="bookMetadata$ | async as bookMetadata" class="container pt-2 flex flex-col h-full">
|
||||
<form [formGroup]="bookMetadataForm" (ngSubmit)="onSave()" class="space-y-4 overflow-y-auto flex-1">
|
||||
<div class="flex w-full gap-x-4">
|
||||
<div class="flex flex-col gap-1 w-2/3">
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<p-tabs value="0" style="height: 100%; overflow: hidden;">
|
||||
<p-tablist>
|
||||
<p-tab value="0">Book Details</p-tab>
|
||||
<p-tab value="1">Match Book</p-tab>
|
||||
<p-tab value="2">Manage File</p-tab>
|
||||
<p-tab value="1">Edit Details</p-tab>
|
||||
<p-tab value="2">Match Book</p-tab>
|
||||
</p-tablist>
|
||||
<p-tabpanels style="height: 100%; overflow: hidden; padding-bottom: 0">
|
||||
<p-tabpanel value="0" style="height: 100%; overflow: hidden;">
|
||||
<app-book-details></app-book-details>
|
||||
<app-book-metadata-viewer></app-book-metadata-viewer>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel value="1" style="height: 100%; overflow: hidden;">
|
||||
<app-book-match></app-book-match>
|
||||
<app-book-details></app-book-details>
|
||||
</p-tabpanel>
|
||||
<p-tabpanel value="2" style="height: 100%; overflow: hidden;">
|
||||
<p>I too work!!</p>
|
||||
<app-book-match></app-book-match>
|
||||
</p-tabpanel>
|
||||
</p-tabpanels>
|
||||
</p-tabs>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {BookMatchComponent} from './book-match/book-match.component';
|
||||
import {BookInfoService} from './book-info.service';
|
||||
import {Book} from '../book/model/book.model';
|
||||
import {BookMetadataBI} from '../book/model/book-metadata-for-book-info.model';
|
||||
import {BookMetadataViewerComponent} from './book-metadata-viewer/book-metadata-viewer.component';
|
||||
|
||||
@Component({
|
||||
selector: 'book-info-tabs',
|
||||
@@ -22,6 +23,7 @@ import {BookMetadataBI} from '../book/model/book-metadata-for-book-info.model';
|
||||
BookDetailsComponent,
|
||||
TabPanel,
|
||||
BookMatchComponent,
|
||||
BookMetadataViewerComponent,
|
||||
],
|
||||
})
|
||||
export class BookInfoTabsComponent implements OnInit {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<form *ngIf="!selectedFetchedMetadata" class="flex flex-col w-full h-full pt-4" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<form *ngIf="!selectedFetchedMetadata" class="flex flex-col w-full h-full pt-2" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div class="flex w-full gap-x-4 items-end">
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<label for="provider">Provider</label>
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<div class="container pt-2 flex flex-col h-full">
|
||||
<div class="book-metadata-container flex-shrink-0" *ngIf="bookMetadata$ | async as bookMetadata">
|
||||
<div class="flex flex-row w-full">
|
||||
|
||||
<img [src]="coverImageSrc(bookMetadata.bookId)" class="book-cover placeholder" alt="Cover of {{ bookMetadata.title }}" loading="lazy" width="200"/>
|
||||
|
||||
<div class="pl-4 flex flex-col w-full space-y-4">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<div>
|
||||
<p class="text-xl font-bold">{{ bookMetadata.title }}</p>
|
||||
<div class="flex items-center gap-4 pt-1">
|
||||
<p-rating [(ngModel)]="bookMetadata.rating" readonly stars="5"></p-rating>
|
||||
<p class="font-semibold">({{ bookMetadata.reviewCount || 0 }} Reviews)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-4">
|
||||
<p-button [rounded]="true" [raised]="true" [outlined]="true" severity="info" (onClick)="readBook(bookMetadata.bookId)" icon="pi pi-eye"></p-button>
|
||||
<p-button [rounded]="true" [raised]="true" [outlined]="true" severity="info" icon="pi pi-download"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex items-center">
|
||||
<p class="font-semibold text-lg">Authors:</p>
|
||||
<div class="flex flex-wrap gap-2 ml-2">
|
||||
<p class="text-lg" *ngFor="let author of bookMetadata.authors">
|
||||
{{ author }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<p><span class="font-bold">Publisher:</span> {{ bookMetadata.publisher || 'N/A' }}</p>
|
||||
<p><span class="font-bold">Published:</span> {{ bookMetadata.publishedDate || 'Unknown' }}</p>
|
||||
<p><span class="font-bold">Language:</span> {{ bookMetadata.language || 'Unknown' }}</p>
|
||||
<p><span class="font-bold">ISBN:</span> {{ bookMetadata.isbn10 || 'Unknown' }}</p>
|
||||
<p><span class="font-bold">Page Count:</span> {{ bookMetadata.pageCount || 'Unknown' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<p-tag *ngFor="let category of bookMetadata.categories" value="{{category}}"></p-tag>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div *ngIf="bookMetadata$ | async as bookMetadata" class="book-description space-y-4 overflow-y-auto flex-1">
|
||||
<p class="pt-2 px-2" [innerHTML]="bookMetadata.description || 'No description available.'"></p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-x-4 mt-auto">
|
||||
<p-divider></p-divider>
|
||||
<div class="flex gap-x-4 justify-end">
|
||||
<p-button label="Close" icon="pi pi-times" severity="secondary" (onClick)="closeDialog()"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AsyncPipe, NgForOf, NgIf} from '@angular/common';
|
||||
import {Book} from '../../book/model/book.model';
|
||||
import {Observable, Subscription} from 'rxjs';
|
||||
import {BookService} from '../../book/service/book.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {LibraryService} from '../../book/service/library.service';
|
||||
import {BookMetadataBI} from '../../book/model/book-metadata-for-book-info.model';
|
||||
import {BookInfoService} from '../book-info.service';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {Rating} from 'primeng/rating';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Chip} from 'primeng/chip';
|
||||
import {Tag} from 'primeng/tag';
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-metadata-viewer',
|
||||
standalone: true,
|
||||
templateUrl: './book-metadata-viewer.component.html',
|
||||
imports: [
|
||||
Button,
|
||||
NgForOf,
|
||||
NgIf,
|
||||
AsyncPipe,
|
||||
Divider,
|
||||
Rating,
|
||||
FormsModule,
|
||||
Tag
|
||||
],
|
||||
styleUrl: './book-metadata-viewer.component.scss'
|
||||
})
|
||||
export class BookMetadataViewerComponent implements OnInit {
|
||||
|
||||
bookMetadata$: Observable<BookMetadataBI | null>;
|
||||
currentBookId!: number;
|
||||
|
||||
constructor(private bookService: BookService, private router: Router, private bookInfoService: BookInfoService) {
|
||||
this.bookMetadata$ = this.bookInfoService.bookMetadata$;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.bookMetadata$.subscribe((bookMetadata) => {
|
||||
if(bookMetadata) {
|
||||
this.currentBookId = bookMetadata?.bookId;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
navigateToBook(bookId: number | null, libraryId: number | null): void {
|
||||
if (bookId && libraryId) {
|
||||
this.router.navigate(['/library', libraryId, 'book', bookId, 'info']);
|
||||
}
|
||||
}
|
||||
|
||||
getAuthorNames(book: Book | null): string {
|
||||
if (book && book.metadata && book.metadata.authors) {
|
||||
return book.metadata.authors.map((author) => author.name).join(', ');
|
||||
}
|
||||
return 'No authors available';
|
||||
}
|
||||
|
||||
coverImageSrc(bookId: number | undefined): string {
|
||||
if (bookId === null) {
|
||||
return 'assets/book-cover-metadata.png';
|
||||
}
|
||||
return this.bookService.getBookCoverUrl(bookId!);
|
||||
}
|
||||
|
||||
readBook(bookId: number) {
|
||||
this.bookService.readBook(bookId);
|
||||
}
|
||||
|
||||
closeDialog() {
|
||||
return this.bookInfoService.closeDialog(true);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -203,7 +203,7 @@
|
||||
<div class="flex justify-between">
|
||||
<p-button label="Back" icon="pi pi-arrow-left" severity="info" (onClick)="goBackClick()"></p-button>
|
||||
<div class="flex gap-x-4 justify-end">
|
||||
<p-button label="Cancel" icon="pi pi-times" severity="secondary" (onClick)="closeDialog()"></p-button>
|
||||
<p-button label="Close" icon="pi pi-times" severity="secondary" (onClick)="closeDialog()"></p-button>
|
||||
<p-button label="Save" icon="pi pi-check" severity="primary" type="submit"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -50,7 +50,7 @@ export class BookCardComponent implements OnInit {
|
||||
}
|
||||
|
||||
readBook(book: Book): void {
|
||||
this.bookService.readBook(book);
|
||||
this.bookService.readBook(book.id);
|
||||
}
|
||||
|
||||
toggleSelection(selected: boolean): void {
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<div class="book-metadata-container">
|
||||
<div class="book-metadata">
|
||||
<div class="book-header">
|
||||
<div>
|
||||
<div class="cover-wrapper cover-container">
|
||||
<img [src]="coverImageSrc(book?.id)" class="book-cover placeholder" alt="Cover of {{ book?.metadata?.title }}" loading="lazy"/>
|
||||
<div class="overlay" (click)="readBook(book!)">
|
||||
<p-button icon="pi pi-book" [rounded]="true"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="book-navigation">
|
||||
<p-button
|
||||
icon="pi pi-arrow-left"
|
||||
class="navigation-button"
|
||||
severity="help"
|
||||
(click)="navigateToBook(previousBookId, book?.libraryId!)"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
[disabled]="!canGoPrevious()">
|
||||
</p-button>
|
||||
<p-button
|
||||
icon="pi pi-arrow-right"
|
||||
class="navigation-button"
|
||||
severity="help"
|
||||
(click)="navigateToBook(nextBookId, book?.libraryId!)"
|
||||
[rounded]="true"
|
||||
[outlined]="true"
|
||||
[disabled]="!canGoNext()">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<div class="title-row">
|
||||
<h1 class="book-title">
|
||||
{{ book?.metadata?.title }}<span *ngIf="book?.metadata?.subtitle">: {{ book?.metadata?.subtitle }}</span>
|
||||
</h1>
|
||||
<div class="button-group">
|
||||
<p-button [rounded]="true" [raised]="true" [outlined]="true" (onClick)="openEditDialog(book?.id!)" icon="pi pi-pencil"></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>
|
||||
<p class="author">Author — {{ getAuthorNames(book) }}</p>
|
||||
<div class="categories">
|
||||
<p-button *ngFor="let category of book?.metadata?.categories" label="{{category.name}}" severity="info" [rounded]="true" [outlined]="true" size="small"></p-button>
|
||||
</div>
|
||||
<div class="details">
|
||||
<p><strong>Publisher:</strong> {{ book?.metadata?.publisher || 'N/A' }}</p>
|
||||
<p><strong>Published:</strong> {{ book?.metadata?.publishedDate || 'Unknown' }}</p>
|
||||
<p><strong>Language:</strong> {{ book?.metadata?.language || 'Unknown' }}</p>
|
||||
<p *ngIf="book?.metadata?.googleBookId">
|
||||
<strong>Google Book:</strong>
|
||||
<a [href]="'https://books.google.com/books?id=' + book?.metadata?.googleBookId" target="_blank">
|
||||
Link
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="book-description">
|
||||
<p [innerHTML]="book?.metadata?.description || 'No description available.'"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,123 +0,0 @@
|
||||
.book-metadata-container {
|
||||
height: calc(100vh - 6.5rem);
|
||||
overflow-y: auto;
|
||||
transition: transform 0.2s, left 0.2s;
|
||||
background-color: var(--card-background);
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem 2rem;
|
||||
}
|
||||
|
||||
.book-metadata {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.book-header {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.cover-container {
|
||||
position: relative;
|
||||
max-width: 200px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.cover-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.book-cover {
|
||||
width: 100%;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
||||
transition: filter 0.3s ease;
|
||||
}
|
||||
|
||||
.cover-container:hover .book-cover {
|
||||
filter: blur(1px);
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cover-container:hover .overlay {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.metadata {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.title-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 0.6rem;
|
||||
}
|
||||
|
||||
.book-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.p-button-sm {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.p-button-text {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.author {
|
||||
font-size: 1.1rem;
|
||||
color: var(--text-color-secondary);
|
||||
margin: 9px 0;
|
||||
}
|
||||
|
||||
.categories {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.category {
|
||||
background-color: var(--text-color);
|
||||
color: #555;
|
||||
font-size: 0.8rem;
|
||||
padding: 4px 8px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.details p {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.book-description {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.book-navigation {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0.8rem 1rem 0;
|
||||
}
|
||||
|
||||
.book-subtitle {
|
||||
font-size: 1rem;
|
||||
color: var(--text-color-secondary);
|
||||
margin-top: 0.25rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Book} from '../../model/book.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {forkJoin, Subscription} from 'rxjs';
|
||||
import {TagModule} from 'primeng/tag';
|
||||
import {BookService} from '../../service/book.service';
|
||||
import {LibraryService} from '../../service/library.service';
|
||||
import {MetadataSearcherComponent} from '../../../book-info-tabs/metadata-searcher/metadata-searcher.component';
|
||||
import {LoadingService} from '../../../loading.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-book-metadata',
|
||||
templateUrl: './book-metadata.component.html',
|
||||
styleUrls: ['./book-metadata.component.scss'],
|
||||
imports: [
|
||||
Button,
|
||||
NgForOf,
|
||||
TagModule,
|
||||
NgIf
|
||||
]
|
||||
})
|
||||
export class BookMetadataComponent implements OnInit, OnDestroy {
|
||||
book: Book | null = null;
|
||||
nextBookId: number | null = null;
|
||||
previousBookId: number | null = null;
|
||||
|
||||
private routeSubscription!: Subscription;
|
||||
private dialogRef!: DynamicDialogRef;
|
||||
private dialogSubscription?: Subscription;
|
||||
|
||||
constructor(
|
||||
private bookService: BookService, private activatedRoute: ActivatedRoute,
|
||||
private dialogService: DialogService, private router: Router,
|
||||
private libraryService: LibraryService, private loadingService: LoadingService,) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.routeSubscription = this.activatedRoute.paramMap.subscribe((paramMap) => {
|
||||
const bookId = +paramMap.get('bookId')!;
|
||||
const libraryId = +paramMap.get('libraryId')!;
|
||||
if (bookId && libraryId) {
|
||||
this.loadBookWithNeighbors(bookId, libraryId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private loadBookWithNeighbors(libraryId: number, bookId: number): void {
|
||||
this.libraryService.getBookWithNeighbours(bookId, libraryId).subscribe((response) => {
|
||||
this.book = response.currentBook;
|
||||
this.nextBookId = response.nextBookId;
|
||||
this.previousBookId = response.previousBookId;
|
||||
});
|
||||
}
|
||||
|
||||
navigateToBook(bookId: number | null, libraryId: number | null): void {
|
||||
if (bookId && libraryId) {
|
||||
this.router.navigate(['/library', libraryId, 'book', bookId, 'info']);
|
||||
}
|
||||
}
|
||||
|
||||
canGoNext(): boolean {
|
||||
return this.nextBookId !== null;
|
||||
}
|
||||
|
||||
canGoPrevious(): boolean {
|
||||
return this.previousBookId !== null;
|
||||
}
|
||||
|
||||
getAuthorNames(book: Book | null): string {
|
||||
if (book && book.metadata && book.metadata.authors) {
|
||||
return book.metadata.authors.map((author) => author.name).join(', ');
|
||||
}
|
||||
return 'No authors available';
|
||||
}
|
||||
|
||||
openEditDialog(bookId: number) {
|
||||
/*this.loadingService.show();
|
||||
forkJoin({
|
||||
book: this.bookService.getBookByIdFromAPI(bookId, true),
|
||||
fetchedMetadata: this.bookService.fetchMetadataFromSource(bookId)
|
||||
}).subscribe({
|
||||
next: ({ book, fetchedMetadata }) => {
|
||||
this.loadingService.hide();
|
||||
this.dialogRef = this.dialogService.open(MetadataSearcherComponent, {
|
||||
header: 'Update Book Metadata',
|
||||
modal: true,
|
||||
closable: true,
|
||||
width: '1350px',
|
||||
height: '1000px',
|
||||
contentStyle: {
|
||||
'overflow-y': 'auto',
|
||||
'max-height': 'calc(100vh - 150px)',
|
||||
'padding': '1.25rem 1.25rem 0',
|
||||
},
|
||||
data: {
|
||||
currentMetadata: book.metadata,
|
||||
fetchedMetadata: fetchedMetadata,
|
||||
book: this.book
|
||||
}
|
||||
});
|
||||
|
||||
if (this.dialogRef) {
|
||||
this.dialogSubscription = this.dialogRef.onClose.subscribe(() => {
|
||||
if (this.book?.id && this.book?.libraryId) {
|
||||
this.loadBookWithNeighbors(this.book.id, this.book.libraryId);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error('DialogRef is undefined or null');
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
this.loadingService.hide();
|
||||
console.error('Error fetching metadata:', error);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
coverImageSrc(bookId: number | undefined): string {
|
||||
if (bookId === null) {
|
||||
return 'assets/book-cover-metadata.png';
|
||||
}
|
||||
return this.bookService.getBookCoverUrl(bookId!);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.routeSubscription) {
|
||||
this.routeSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
readBook(book: Book) {
|
||||
this.bookService.readBook(book);
|
||||
}
|
||||
}
|
||||
@@ -115,10 +115,10 @@ export class BookService {
|
||||
);
|
||||
}
|
||||
|
||||
readBook(book: Book): void {
|
||||
const url = `/pdf-viewer/book/${book.id}`;
|
||||
readBook(bookId: number): void {
|
||||
const url = `/pdf-viewer/book/${bookId}`;
|
||||
window.open(url, '_blank');
|
||||
this.updateLastReadTime(book.id).subscribe({
|
||||
this.updateLastReadTime(bookId).subscribe({
|
||||
error: err => console.error('Failed to update last read time', err),
|
||||
});
|
||||
}
|
||||
@@ -202,6 +202,7 @@ export class BookService {
|
||||
}
|
||||
|
||||
updateMetadata(bookId: number, bookMetadata: BookMetadataBI): Observable<BookMetadata> {
|
||||
console.log(bookMetadata)
|
||||
return this.http.put<BookMetadata>(`${this.url}/${bookId}/metadata`, bookMetadata);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user