Enhanced metadata viewer, editor, picker and searcher
This commit is contained in:
committed by
Aditya Chandel
parent
ceac960943
commit
538854b397
+14
-7
@@ -4,13 +4,20 @@
|
||||
(mouseout)="isHovered = false">
|
||||
|
||||
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': readButtonHidden }">
|
||||
<img
|
||||
[src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
class="book-cover"
|
||||
[class.loaded]="isImageLoaded"
|
||||
alt="Cover of {{ book.metadata?.title }}"
|
||||
loading="lazy"
|
||||
(load)="onImageLoad()"/>
|
||||
<div
|
||||
class="cover-container"
|
||||
[ngClass]="{
|
||||
'center-info-btn': readButtonHidden,
|
||||
'loaded': isImageLoaded
|
||||
}">
|
||||
<img
|
||||
[src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
class="book-cover"
|
||||
[class.loaded]="isImageLoaded"
|
||||
alt="Cover of {{ book.metadata?.title }}"
|
||||
loading="lazy"
|
||||
(load)="onImageLoad()" />
|
||||
</div>
|
||||
|
||||
@if (book.metadata?.seriesNumber != null) {
|
||||
<div class="series-number-overlay">
|
||||
|
||||
+7
-14
@@ -1,6 +1,6 @@
|
||||
.book-card {
|
||||
background-color: var(--card-background);
|
||||
border-radius: 0 0 8px 8px;
|
||||
border-radius: 8px 8px 8px 8px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: border 0.2s;
|
||||
@@ -13,25 +13,18 @@
|
||||
.cover-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 5/7;
|
||||
background-color: var(--card-background);
|
||||
border-radius: 8px 8px 0 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.cover-container.shimmer {
|
||||
/*background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 2.5s infinite linear;*/
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 200% 0;
|
||||
}
|
||||
.cover-container.loaded {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.book-cover {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, ElementRef, EventEmitter, inject, Input, OnDestroy, OnInit, Optional, Output, ViewChild} from '@angular/core';
|
||||
import {Book, BookMetadata} from '../../../model/book.model';
|
||||
import {Component, ElementRef, EventEmitter, inject, Input, OnDestroy, OnInit, Output, ViewChild} from '@angular/core';
|
||||
import {Book} from '../../../model/book.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {MenuModule} from 'primeng/menu';
|
||||
import {ConfirmationService, MenuItem, MessageService} from 'primeng/api';
|
||||
@@ -20,7 +20,6 @@ import {TieredMenu} from 'primeng/tieredmenu';
|
||||
import {BookSenderComponent} from '../../book-sender/book-sender.component';
|
||||
import {Router} from '@angular/router';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {BookMetadataHostService} from '../../../../book-metadata-host-service';
|
||||
import {BookMetadataCenterComponent} from '../../../metadata/book-metadata-center/book-metadata-center.component';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
|
||||
@@ -32,9 +31,10 @@ import {takeUntil} from 'rxjs/operators';
|
||||
standalone: true
|
||||
})
|
||||
export class BookCardComponent implements OnInit, OnDestroy {
|
||||
@Input() index!: number;
|
||||
|
||||
@Output() checkboxClick = new EventEmitter<{ index: number; bookId: number; selected: boolean; shiftKey: boolean }>();
|
||||
|
||||
@Input() index!: number;
|
||||
@Input() book!: Book;
|
||||
@Input() isCheckboxEnabled: boolean = false;
|
||||
@Input() onBookSelect?: (bookId: number, selected: boolean) => void;
|
||||
|
||||
+103
-63
@@ -1,14 +1,14 @@
|
||||
@if (book$ | async; as book) {
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full min-w-[80rem]">
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full md:min-w-[80rem]">
|
||||
@if (isLoading) {
|
||||
<div class="absolute inset-0 bg-black opacity-25 z-10 "></div>
|
||||
}
|
||||
@if (isLoading) {
|
||||
<p-progressSpinner [style]="{position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)'}"></p-progressSpinner>
|
||||
}
|
||||
<div class="flex-grow overflow-auto py-2 px-2">
|
||||
<div class="flex flex-row w-full gap-4">
|
||||
<div class="flex flex-col items-center gap-2 relative">
|
||||
<div class="flex-grow overflow-auto md:py-2 md:px-2 ">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4">
|
||||
<div class="flex flex-col items-center gap-4 relative">
|
||||
<img
|
||||
[attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)"
|
||||
alt="Image"
|
||||
@@ -56,8 +56,8 @@
|
||||
</div>
|
||||
<div class="flex flex-col flex-grow pl-2">
|
||||
|
||||
<div class="flex flex-row w-full gap-4 pb-1">
|
||||
<div class="flex flex-col gap-1 w-2/3">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-2/3">
|
||||
<label for="title">Title</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="title" formControlName="title" class="w-full"/>
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/3">
|
||||
<div class="flex flex-col gap-1 md:w-1/3">
|
||||
<label for="subtitle">Subtitle</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="subtitle" formControlName="subtitle" class="w-full"/>
|
||||
@@ -83,8 +83,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 basis-[71%]">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:basis-[71%]">
|
||||
<label for="authors">Authors</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<div class="w-full">
|
||||
@@ -98,7 +98,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 basis-[20%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[20%]">
|
||||
<label for="publisher">Publisher</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="publisher" formControlName="publisher" class="w-full"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 basis-[14%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[14%]">
|
||||
<label for="language">Language</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="language" formControlName="language" class="w-full"/>
|
||||
@@ -124,7 +124,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 w-full">
|
||||
<label for="categories">Categories</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
@@ -140,11 +140,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 basis-[75%]">
|
||||
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:basis-[75%]">
|
||||
<label for="seriesName">Series Name</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="seriesName" formControlName="seriesName" class="w-full" />
|
||||
<input pInputText id="seriesName" formControlName="seriesName" class="w-full"/>
|
||||
@if (!book.metadata!['seriesNameLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
|
||||
}
|
||||
@@ -154,10 +155,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 basis-[10%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[10%]">
|
||||
<label for="seriesNumber">Book #</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full" />
|
||||
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full"/>
|
||||
@if (!book.metadata!['seriesNumberLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
|
||||
}
|
||||
@@ -167,10 +168,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 basis-[10%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[10%]">
|
||||
<label for="seriesTotal">Total Books</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full" />
|
||||
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full"/>
|
||||
@if (!book.metadata!['seriesTotalLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
|
||||
}
|
||||
@@ -180,10 +181,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1 basis-[15%]">
|
||||
<div class="flex flex-col gap-1 md:basis-[15%]">
|
||||
<label for="publishedDate">Publish Date</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full" />
|
||||
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full"/>
|
||||
@if (!book.metadata!['publishedDateLocked']) {
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="success"></p-button>
|
||||
}
|
||||
@@ -194,8 +195,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="isbn10">ISBN 10</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="isbn10" formControlName="isbn10" class="w-full"/>
|
||||
@@ -207,7 +208,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="isbn13">ISBN 13</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="isbn13" formControlName="isbn13" class="w-full"/>
|
||||
@@ -219,7 +220,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="asin">ASIN (Amazon ID)</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="asin" formControlName="asin" class="w-full"/>
|
||||
@@ -231,7 +232,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="amazonRating">Amazon ★</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="amazonRating" formControlName="amazonRating" class="w-full"/>
|
||||
@@ -243,7 +244,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="amazonRatingCount">Amazon Reviews</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="amazonRatingCount" formControlName="amazonReviewCount" class="w-full"/>
|
||||
@@ -255,7 +256,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="googleId">Google Books ID</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="googleId" formControlName="googleId" class="w-full"/>
|
||||
@@ -269,8 +270,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="goodreadsId">Goodreads ID</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="goodreadsId" formControlName="goodreadsId" class="w-full"/>
|
||||
@@ -282,7 +283,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="goodreadsRating">Goodreads ★</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="goodreadsRating" formControlName="goodreadsRating" class="w-full"/>
|
||||
@@ -294,7 +295,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="goodreadsReviewCount">Goodreads Reviews</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="goodreadsReviewCount" formControlName="goodreadsReviewCount" class="w-full"/>
|
||||
@@ -306,7 +307,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="hardcoverId">Hardcover ID</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="hardcoverId" formControlName="hardcoverId" class="w-full"/>
|
||||
@@ -318,7 +319,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="hardcoverRating">Hardcover ★</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="hardcoverRating" formControlName="hardcoverRating" class="w-full"/>
|
||||
@@ -330,7 +331,7 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-1/6">
|
||||
<div class="flex flex-col gap-1 md:w-1/6">
|
||||
<label for="hardcoverReviewCount">Hardcover Reviews</label>
|
||||
<div class="flex justify-between items-center gap-2">
|
||||
<input pInputText id="hardcoverReviewCount" formControlName="hardcoverReviewCount" class="w-full"/>
|
||||
@@ -353,7 +354,7 @@
|
||||
<p-tab value="editor">WYSIWYG Editor</p-tab>
|
||||
<p-tab value="html">HTML Editor</p-tab>
|
||||
</p-tablist>
|
||||
<p-tabpanels>
|
||||
<p-tabpanels class="custom-tab-padding">
|
||||
<p-tabpanel value="editor">
|
||||
<form [formGroup]="metadataForm">
|
||||
<p-editor #quillEditor formControlName="description" [readonly]="quillDisabled()" [style]="{ height: '200px' }">
|
||||
@@ -412,35 +413,74 @@
|
||||
</div>
|
||||
<div class="mt-auto">
|
||||
<p-divider></p-divider>
|
||||
<div class="flex justify-between px-2 pt-1 pb-4 z-10">
|
||||
@if (showNavigationButtons) {
|
||||
<div class="flex gap-x-4">
|
||||
<p-button label="Close" icon="pi pi-times" [outlined]="true" severity="danger" (onClick)="closeDialog()"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
<p-button label="Previous Book" [disabled]="disablePrevious" icon="pi pi-arrow-left" [outlined]="true" severity="info" (onClick)="onPrevious()"></p-button>
|
||||
<p-button label="Next Book" [disabled]="disableNext" icon="pi pi-arrow-right" iconPos="right" [outlined]="true" severity="info" (onClick)="onNext()"></p-button>
|
||||
</div>
|
||||
}
|
||||
<div class="flex gap-x-4 items-center ml-auto">
|
||||
<p-button
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button label="Restore" icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Revert all changes to original metadata" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
<div class="flex flex-col gap-2 px-2 pt-1 md:pb-4 z-10">
|
||||
|
||||
<!-- Desktop Buttons -->
|
||||
<div class="hidden sm:flex justify-between w-full gap-4">
|
||||
@if (showNavigationButtons) {
|
||||
<div class="flex gap-x-4">
|
||||
<p-button label="Close" icon="pi pi-times" [outlined]="true" severity="danger" (onClick)="closeDialog()"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Previous Book" [disabled]="disablePrevious" icon="pi pi-arrow-left" [outlined]="true" severity="info" (onClick)="onPrevious()"></p-button>
|
||||
<p-button label="Next Book" [disabled]="disableNext" icon="pi pi-arrow-right" iconPos="right" [outlined]="true" severity="info" (onClick)="onNext()"></p-button>
|
||||
</div>
|
||||
}
|
||||
<p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock all metadata fields for editing" tooltipPosition="top"></p-button>
|
||||
<p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock all metadata fields to prevent changes" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
|
||||
<div class="flex gap-x-4 items-center ml-auto">
|
||||
<p-button
|
||||
[label]="isAutoFetching ? 'Fetching…' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button label="Restore" icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Revert all changes to original metadata" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
}
|
||||
|
||||
<p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock all metadata fields for editing" tooltipPosition="top"></p-button>
|
||||
<p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock all metadata fields to prevent changes" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mobile Buttons -->
|
||||
<div class="flex sm:hidden justify-between w-full flex-wrap">
|
||||
@if (showNavigationButtons) {
|
||||
<div class="flex gap-2 flex-wrap">
|
||||
<p-button icon="pi pi-times" [outlined]="true" severity="danger" (onClick)="closeDialog()" pTooltip="Close" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-arrow-left" [disabled]="disablePrevious" [outlined]="true" severity="info" (onClick)="onPrevious()" pTooltip="Previous Book" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-arrow-right" [disabled]="disableNext" iconPos="right" [outlined]="true" severity="info" (onClick)="onNext()" pTooltip="Next Book" tooltipPosition="top"></p-button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="flex gap-4 items-center flex-wrap ml-auto">
|
||||
<p-button
|
||||
icon="pi pi-bolt"
|
||||
[outlined]="true"
|
||||
severity="info"
|
||||
(onClick)="autoFetch(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Auto Fetch"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Restore" tooltipPosition="top"></p-button>
|
||||
}
|
||||
<p-button icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock All" tooltipPosition="top"></p-button>
|
||||
<p-button icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock All" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical" />
|
||||
<p-button label="Save" icon="pi pi-check" [loading]="isSaving" [disabled]="isSaving" type="submit"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
::ng-deep .p-tabpanels .custom-tab-padding {
|
||||
padding: 1rem 0rem 0rem 0.5rem !important;
|
||||
|
||||
@media (min-width: 640px) {
|
||||
padding: var(--p-tabs-tabpanel-padding) !important;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
@if (book$ | async; as book) {
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full w-full">
|
||||
<div class="flex-grow overflow-auto p-4">
|
||||
<div class="flex-grow overflow-auto p-0 md:p-4">
|
||||
<div class="flex justify-center items-center" [ngStyle]="{'padding-bottom': '0.75rem', 'padding-left': '7.6rem'}">
|
||||
<p class="ml-3 text-lg">Current Metadata</p>
|
||||
<p-button
|
||||
|
||||
+44
-20
@@ -7,48 +7,72 @@
|
||||
</app-metadata-picker>
|
||||
</div>
|
||||
} @else {
|
||||
<form class="flex flex-col w-full h-full pt-2 min-w-[60rem] pr-4" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div class="flex w-full gap-x-4 items-end">
|
||||
<div class="flex flex-col gap-1 w-3/12">
|
||||
<label>Providers</label>
|
||||
<p-multiselect id="provider" class="w-full" [filter]="false" showToggleAll="false" [options]="providers" formControlName="provider"
|
||||
placeholder="Select Providers"></p-multiselect>
|
||||
<form class="flex flex-col w-full h-full pt-2 min-w-full md:min-w-[60rem] pr-0 md:pr-2 pl-0 md:pl-2" [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<!-- Responsive search inputs -->
|
||||
<div class="grid grid-cols-1 md:flex md:flex-row w-full gap-4 md:items-end">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-3/12">
|
||||
<label for="provider">Providers</label>
|
||||
<p-multiselect
|
||||
id="provider"
|
||||
class="w-full"
|
||||
[filter]="false"
|
||||
showToggleAll="false"
|
||||
[options]="providers"
|
||||
formControlName="provider"
|
||||
placeholder="Select Providers">
|
||||
</p-multiselect>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-5/12">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-5/12">
|
||||
<label for="title">Title</label>
|
||||
<input pInputText formControlName="title" id="title" class="w-full"/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-1 w-4/12">
|
||||
|
||||
<div class="flex flex-col gap-1 w-full max-w-full md:w-4/12">
|
||||
<label for="author">Author</label>
|
||||
<input pInputText formControlName="author" id="author" class="w-full"/>
|
||||
</div>
|
||||
<div>
|
||||
<p-button label="Search" type="submit" outlined="true" [disabled]="!isSearchEnabled || loading"></p-button>
|
||||
|
||||
<div class="flex flex-col gap-1 w-full sm:w-fit md:w-auto">
|
||||
<label class="invisible md:visible h-0 md:h-auto">Search</label>
|
||||
<div class="flex justify-center md:justify-start">
|
||||
<p-button
|
||||
label="Search"
|
||||
type="submit"
|
||||
outlined="true"
|
||||
[disabled]="!isSearchEnabled || loading"
|
||||
class="w-full sm:w-fit md:w-auto">
|
||||
</p-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@if (loading) {
|
||||
<div class="flex justify-center items-center">
|
||||
<div class="flex justify-center items-center mt-8">
|
||||
<p-progress-spinner ariaLabel="loading"/>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!loading) {
|
||||
<div class="mt-8 flex-1 overflow-y-auto">
|
||||
<div class="mt-4 md:mt-8 flex-1 overflow-y-auto">
|
||||
@for (metadata of allFetchedMetadata; track metadata) {
|
||||
<div class="book-item flex flex-col w-full">
|
||||
<div class="flex w-full flex-row book-item-content" (click)="onBookClick(metadata)">
|
||||
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-2"/>
|
||||
<div class=" flex flex-col w-full m-2">
|
||||
<div class="flex flex-row gap-4 justify-between">
|
||||
<div class="flex flex-row w-full book-item-content cursor-pointer" (click)="onBookClick(metadata)">
|
||||
<img [src]="metadata.thumbnailUrl || 'assets/images/missing-cover.jpg'" alt="Image" class="img-fixed-dimensions pr-0 md:pr-2 self-center md:self-start"/>
|
||||
<div class="flex flex-col w-full m-2">
|
||||
<div class="flex flex-col md:flex-row gap-2 md:gap-4 justify-between">
|
||||
<p class="font-bold">{{ truncateText(metadata['title']!, 90) }}</p>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>ISBN: {{ metadata['isbn10'] || metadata['asin'] }}</p>
|
||||
<p> | </p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Published: {{ metadata['publishedDate'] }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2 text-sm">
|
||||
<p>by {{ truncateText(metadata['authors']!.join(', '), 70) }}</p>
|
||||
<p> | </p>
|
||||
<span class="hidden md:inline">|</span>
|
||||
<p>Source: <span [innerHTML]="buildProviderLink(metadata)"></span></p>
|
||||
</div>
|
||||
<p class="mt-4 truncate-text p-secondary">
|
||||
|
||||
+296
-269
@@ -1,56 +1,73 @@
|
||||
<div class="pt-2 flex flex-col h-full px-2 w-full">
|
||||
<div class="p-0 md:p-2 flex flex-col h-full w-full rounded-xl">
|
||||
@if (book$ | async; as book) {
|
||||
<div>
|
||||
<div class="flex flex-row">
|
||||
<div class="cover-wrapper relative">
|
||||
<div class="flex flex-col md:flex-row gap-6 pb-8">
|
||||
|
||||
<div class="flex justify-center md:justify-start">
|
||||
<div class="relative w-[250px] min-w-[250px] md:w-[250px]">
|
||||
<img
|
||||
[attr.src]="urlHelper.getCoverUrl(book?.metadata!.bookId, book?.metadata!.coverUpdatedOn)"
|
||||
class="book-cover placeholder"
|
||||
class="rounded-xl w-full object-cover"
|
||||
alt="Cover of {{ book?.metadata!.title }}"
|
||||
loading="lazy"
|
||||
width="225"
|
||||
style="min-width: 225px;"
|
||||
/>
|
||||
|
||||
@if (book?.metadata!.seriesNumber != null) {
|
||||
<div class="series-number-overlay">
|
||||
<div class="absolute top-2 left-2 bg-black/60 text-white px-2 py-0.5 rounded-lg text-xs font-semibold">
|
||||
#{{ book?.metadata!.seriesNumber }}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-progressBar
|
||||
[value]="getProgressPercent(book)"
|
||||
[showValue]="true"
|
||||
[ngClass]="{ 'progress-complete': getProgressPercent(book) === 100, 'progress-incomplete': getProgressPercent(book)! < 100 }"
|
||||
[style]="{ height: '10px' }">
|
||||
</p-progressBar>
|
||||
<div class="absolute bottom-0 left-0 right-0">
|
||||
<p-progressBar
|
||||
[value]="getProgressPercent(book)"
|
||||
[showValue]="false"
|
||||
[ngClass]="{
|
||||
'rounded-b-xl': true,
|
||||
'progress-complete': getProgressPercent(book) === 100,
|
||||
'progress-incomplete': getProgressPercent(book)! < 100
|
||||
}"
|
||||
[style]="{ height: '8px' }">
|
||||
</p-progressBar>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="flex flex-col justify-between">
|
||||
<div class="pl-6 flex flex-col">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<div>
|
||||
@if (book?.metadata?.seriesName) {
|
||||
<p class="underline hover:opacity-80 cursor-pointer" (click)="goToSeries(book?.metadata?.seriesName!)">
|
||||
{{ book?.metadata?.seriesName }}
|
||||
@if (book?.metadata?.seriesNumber) {
|
||||
#{{ book?.metadata?.seriesNumber }}
|
||||
}
|
||||
</p>
|
||||
}
|
||||
<div class="flex items-center gap-2">
|
||||
<p class="text-2xl font-bold m-0">{{ book?.metadata!.title }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col justify-between flex-grow">
|
||||
<div class="space-y-4">
|
||||
|
||||
<div class="flex items-start justify-between">
|
||||
<div class="flex flex-col text-center md:text-left w-full">
|
||||
@if (book?.metadata?.seriesName) {
|
||||
<p
|
||||
class="text-blue-600 cursor-pointer hover:underline"
|
||||
(click)="goToSeries(book?.metadata?.seriesName!)"
|
||||
>
|
||||
{{ book?.metadata?.seriesName }}
|
||||
@if (book?.metadata?.seriesNumber) {
|
||||
#{{ book?.metadata?.seriesNumber }}
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
||||
<div class="flex flex-col items-center md:items-start gap-1">
|
||||
<div class="flex items-center gap-2 justify-center md:justify-start flex-wrap text-center md:text-left">
|
||||
<h2 class="text-3xl font-extrabold text-gray-900 dark:text-white leading-tight">
|
||||
{{ book?.metadata!.title }}
|
||||
</h2>
|
||||
<i
|
||||
class="pi"
|
||||
class="pi align-middle"
|
||||
[ngClass]="isMetadataFullyLocked(book?.metadata!) ? 'pi-lock text-red-500' : 'pi-lock-open text-green-500'"
|
||||
[title]="isMetadataFullyLocked(book?.metadata!) ? 'Metadata is locked' : 'Metadata is unlocked'"
|
||||
style="font-size: 1.25rem;"
|
||||
pTooltip="{{ isMetadataFullyLocked(book?.metadata!) ? 'This book metadata is locked.' : 'This book metadata is unlocked.' }}"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
tooltipPosition="top"
|
||||
></i>
|
||||
</div>
|
||||
<p class="text-lg">
|
||||
|
||||
<p class="text-gray-600 dark:text-gray-300 text-lg">
|
||||
@for (author of book?.metadata!.authors; track author; let isLast = $last) {
|
||||
<a class="underline hover:opacity-80 cursor-pointer" (click)="goToAuthorBooks(author)">
|
||||
<a class="hover:underline dark:text-blue-400 cursor-pointer" (click)="goToAuthorBooks(author)">
|
||||
{{ author }}
|
||||
</a>
|
||||
@if (!isLast) {
|
||||
@@ -60,12 +77,13 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 pt-2">
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-start text-sm w-full">
|
||||
|
||||
<div class="flex justify-center sm:justify-start">
|
||||
<div class="flex items-center gap-2">
|
||||
<i class="pi pi-thumbs-up-fill"
|
||||
pTooltip="Personal Rating"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
<i class="pi pi-thumbs-up-fill text-yellow-500" pTooltip="Personal Rating" tooltipPosition="top"></i>
|
||||
<p-rating
|
||||
[ngModel]="book?.metadata!.personalRating"
|
||||
(onRate)="onPersonalRatingChange(book, $event)"
|
||||
@@ -73,281 +91,290 @@
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.personalRating, 10)">
|
||||
</p-rating>
|
||||
</div>
|
||||
@if (book?.metadata!.amazonRating || book?.metadata!.goodreadsRating || book?.metadata!.hardcoverRating) {
|
||||
@if (book?.metadata!.amazonRating) {
|
||||
@if (book?.metadata!.asin) {
|
||||
<span>|</span>
|
||||
<a class="flex items-center gap-1" [href]="'https://www.amazon.com/dp/' + book?.metadata!.asin" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://www.amazon.com/favicon.ico" alt="Amazon"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.amazonRating }}</p>
|
||||
</a>
|
||||
} @else {
|
||||
<span class="flex items-center gap-1">
|
||||
<img src="https://www.amazon.com/favicon.ico" alt="Amazon" class="w-5 h-5 object-contain"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.amazonRating }}</p>
|
||||
</span>
|
||||
}
|
||||
<p-rating [ngModel]="book?.metadata!.amazonRating" readonly stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.amazonRating)">
|
||||
</p-rating>
|
||||
<p class="font-semibold">({{ book?.metadata!.amazonReviewCount | number:'1.0-0' }})</p>
|
||||
@if (book?.metadata!.goodreadsRating || book?.metadata!.hardcoverRating) {
|
||||
<span>|</span>
|
||||
}
|
||||
}
|
||||
@if (book?.metadata!.goodreadsRating) {
|
||||
@if (book?.metadata!.goodreadsId) {
|
||||
<a class="flex items-center gap-1" [href]="'https://www.goodreads.com/book/show/' + book?.metadata!.goodreadsId" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://www.goodreads.com/favicon.ico" alt="Goodreads"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.goodreadsRating }}</p>
|
||||
</a>
|
||||
} @else {
|
||||
<span class="flex items-center gap-1">
|
||||
<img src="https://www.goodreads.com/favicon.ico" alt="Goodreads" class="w-5 h-5 object-contain"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.goodreadsRating }}</p>
|
||||
</span>
|
||||
}
|
||||
<p-rating [ngModel]="book?.metadata!.goodreadsRating" readonly stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.goodreadsRating)">
|
||||
</p-rating>
|
||||
<p class="font-semibold">({{ book?.metadata!.goodreadsReviewCount | number:'1.0-0' }})</p>
|
||||
@if (book?.metadata!.hardcoverRating) {
|
||||
<span>|</span>
|
||||
}
|
||||
}
|
||||
@if (book?.metadata!.hardcoverRating) {
|
||||
@if (book?.metadata!.hardcoverId) {
|
||||
<a class="flex items-center gap-1" [href]="'https://hardcover.app/books/' + book?.metadata!.hardcoverId" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://assets.hardcover.app/static/favicon.ico" alt="Hardcover"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.hardcoverRating }}</p>
|
||||
</a>
|
||||
} @else {
|
||||
<span class="flex items-center gap-1">
|
||||
<img src="https://assets.hardcover.app/static/favicon.ico" alt="Hardcover" class="w-5 h-5 object-contain"/>
|
||||
<p class="font-semibold">{{ book?.metadata!.hardcoverRating }}</p>
|
||||
</span>
|
||||
}
|
||||
<p-rating [ngModel]="book?.metadata!.hardcoverRating" readonly stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColorScaled(book?.metadata!.hardcoverRating)">
|
||||
</p-rating>
|
||||
<p class="font-semibold">({{ book?.metadata!.hardcoverReviewCount | number:'1.0-0' }})</p>
|
||||
@if ((book?.metadata!.amazonRating || book?.metadata!.goodreadsRating || book?.metadata!.hardcoverRating) && book?.metadata!.googleId) {
|
||||
<span>|</span>
|
||||
}
|
||||
}
|
||||
@if (book?.metadata!.googleId) {
|
||||
<a class="flex items-center gap-1" [href]="'https://books.google.com/books?id=' + book?.metadata!.googleId" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://books.google.com/favicon.ico" alt="Google Books"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (book?.metadata?.amazonRating || book?.metadata?.goodreadsRating || book?.metadata?.hardcoverRating || book?.metadata?.googleId) {
|
||||
<span class="hidden sm:inline text-gray-400 text-xl px-1 leading-none">|</span>
|
||||
}
|
||||
|
||||
<div class="flex flex-wrap justify-center sm:justify-start gap-4 pt-1">
|
||||
@if (book?.metadata?.amazonRating) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://www.amazon.com/dp/' + (book.metadata?.asin ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'amazon')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img
|
||||
src="https://www.amazon.com/favicon.ico"
|
||||
alt="Amazon"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
<span class="font-semibold">
|
||||
{{ getRatingPercent(book.metadata!.amazonRating) }}%
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.goodreadsRating) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://www.goodreads.com/book/show/' + (book.metadata?.goodreadsId ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'goodreads')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img
|
||||
src="https://www.goodreads.com/favicon.ico"
|
||||
alt="Goodreads"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
<span class="font-semibold">
|
||||
{{ getRatingPercent(book.metadata!.goodreadsRating) }}%
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.hardcoverRating) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://hardcover.app/books/' + (book.metadata?.hardcoverId ?? '')"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
[pTooltip]="getRatingTooltip(book, 'hardcover')"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
<img
|
||||
src="https://assets.hardcover.app/static/favicon.ico"
|
||||
alt="Hardcover"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
<span class="font-semibold">
|
||||
{{ getRatingPercent(book.metadata!.hardcoverRating) }}%
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (book?.metadata?.googleId) {
|
||||
<a
|
||||
class="flex items-center gap-1"
|
||||
[href]="'https://books.google.com/books?id=' + book.metadata!.googleId"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
src="https://books.google.com/favicon.ico"
|
||||
alt="Google Books"
|
||||
class="w-5 h-5 object-contain transform transition duration-200 hover:scale-125 hover:drop-shadow-lg"
|
||||
/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<div class="overflow-x-auto pt-4 scrollbar-hide max-w-full w-full">
|
||||
</div>
|
||||
|
||||
@if (book?.metadata?.categories?.length) {
|
||||
<div class="overflow-x-auto scrollbar-hide max-w-7xl pt-2 md:pt-0">
|
||||
<div class="flex gap-2 w-max max-w-[1150px]">
|
||||
@for (category of book?.metadata!.categories; track category) {
|
||||
@for (category of book.metadata!.categories; track category) {
|
||||
<a (click)="goToCategory(category)" class="shrink-0 no-underline cursor-pointer">
|
||||
<p-tag [value]="category"></p-tag>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid gap-x-20 gap-y-2 pt-6" style="grid-template-columns: repeat(5, max-content);">
|
||||
<div>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Read Status:</span>
|
||||
<p-tag
|
||||
class="cursor-pointer text-white"
|
||||
[severity]="getStatusSeverity(selectedReadStatus)"
|
||||
(click)="menu.toggle($event)">
|
||||
{{ getStatusLabel(selectedReadStatus) }}
|
||||
</p-tag>
|
||||
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
|
||||
</p>
|
||||
</div>
|
||||
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
|
||||
<span class="font-bold">Publisher: </span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
|
||||
}
|
||||
|
||||
<div class="grid md:grid-cols-3 gap-y-2.5 text-sm pt-2 md:pt-4 text-gray-700 dark:text-gray-300 max-w-5xl">
|
||||
<p class="whitespace-nowrap max-w-[250px] overflow-hidden text-ellipsis">
|
||||
<span class="font-bold">Publisher: </span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
<span class="underline hover:opacity-80 cursor-pointer" (click)="goToPublisher(book?.metadata?.publisher!)">
|
||||
{{ book?.metadata?.publisher }}
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Published:</span> {{ book?.metadata!.publishedDate || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">Language:</span> {{ book?.metadata!.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 10:</span> {{ book?.metadata!.isbn10 || '-' }}</p>
|
||||
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">File Type:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
|
||||
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p><strong>Published:</strong> {{ book?.metadata!.publishedDate || '-' }}</p>
|
||||
<p><strong>Language:</strong> {{ book?.metadata!.language || '-' }}</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">File Type:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200"
|
||||
[ngClass]="getFileTypeColorClass(getFileExtension(book?.filePath))">
|
||||
{{ getFileExtension(book?.filePath) || '-' }}
|
||||
</span>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center">
|
||||
<span class="font-bold mr-2">Progress:</span>
|
||||
<span class="inline-flex items-center">
|
||||
</p>
|
||||
<p><strong>File Size:</strong> {{ getFileSizeInMB(book) }}</p>
|
||||
<p>
|
||||
<strong>ISBN:</strong>
|
||||
@if (book?.metadata?.isbn13 || book?.metadata?.isbn10) {
|
||||
{{ book.metadata!.isbn13 }}
|
||||
@if (book?.metadata?.isbn13 && book?.metadata?.isbn10) {
|
||||
/
|
||||
}
|
||||
{{ book.metadata!.isbn10 }}
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Read Status:</span>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white cursor-pointer"
|
||||
[ngClass]="getStatusSeverityClass(selectedReadStatus)"
|
||||
(click)="menu.toggle($event)">
|
||||
{{ getStatusLabel(selectedReadStatus) }}
|
||||
</span>
|
||||
<p-menu #menu [popup]="true" [model]="readStatusMenuItems"></p-menu>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center">
|
||||
<span class="font-bold mr-2">Progress:</span>
|
||||
<span class="inline-flex items-center">
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
|
||||
[ngClass]="getProgressColorClass(getProgressPercent(book))">
|
||||
{{ getProgressPercent(book) !== null ? getProgressPercent(book) + '%' : 'N/A' }}
|
||||
</span>
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-button
|
||||
pTooltip="Reset progress"
|
||||
tooltipPosition="bottom"
|
||||
icon="pi pi-refresh"
|
||||
size="small"
|
||||
severity="danger"
|
||||
text
|
||||
class="ml-1"
|
||||
(onClick)="resetProgress(book)">
|
||||
@if (getProgressPercent(book) !== null) {
|
||||
<p-button
|
||||
pTooltip="Reset progress"
|
||||
tooltipPosition="bottom"
|
||||
icon="pi pi-refresh"
|
||||
size="small"
|
||||
severity="danger"
|
||||
text
|
||||
class="ml-1 custom-button-padding"
|
||||
(onClick)="resetProgress(book)">
|
||||
</p-button>
|
||||
}
|
||||
}
|
||||
</span>
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Metadata Score:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
</p>
|
||||
<p class="whitespace-nowrap flex items-center gap-2">
|
||||
<span class="font-bold">Metadata Match:</span>
|
||||
@if (book?.metadataMatchScore != null) {
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-lg text-xs font-bold text-gray-200 border"
|
||||
[ngClass]="getMatchScoreColorClass(book?.metadataMatchScore!)">
|
||||
{{ (book?.metadataMatchScore! * 100) | number:'1.0-0' }}%
|
||||
</span>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">File Size:</span> {{ getFileSizeInMB(book) }}</p>
|
||||
<p class="whitespace-nowrap"><span class="font-bold">ISBN 13:</span> {{ book?.metadata!.isbn13 || '-' }}</p>
|
||||
</div>
|
||||
<div class="pt-2 flex items-center gap-2">
|
||||
<span class="font-semibold flex-shrink-0">File Path:</span>
|
||||
<p-toggleButton
|
||||
[(ngModel)]="showFilePath"
|
||||
onIcon="pi pi-eye-slash"
|
||||
offIcon="pi pi-eye"
|
||||
onLabel=""
|
||||
offLabel=""
|
||||
size="small"
|
||||
class="flex-shrink-0 my-visibility-toggle"></p-toggleButton>
|
||||
@if (showFilePath) {
|
||||
<div
|
||||
class="flex items-center gap-4 flex-grow"
|
||||
style="min-width: 0;">
|
||||
<p
|
||||
class="font-mono text-sm text-gray-400 whitespace-nowrap flex-grow"
|
||||
style="min-width: 0;">
|
||||
{{ book?.filePath }}
|
||||
</p>
|
||||
</div>
|
||||
} @else {
|
||||
<span>-</span>
|
||||
}
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div class="pl-6 pt-4 flex flex-row w-full gap-4">
|
||||
@if (book!.bookType === 'PDF') {
|
||||
@if (readMenuItems$ | async; as readItems) {
|
||||
<p-splitbutton
|
||||
label="Read"
|
||||
icon="pi pi-book"
|
||||
[model]="readItems"
|
||||
(onClick)="read(book.id, 'ngx')"
|
||||
severity="info"/>
|
||||
}
|
||||
}
|
||||
@if (book!.bookType !== 'PDF') {
|
||||
<p-button
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-semibold text-sm">File Path:</span>
|
||||
<i
|
||||
class="pi cursor-pointer text-sm"
|
||||
[ngClass]="showFilePath ? 'pi-eye-slash' : 'pi-eye'"
|
||||
(click)="showFilePath = !showFilePath"
|
||||
></i>
|
||||
@if (showFilePath) {
|
||||
<code class="text-xs font-mono truncate text-gray-300">{{ book?.filePath }}</code>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div class="flex flex-wrap gap-3 pt-6">
|
||||
@if (book!.bookType === 'PDF') {
|
||||
@if (readMenuItems$ | async; as readItems) {
|
||||
<p-splitbutton
|
||||
label="Read"
|
||||
icon="pi pi-book"
|
||||
(onClick)="read(book?.metadata!.bookId, undefined)"
|
||||
severity="info"/>
|
||||
[model]="readItems"
|
||||
(onClick)="read(book.id, 'ngx')"
|
||||
severity="primary"/>
|
||||
}
|
||||
}
|
||||
@if (book!.bookType !== 'PDF') {
|
||||
<p-button
|
||||
label="Shelf"
|
||||
icon="pi pi-folder"
|
||||
severity="info"
|
||||
label="Read"
|
||||
icon="pi pi-book"
|
||||
(onClick)="read(book?.metadata!.bookId, undefined)"
|
||||
severity="primary"/>
|
||||
}
|
||||
<p-button
|
||||
label="Shelf"
|
||||
icon="pi pi-folder"
|
||||
severity="secondary"
|
||||
outlined
|
||||
(onClick)="assignShelf(book.id)">
|
||||
</p-button>
|
||||
@if (userData.permissions.canDownload || userData.permissions.admin) {
|
||||
<p-button
|
||||
label="Download"
|
||||
icon="pi pi-download"
|
||||
severity="success"
|
||||
outlined
|
||||
(onClick)="assignShelf(book.id)">
|
||||
(onClick)="download(book.id)">
|
||||
</p-button>
|
||||
@if (userData.permissions.canDownload || userData.permissions.admin) {
|
||||
<p-button
|
||||
label="Download"
|
||||
icon="pi pi-download"
|
||||
severity="info"
|
||||
}
|
||||
@if (userData.permissions.canEmailBook || userData.permissions.admin) {
|
||||
@if (emailMenuItems$ | async; as emailItems) {
|
||||
<p-splitbutton
|
||||
label="Quick Send"
|
||||
icon="pi pi-send"
|
||||
[model]="emailItems"
|
||||
(onClick)="quickSend(book.id)"
|
||||
outlined
|
||||
(onClick)="download(book.id)">
|
||||
</p-button>
|
||||
severity="info">
|
||||
</p-splitbutton>
|
||||
}
|
||||
@if (userData.permissions.canEmailBook || userData.permissions.admin) {
|
||||
@if (emailMenuItems$ | async; as emailItems) {
|
||||
<p-splitbutton
|
||||
label="Quick Send"
|
||||
icon="pi pi-send"
|
||||
[model]="emailItems"
|
||||
(onClick)="quickSend(book.id)"
|
||||
outlined
|
||||
severity="info">
|
||||
</p-splitbutton>
|
||||
}
|
||||
}
|
||||
@if (userData.permissions.canEditMetadata || userData.permissions.admin) {
|
||||
@if (refreshMenuItems$ | async; as refreshItems) {
|
||||
<p-splitbutton
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
[model]="refreshItems"
|
||||
severity="warn"
|
||||
(onClick)="quickRefresh(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-splitbutton>
|
||||
}
|
||||
@if (userData.permissions.canEditMetadata || userData.permissions.admin) {
|
||||
@if (refreshMenuItems$ | async; as refreshItems) {
|
||||
<p-splitbutton
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Auto Fetch'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
[model]="refreshItems"
|
||||
severity="info"
|
||||
(onClick)="quickRefresh(book.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-splitbutton>
|
||||
}
|
||||
}
|
||||
@if (userData.permissions.canDeleteBook || userData.permissions.admin) {
|
||||
@if (otherItems$ | async; as otherItems) {
|
||||
<p-button icon="pi pi-ellipsis-v" outlined severity="danger" (click)="entitymenu.toggle($event)"></p-button>
|
||||
<p-menu #entitymenu [model]="otherItems" [popup]="true" appendTo="body"></p-menu>
|
||||
}
|
||||
@if (userData.permissions.canDeleteBook || userData.permissions.admin) {
|
||||
@if (otherItems$ | async; as otherItems) {
|
||||
<p-button icon="pi pi-ellipsis-v" outlined severity="info" (click)="entitymenu.toggle($event)"></p-button>
|
||||
<p-menu #entitymenu [model]="otherItems" [popup]="true" appendTo="body"></p-menu>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex-1 space-y-2 px-2 min-w-[40rem]">
|
||||
<div class="px-4 pb-2 pt-4 border border-[var(--border-color)] rounded-xl">
|
||||
<div [ngClass]="{ 'line-clamp-5': !isExpanded, 'line-clamp-none': isExpanded }" class="transition-all duration-300 overflow-hidden description-container">
|
||||
<div class="readonly-editor px-2">
|
||||
<p-editor #quillEditor [readonly]="true" [style]="{height: '250px'}" [(ngModel)]="book.metadata!.description">
|
||||
<p-editor #quillEditor [readonly]="true" [style]="{height: '225px'}" [(ngModel)]="book.metadata!.description">
|
||||
<ng-template #header>
|
||||
</ng-template>
|
||||
</p-editor>
|
||||
</div>
|
||||
</div>
|
||||
@if (book.metadata!.description && book.metadata!.description.length > 100) {
|
||||
<div class="text-left">
|
||||
<button pButton
|
||||
type="button"
|
||||
[label]="isExpanded ? 'Show less' : 'Show more'"
|
||||
[icon]="isExpanded ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
|
||||
iconPos="right"
|
||||
class="p-button-text p-button-sm"
|
||||
(click)="toggleExpand()">
|
||||
</button>
|
||||
</div>
|
||||
@if (book.metadata!.description && book.metadata!.description.length > 500) {
|
||||
<p-button
|
||||
[label]="isExpanded ? 'Show less' : 'Show more'"
|
||||
[icon]="isExpanded ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
|
||||
iconPos="right"
|
||||
size="small"
|
||||
text
|
||||
(click)="toggleExpand()">
|
||||
</p-button>
|
||||
}
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
|
||||
<div class="pt-4 space-y-4 pb-6">
|
||||
@if (bookInSeries.length > 0) {
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold pt-2">More in the Series</h3>
|
||||
|
||||
+8
@@ -84,3 +84,11 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::ng-deep .custom-button-padding .p-button {
|
||||
padding-block: 0rem !important;
|
||||
}
|
||||
|
||||
::ng-deep .custom-tag-padding {
|
||||
padding: 0.1rem !important;
|
||||
}
|
||||
|
||||
|
||||
+53
-13
@@ -1,12 +1,12 @@
|
||||
import {Component, DestroyRef, inject, Input, OnChanges, OnInit, Optional, SimpleChanges, ViewChild} from '@angular/core';
|
||||
import {Button, ButtonDirective} from 'primeng/button';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AsyncPipe, DecimalPipe, NgClass} from '@angular/common';
|
||||
import {Observable} from 'rxjs';
|
||||
import {BookService} from '../../../service/book.service';
|
||||
import {Rating, RatingRateEvent} from 'primeng/rating';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Tag} from 'primeng/tag';
|
||||
import {Book, BookMetadata, BookRecommendation, MetadataClearFlags, MetadataUpdateWrapper, ReadStatus} from '../../../model/book.model';
|
||||
import {Book, BookMetadata, BookRecommendation, ReadStatus} from '../../../model/book.model';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {UrlHelperService} from '../../../../utilities/service/url-helper.service';
|
||||
import {UserService} from '../../../../settings/user-management/user.service';
|
||||
@@ -20,7 +20,6 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {Editor} from 'primeng/editor';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {ToggleButton} from 'primeng/togglebutton';
|
||||
import {MetadataFetchOptionsComponent} from '../../metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component';
|
||||
import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
|
||||
import {MetadataRefreshRequest} from '../../model/request/metadata-refresh-request.model';
|
||||
@@ -35,7 +34,7 @@ import {BookCardLiteComponent} from '../../../components/book-card-lite/book-car
|
||||
standalone: true,
|
||||
templateUrl: './metadata-viewer.component.html',
|
||||
styleUrl: './metadata-viewer.component.scss',
|
||||
imports: [Button, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip, DecimalPipe, ButtonDirective, Editor, ProgressBar, ToggleButton, Menu, InfiniteScrollDirective, BookCardLiteComponent]
|
||||
imports: [Button, AsyncPipe, Rating, FormsModule, Tag, Divider, SplitButton, NgClass, Tooltip, DecimalPipe, Editor, ProgressBar, Menu, InfiniteScrollDirective, BookCardLiteComponent]
|
||||
})
|
||||
export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
|
||||
@@ -341,6 +340,30 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
return 'bg-red-600 border-red-700';
|
||||
}
|
||||
|
||||
getStatusSeverityClass(status: string): string {
|
||||
const normalized = status?.toUpperCase();
|
||||
switch (normalized) {
|
||||
case 'UNREAD':
|
||||
return 'bg-gray-500';
|
||||
case 'PAUSED':
|
||||
return 'bg-zinc-600';
|
||||
case 'READING':
|
||||
return 'bg-blue-600';
|
||||
case 'RE_READING':
|
||||
return 'bg-indigo-600';
|
||||
case 'READ':
|
||||
return 'bg-green-600';
|
||||
case 'PARTIALLY_READ':
|
||||
return 'bg-yellow-600';
|
||||
case 'ABANDONED':
|
||||
return 'bg-red-600';
|
||||
case 'WONT_READ':
|
||||
return 'bg-pink-700';
|
||||
default:
|
||||
return 'bg-gray-600';
|
||||
}
|
||||
}
|
||||
|
||||
getProgressColorClass(progress: number | null | undefined): string {
|
||||
if (progress == null) return 'bg-gray-600';
|
||||
return 'bg-blue-500';
|
||||
@@ -410,14 +433,31 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
getStatusSeverity(status: string): 'success' | 'secondary' | 'info' | 'warn' | 'danger' | undefined {
|
||||
const normalized = status?.toUpperCase();
|
||||
if (['UNREAD', 'PAUSED'].includes(normalized)) return 'secondary';
|
||||
if (['READING', 'RE_READING'].includes(normalized)) return 'info';
|
||||
if (['READ'].includes(normalized)) return 'success';
|
||||
if (['PARTIALLY_READ'].includes(normalized)) return 'warn';
|
||||
if (['WONT_READ', 'ABANDONED'].includes(normalized)) return 'danger';
|
||||
return undefined;
|
||||
getRatingTooltip(book: Book, source: 'amazon' | 'goodreads' | 'hardcover'): string {
|
||||
const meta = book?.metadata;
|
||||
if (!meta) return '';
|
||||
|
||||
switch (source) {
|
||||
case 'amazon':
|
||||
return meta.amazonRating != null
|
||||
? `★ ${meta.amazonRating} | ${meta.amazonReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
case 'goodreads':
|
||||
return meta.goodreadsRating != null
|
||||
? `★ ${meta.goodreadsRating} | ${meta.goodreadsReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
case 'hardcover':
|
||||
return meta.hardcoverRating != null
|
||||
? `★ ${meta.hardcoverRating} | ${meta.hardcoverReviewCount?.toLocaleString() ?? '0'} reviews`
|
||||
: '';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
getRatingPercent(rating: number | null | undefined): number {
|
||||
if (rating == null) return 0;
|
||||
return Math.round((rating / 5) * 100);
|
||||
}
|
||||
|
||||
readStatusMenuItems = this.readStatusOptions.map(option => ({
|
||||
@@ -426,7 +466,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
}));
|
||||
|
||||
getStatusLabel(value: string): string {
|
||||
return this.readStatusOptions.find(o => o.value === value)?.label ?? 'Unknown';
|
||||
return this.readStatusOptions.find(o => o.value === value)?.label.toUpperCase() ?? 'N/A';
|
||||
}
|
||||
|
||||
updateReadStatus(status: ReadStatus): void {
|
||||
|
||||
Reference in New Issue
Block a user