Merge pull request #447 from adityachandelgit/develop

Merge Develop into Master for Release
This commit is contained in:
Aditya Chandel
2025-06-05 15:48:47 -06:00
committed by GitHub
26 changed files with 3856 additions and 3797 deletions
+9 -7
View File
@@ -1,8 +1,9 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.4'
id 'org.springframework.boot' version '3.5.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.hibernate.orm' version '6.6.13.Final'
id 'org.hibernate.orm' version '7.0.0.Final'
id 'com.github.ben-manes.versions' version '0.52.0'
}
group = 'com.adityachandel'
@@ -39,7 +40,8 @@ dependencies {
// --- Database & Migration ---
implementation 'org.mariadb.jdbc:mariadb-java-client:3.5.3'
implementation 'org.flywaydb:flyway-mysql:11.8.0'
implementation 'org.flywaydb:flyway-mysql:11.9.0'
implementation 'jakarta.persistence:jakarta.persistence-api:3.2.0'
// --- Security & Authentication ---
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
@@ -51,22 +53,22 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.38'
// --- Book & Image Processing ---
implementation 'org.apache.pdfbox:pdfbox:3.0.4'
implementation 'org.apache.pdfbox:pdfbox:3.0.5'
implementation 'org.apache.pdfbox:jbig2-imageio:3.0.4'
implementation 'com.github.jai-imageio:jai-imageio-core:1.4.0'
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:1.4.0'
implementation 'io.documentnode:epub4j-core:4.2.2'
// --- JSON & Web Scraping ---
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.3'
implementation 'org.jsoup:jsoup:1.19.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.0'
implementation 'org.jsoup:jsoup:1.20.1'
// --- Mapping (DTOs & Entities) ---
implementation 'org.mapstruct:mapstruct:1.6.3'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
// --- API Documentation ---
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.6'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8'
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation 'com.github.junrar:junrar:7.5.5'
implementation 'org.apache.commons:commons-text:1.13.1'
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
@@ -26,7 +26,6 @@ public class BookMetadata {
private Integer seriesTotal;
private String isbn13;
private String isbn10;
private String asin;
private Integer pageCount;
private String language;
private Double rating;
@@ -34,18 +33,22 @@ public class BookMetadata {
private Integer ratingCount;
@Deprecated
private Integer reviewCount;
private String asin;
private Double amazonRating;
private Integer amazonReviewCount;
private String goodreadsId;
private Double goodreadsRating;
private Integer goodreadsReviewCount;
private String hardcoverId;
private Double hardcoverRating;
private Integer hardcoverReviewCount;
private String googleId;
private Instant coverUpdatedOn;
private List<String> authors;
private List<String> categories;
private MetadataProvider provider;
private String providerBookId;
private String thumbnailUrl;
private Boolean titleLocked;
@@ -59,6 +62,10 @@ public class BookMetadata {
private Boolean isbn13Locked;
private Boolean isbn10Locked;
private Boolean asinLocked;
private Boolean amazonIdLocked;
private Boolean goodreadsIdLocked;
private Boolean hardcoverIdLocked;
private Boolean googleIdLocked;
private Boolean pageCountLocked;
private Boolean languageLocked;
private Boolean ratingLocked;
@@ -51,9 +51,6 @@ public class BookMetadataEntity {
@Column(name = "isbn_10", length = 10)
private String isbn10;
@Column(name = "asin", length = 10)
private String asin;
@Column(name = "page_count")
private Integer pageCount;
@@ -90,6 +87,18 @@ public class BookMetadataEntity {
@Column(name = "hardcover_review_count")
private Integer hardcoverReviewCount;
@Column(name = "asin", length = 10)
private String asin;
@Column(name = "goodreads_id", length = 100)
private String goodreadsId;
@Column(name = "hardcover_id", length = 100)
private String hardcoverId;
@Column(name = "google_id", length = 100)
private String googleId;
// Locking fields
@Column(name = "title_locked")
@@ -167,6 +176,15 @@ public class BookMetadataEntity {
@Column(name = "categories_locked")
private Boolean categoriesLocked = Boolean.FALSE;
@Column(name = "goodreads_id_locked")
private Boolean goodreadsIdLocked = Boolean.FALSE;
@Column(name = "hardcover_id_locked")
private Boolean hardcoverIdLocked = Boolean.FALSE;
@Column(name = "google_id_locked")
private Boolean googleIdLocked = Boolean.FALSE;
@OneToOne(fetch = FetchType.LAZY)
@MapsId
@JoinColumn(name = "book_id")
@@ -214,6 +232,9 @@ public class BookMetadataEntity {
this.goodreadsReviewCountLocked = lock;
this.hardcoverRatingLocked = lock;
this.hardcoverReviewCountLocked = lock;
this.goodreadsIdLocked = lock;
this.hardcoverIdLocked = lock;
this.googleIdLocked = lock;
}
public boolean areAllFieldsLocked() {
@@ -239,6 +260,9 @@ public class BookMetadataEntity {
&& Boolean.TRUE.equals(this.goodreadsReviewCountLocked)
&& Boolean.TRUE.equals(this.hardcoverRatingLocked)
&& Boolean.TRUE.equals(this.hardcoverReviewCountLocked)
&& Boolean.TRUE.equals(this.goodreadsIdLocked)
&& Boolean.TRUE.equals(this.hardcoverIdLocked)
&& Boolean.TRUE.equals(this.googleIdLocked)
;
}
}
@@ -174,6 +174,17 @@ public class BookMetadataService {
metadata.setTitle(resolveFieldAsString(metadataMap, fieldOptions.getTitle(), BookMetadata::getTitle));
metadata.setDescription(resolveFieldAsString(metadataMap, fieldOptions.getDescription(), BookMetadata::getDescription));
metadata.setAuthors(resolveFieldAsList(metadataMap, fieldOptions.getAuthors(), BookMetadata::getAuthors));
if (metadataMap.containsKey(GoodReads)) {
metadata.setGoodreadsId(metadataMap.get(GoodReads).getGoodreadsId());
}
if (metadataMap.containsKey(Hardcover)) {
metadata.setHardcoverId(metadataMap.get(Hardcover).getHardcoverId());
}
if (metadataMap.containsKey(Google)) {
metadata.setGoogleId(metadataMap.get(Google).getGoogleId());
}
if (request.getRefreshOptions().isMergeCategories()) {
metadata.setCategories(getAllCategories(metadataMap, fieldOptions.getCategories(), BookMetadata::getCategories));
} else {
@@ -42,6 +42,15 @@ public class BookMetadataUpdater {
return metadata;
}
if ((metadata.getGoodreadsIdLocked() == null || !metadata.getGoodreadsIdLocked()) && newMetadata.getGoodreadsId() != null) {
metadata.setGoodreadsId(newMetadata.getGoodreadsId().isBlank() ? null : newMetadata.getGoodreadsId());
}
if ((metadata.getHardcoverIdLocked() == null || !metadata.getHardcoverIdLocked()) && newMetadata.getHardcoverId() != null) {
metadata.setHardcoverId(newMetadata.getHardcoverId().isBlank() ? null : newMetadata.getHardcoverId());
}
if ((metadata.getGoogleIdLocked() == null || !metadata.getGoogleIdLocked()) && newMetadata.getGoogleId() != null) {
metadata.setGoogleId(newMetadata.getGoogleId().isBlank() ? null : newMetadata.getGoogleId());
}
if ((metadata.getTitleLocked() == null || !metadata.getTitleLocked()) && newMetadata.getTitle() != null) {
metadata.setTitle(newMetadata.getTitle().isEmpty() ? null : newMetadata.getTitle());
}
@@ -179,6 +188,15 @@ public class BookMetadataUpdater {
if (newMetadata.getAsinLocked() != null) {
metadata.setAsinLocked(newMetadata.getAsinLocked());
}
if (newMetadata.getGoodreadsIdLocked() != null) {
metadata.setGoodreadsIdLocked(newMetadata.getGoodreadsIdLocked());
}
if (newMetadata.getHardcoverIdLocked() != null) {
metadata.setHardcoverIdLocked(newMetadata.getHardcoverIdLocked());
}
if (newMetadata.getGoogleIdLocked() != null) {
metadata.setGoogleIdLocked(newMetadata.getGoogleIdLocked());
}
if (newMetadata.getPageCountLocked() != null) {
metadata.setPageCountLocked(newMetadata.getPageCountLocked());
}
@@ -142,7 +142,6 @@ public class AmazonBookParser implements BookParser {
log.info("Amazon: Fetching metadata for: {}", amazonBookId);
Document doc = fetchDocument(BASE_BOOK_URL + amazonBookId);
return BookMetadata.builder()
.providerBookId(amazonBookId)
.provider(MetadataProvider.Amazon)
.title(getTitle(doc))
.subtitle(getSubtitle(doc))
@@ -58,21 +58,21 @@ public class GoodReadsParser implements BookParser {
for (BookMetadata preview : previews) {
log.info("GoodReads: Fetching metadata for: {}", preview.getTitle());
try {
Document document = fetchDoc(BASE_BOOK_URL + preview.getProviderBookId());
BookMetadata detailedMetadata = parseBookDetails(document, preview.getProviderBookId());
Document document = fetchDoc(BASE_BOOK_URL + preview.getGoodreadsId());
BookMetadata detailedMetadata = parseBookDetails(document, preview.getGoodreadsId());
if (detailedMetadata != null) {
fetchedMetadata.add(detailedMetadata);
}
Thread.sleep(Duration.ofSeconds(1));
} catch (Exception e) {
log.error("Error fetching metadata for book: {}", preview.getProviderBookId(), e);
log.error("Error fetching metadata for book: {}", preview.getGoodreadsId(), e);
}
}
return fetchedMetadata;
}
private BookMetadata parseBookDetails(Document document, String providerBookId) {
BookMetadata.BookMetadataBuilder builder = BookMetadata.builder().providerBookId(providerBookId);
private BookMetadata parseBookDetails(Document document, String goodreadsId) {
BookMetadata.BookMetadataBuilder builder = BookMetadata.builder().goodreadsId(goodreadsId);
builder.provider(MetadataProvider.GoodReads);
try {
JSONObject apolloStateJson = getJson(document)
@@ -87,7 +87,7 @@ public class GoodReadsParser implements BookParser {
extractBookDetails(apolloStateJson, keySet, builder);
extractWorkDetails(apolloStateJson, keySet, builder);
} catch (Exception e) {
log.error("Error parsing book details for providerBookId: {}", providerBookId, e);
log.error("Error parsing book details for providerBookId: {}", goodreadsId, e);
return null;
}
@@ -331,7 +331,7 @@ public class GoodReadsParser implements BookParser {
}
}
BookMetadata previewMetadata = BookMetadata.builder()
.providerBookId(String.valueOf(extractGoodReadsIdPreview(previewBook)))
.goodreadsId(String.valueOf(extractGoodReadsIdPreview(previewBook)))
.title(extractTitlePreview(previewBook))
.authors(authors)
.build();
@@ -88,7 +88,7 @@ public class GoogleParser implements BookParser {
return BookMetadata.builder()
.provider(MetadataProvider.Google)
.providerBookId(item.getId())
.googleId(item.getId())
.title(volumeInfo.getTitle())
.subtitle(volumeInfo.getSubtitle())
.publisher(volumeInfo.getPublisher())
@@ -57,7 +57,7 @@ public class HardcoverParser implements BookParser {
.map(hit -> {
GraphQLResponse.Document doc = hit.getDocument();
BookMetadata metadata = new BookMetadata();
metadata.setProviderBookId(doc.getSlug());
metadata.setHardcoverId(doc.getSlug());
metadata.setTitle(doc.getTitle());
metadata.setDescription(doc.getDescription());
metadata.setAuthors(doc.getAuthorNames());
@@ -1,20 +1,21 @@
package com.adityachandel.booklore.service.recommender;
import com.adityachandel.booklore.config.security.AuthenticationService;
import com.adityachandel.booklore.exception.ApiError;
import com.adityachandel.booklore.mapper.BookMapper;
import com.adityachandel.booklore.model.dto.Book;
import com.adityachandel.booklore.model.dto.BookRecommendation;
import com.adityachandel.booklore.model.dto.BookRecommendationLite;
import com.adityachandel.booklore.model.dto.*;
import com.adityachandel.booklore.model.entity.AuthorEntity;
import com.adityachandel.booklore.model.entity.BookEntity;
import com.adityachandel.booklore.model.entity.BookMetadataEntity;
import com.adityachandel.booklore.repository.BookRepository;
import com.adityachandel.booklore.service.user.UserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.AbstractMap.SimpleEntry;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@@ -25,11 +26,14 @@ public class BookRecommendationService {
private final BookSimilarityService similarityService;
private final BookRepository bookRepository;
private final BookMapper bookMapper;
private final AuthenticationService authenticationService;
private static final int MAX_BOOKS_PER_AUTHOR = 3;
public List<BookRecommendation> getRecommendations(Long bookId, int limit) {
BookEntity book = bookRepository.findById(bookId).orElseThrow(() -> ApiError.BOOK_NOT_FOUND.createException(bookId));
BookEntity book = bookRepository.findById(bookId)
.orElseThrow(() -> ApiError.BOOK_NOT_FOUND.createException(bookId));
List<BookRecommendationLite> recommendations = book.getSimilarBooksJson();
if (recommendations == null || recommendations.isEmpty()) {
log.info("Recommendations for book ID {} are missing or empty. Computing similarity...", bookId);
@@ -37,19 +41,28 @@ public class BookRecommendationService {
book.setSimilarBooksJson(recommendations);
bookRepository.save(book);
}
List<Long> recommendedBookIds = recommendations.stream()
.map(BookRecommendationLite::getB)
.collect(Collectors.toList());
BookLoreUser user = authenticationService.getAuthenticatedUser();
Set<Long> accessibleLibraryIds = user.getAssignedLibraries().stream()
.map(Library::getId)
.collect(Collectors.toSet());
Map<Long, BookEntity> recommendedBooksMap = bookRepository.findAllById(recommendedBookIds).stream()
.collect(Collectors.toMap(BookEntity::getId, bookEntity -> bookEntity));
.filter(b -> b.getLibrary() != null && accessibleLibraryIds.contains(b.getLibrary().getId()))
.collect(Collectors.toMap(BookEntity::getId, Function.identity()));
return recommendations.stream()
.limit(limit)
.map(id -> {
BookEntity recommendedBook = recommendedBooksMap.get(id.getB());
return new BookRecommendation(bookMapper.toBookWithDescription(recommendedBook, false), id.getS());
.map(rec -> {
BookEntity bookEntity = recommendedBooksMap.get(rec.getB());
if (bookEntity == null) return null;
return new BookRecommendation(bookMapper.toBookWithDescription(bookEntity, false), rec.getS());
})
.filter(Objects::nonNull)
.limit(limit)
.collect(Collectors.toList());
}
@@ -0,0 +1,7 @@
ALTER TABLE book_metadata
ADD COLUMN goodreads_id VARCHAR(100),
ADD COLUMN hardcover_id VARCHAR(100),
ADD COLUMN google_id VARCHAR(100),
ADD COLUMN goodreads_id_locked BOOLEAN DEFAULT FALSE,
ADD COLUMN hardcover_id_locked BOOLEAN DEFAULT FALSE,
ADD COLUMN google_id_locked BOOLEAN DEFAULT FALSE;
+3422 -3588
View File
File diff suppressed because it is too large Load Diff
+41 -41
View File
@@ -12,53 +12,53 @@
},
"private": true,
"dependencies": {
"@angular/animations": "19.2.6",
"@angular/common": "19.2.6",
"@angular/compiler": "19.2.6",
"@angular/core": "19.2.6",
"@angular/forms": "19.2.6",
"@angular/platform-browser": "19.2.6",
"@angular/platform-browser-dynamic": "19.2.6",
"@angular/router": "19.2.6",
"@iharbeck/ngx-virtual-scroller": "19.0.1",
"@primeng/themes": "19.0.10",
"@stomp/rx-stomp": "2.0.1",
"@stomp/stompjs": "7.1.1",
"@tailwindcss/postcss": "^4.1.4",
"angular-oauth2-oidc": "^19.0.0",
"epubjs": "0.3.93",
"jwt-decode": "4.0.0",
"ng-lazyload-image": "9.1.3",
"ngx-extended-pdf-viewer": "23.1.0",
"ngx-infinite-scroll": "19.0.0",
"primeicons": "7.0.0",
"primeng": "19.0.10",
"quill": "2.0.2",
"rxjs": "7.8.2",
"@angular/animations": "^20.0.1",
"@angular/common": "^20.0.1",
"@angular/compiler": "^20.0.1",
"@angular/core": "^20.0.1",
"@angular/forms": "^20.0.1",
"@angular/platform-browser": "^20.0.1",
"@angular/platform-browser-dynamic": "^20.0.1",
"@angular/router": "^20.0.1",
"@iharbeck/ngx-virtual-scroller": "^19.0.1",
"@primeng/themes": "^19.1.3",
"@stomp/rx-stomp": "^2.0.1",
"@stomp/stompjs": "^7.1.1",
"@tailwindcss/postcss": "^4.1.8",
"angular-oauth2-oidc": "^20.0.0",
"epubjs": "^0.3.93",
"jwt-decode": "^4.0.0",
"ng-lazyload-image": "^9.1.3",
"ngx-extended-pdf-viewer": "^23.3.1",
"ngx-infinite-scroll": "^19.0.0",
"primeicons": "^7.0.0",
"primeng": "^19.1.3",
"quill": "^2.0.3",
"rxjs": "^7.8.2",
"showdown": "^2.1.0",
"tailwindcss-primeui": "0.6.1",
"tslib": "2.8.1",
"ws": "8.18.1",
"zone.js": "0.15.0"
"tailwindcss-primeui": "^0.6.1",
"tslib": "^2.8.1",
"ws": "^8.18.2",
"zone.js": "^0.15.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "19.2.7",
"@angular/cli": "19.2.7",
"@angular/compiler-cli": "19.2.6",
"@angular-devkit/build-angular": "^20.0.1",
"@angular/cli": "^20.0.1",
"@angular/compiler-cli": "^20.0.1",
"@tailwindcss/typography": "^0.5.16",
"@types/jasmine": "5.1.7",
"@types/jasmine": "^5.1.8",
"@types/showdown": "^2.0.6",
"angular-eslint": "^19.4.0",
"autoprefixer": "10.4.21",
"eslint": "^9.27.0",
"jasmine-core": "5.6.0",
"karma": "6.4.0",
"karma-chrome-launcher": "3.2.0",
"karma-coverage": "2.2.0",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.1.0",
"angular-eslint": "^19.7.1",
"autoprefixer": "^10.4.21",
"eslint": "^9.28.0",
"jasmine-core": "^5.7.1",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage": "^2.2.1",
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"tailwindcss": "3.4.17",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1"
"typescript-eslint": "^8.33.1"
}
}
@@ -92,11 +92,11 @@
}
.info-btn {
top: 25%;
top: 18%;
}
.read-btn {
bottom: 25%;
bottom: 18%;
}
.cover-container:hover .info-btn,
@@ -98,7 +98,7 @@
<!-- Categories and Published Date -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-2/3">
<div class="flex flex-col gap-1 w-3/4">
<label for="categories">Categories</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="categories" formControlName="categories" class="w-full"/>
@@ -106,7 +106,7 @@
<p-button *ngIf="metadata['categoriesLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('categories')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/3">
<div class="flex flex-col gap-1 w-1/8">
<label for="publishedDate">Publish Date</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full"/>
@@ -114,39 +114,7 @@
<p-button *ngIf="metadata['publishedDateLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="warn"></p-button>
</div>
</div>
</div>
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 basis-3/6">
<label for="seriesName">Series Name</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesName" formControlName="seriesName" class="w-full"/>
<p-button *ngIf="!metadata['seriesNameLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesNameLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 basis-1/6">
<label for="seriesNumber">Book Number</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full"/>
<p-button *ngIf="!metadata['seriesNumberLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesNumberLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 basis-1/6">
<label for="seriesTotal">Books in Series</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full"/>
<p-button *ngIf="!metadata['seriesTotalLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesTotalLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 basis-1/6">
<div class="flex flex-col gap-1 w-1/8">
<label for="language">Language</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="language" formControlName="language" class="w-full"/>
@@ -156,9 +124,40 @@
</div>
</div>
<!-- ISBN, Language, Review Count -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/4">
<div class="flex flex-col gap-1 basis-3/4">
<label for="seriesName">Series Name</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesName" formControlName="seriesName" class="w-full"/>
<p-button *ngIf="!metadata['seriesNameLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesNameLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 basis-1/8">
<label for="seriesNumber">Book Number</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full"/>
<p-button *ngIf="!metadata['seriesNumberLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesNumberLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 basis-1/8">
<label for="seriesTotal">Books in Series</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full"/>
<p-button *ngIf="!metadata['seriesTotalLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
<p-button *ngIf="metadata['seriesTotalLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="warn"></p-button>
</div>
</div>
</div>
<!-- ISBN, ASIN, Language -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 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"/>
@@ -166,7 +165,7 @@
<p-button *ngIf="metadata['isbn10Locked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('isbn10')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/4">
<div class="flex flex-col gap-1 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"/>
@@ -174,36 +173,16 @@
<p-button *ngIf="metadata['isbn13Locked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('isbn13')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/4">
<label for="asin">ASIN</label>
<div class="flex flex-col gap-1 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"/>
<p-button *ngIf="!metadata['asinLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('asin')" severity="success"></p-button>
<p-button *ngIf="metadata['asinLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('asin')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 basis-1/4">
<label for="pageCount">Page Count</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="pageCount" formControlName="pageCount" class="w-full"/>
<p-button *ngIf="!metadata['pageCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('pageCount')" severity="success"></p-button>
<p-button *ngIf="metadata['pageCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('pageCount')" severity="warn"></p-button>
</div>
</div>
</div>
<!-- Review Count, Rating, Page Count -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 w-1/6">
<label for="amazonRatingCount">Amazon Rating Count</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="amazonRatingCount" formControlName="amazonReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['amazonReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['amazonReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/6">
<label for="amazonRating">Amazon Rating</label>
<label for="amazonRating">Amazon ★</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="amazonRating" formControlName="amazonRating" class="w-full"/>
<p-button *ngIf="!metadata['amazonRatingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonRating')" severity="success"></p-button>
@@ -211,15 +190,35 @@
</div>
</div>
<div class="flex flex-col gap-1 w-1/6">
<label for="goodreadsReviewCount">Goodreads Rating Count</label>
<label for="amazonRatingCount">Amazon Reviews</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="goodreadsReviewCount" formControlName="goodreadsReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['goodreadsReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['goodreadsReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="warn"></p-button>
<input pInputText id="amazonRatingCount" formControlName="amazonReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['amazonReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['amazonReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('amazonReviewCount')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/6">
<label for="goodreadsRating">Goodreads Rating</label>
<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"/>
<p-button *ngIf="!metadata['googleIdLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('googleId')" severity="success"></p-button>
<p-button *ngIf="metadata['googleIdLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('googleId')" severity="warn"></p-button>
</div>
</div>
</div>
<!-- Ratings and Reviews -->
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
<div class="flex flex-col gap-1 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"/>
<p-button *ngIf="!metadata['goodreadsIdLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsId')" severity="success"></p-button>
<p-button *ngIf="metadata['goodreadsIdLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsId')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 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"/>
<p-button *ngIf="!metadata['goodreadsRatingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsRating')" severity="success"></p-button>
@@ -227,21 +226,37 @@
</div>
</div>
<div class="flex flex-col gap-1 w-1/6">
<label for="hardcoverReviewCount">Hardcover Rating Count</label>
<label for="goodreadsReviewCount">Goodreads Reviews</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="hardcoverReviewCount" formControlName="hardcoverReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['hardcoverReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['hardcoverReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverReviewCount')" severity="warn"></p-button>
<input pInputText id="goodreadsReviewCount" formControlName="goodreadsReviewCount" class="w-full"/>
<p-button *ngIf="!metadata['goodreadsReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['goodreadsReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('goodreadsReviewCount')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 w-1/6">
<label for="hardcoverRating">Hardcover Rating</label>
<label for="hardcoverId">Hardcover ID</label>
<div class="flex justify-between items-center gap-2">
<input pInputText id="hardcoverId" formControlName="hardcoverId" class="w-full"/>
<p-button *ngIf="!metadata['hardcoverIdLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverId')" severity="success"></p-button>
<p-button *ngIf="metadata['hardcoverIdLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverId')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 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"/>
<p-button *ngIf="!metadata['hardcoverRatingLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverRating')" severity="success"></p-button>
<p-button *ngIf="metadata['hardcoverRatingLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverRating')" severity="warn"></p-button>
</div>
</div>
<div class="flex flex-col gap-1 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"/>
<p-button *ngIf="!metadata['hardcoverReviewCountLocked']" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('hardcoverReviewCount')" severity="success"></p-button>
<p-button *ngIf="metadata['hardcoverReviewCountLocked']" icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('hardcoverReviewCount')" severity="warn"></p-button>
</div>
</div>
</div>
</div>
@@ -69,18 +69,21 @@ export class MetadataEditorComponent implements OnInit {
publishedDate: new FormControl(''),
isbn10: new FormControl(''),
isbn13: new FormControl(''),
asin: new FormControl(''),
description: new FormControl(''),
pageCount: new FormControl(''),
language: new FormControl(''),
rating: new FormControl(''),
reviewCount: new FormControl(''),
asin: new FormControl(''),
amazonRating: new FormControl(''),
amazonReviewCount: new FormControl(''),
goodreadsId: new FormControl(''),
goodreadsRating: new FormControl(''),
goodreadsReviewCount: new FormControl(''),
hardcoverId: new FormControl(''),
hardcoverRating: new FormControl(''),
hardcoverReviewCount: new FormControl(''),
googleId: new FormControl(''),
seriesName: new FormControl(''),
seriesNumber: new FormControl(''),
seriesTotal: new FormControl(''),
@@ -93,18 +96,21 @@ export class MetadataEditorComponent implements OnInit {
publishedDateLocked: new FormControl(false),
isbn10Locked: new FormControl(false),
isbn13Locked: new FormControl(false),
asinLocked: new FormControl(false),
descriptionLocked: new FormControl(false),
pageCountLocked: new FormControl(false),
languageLocked: new FormControl(false),
ratingLocked: new FormControl(false),
reviewCountLocked: new FormControl(false),
asinLocked: new FormControl(false),
amazonRatingLocked: new FormControl(false),
amazonReviewCountLocked: new FormControl(false),
goodreadsIdLocked: new FormControl(''),
goodreadsRatingLocked: new FormControl(false),
goodreadsReviewCountLocked: new FormControl(false),
hardcoverIdLocked: new FormControl(false),
hardcoverRatingLocked: new FormControl(false),
hardcoverReviewCountLocked: new FormControl(false),
googleIdLocked: new FormControl(false),
seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false),
@@ -131,18 +137,21 @@ export class MetadataEditorComponent implements OnInit {
publishedDate: metadata.publishedDate || null,
isbn10: metadata.isbn10 || null,
isbn13: metadata.isbn13 || null,
asin: metadata.asin || null,
description: metadata.description || null,
pageCount: metadata.pageCount || null,
language: metadata.language || null,
rating: metadata.rating || null,
reviewCount: metadata.reviewCount || null,
asin: metadata.asin || null,
amazonRating: metadata.amazonRating || null,
amazonReviewCount: metadata.amazonReviewCount || null,
goodreadsId: metadata.goodreadsId || null,
goodreadsRating: metadata.goodreadsRating || null,
goodreadsReviewCount: metadata.goodreadsReviewCount || null,
hardcoverId: metadata.hardcoverId || null,
hardcoverRating: metadata.hardcoverRating || null,
hardcoverReviewCount: metadata.hardcoverReviewCount || null,
googleId: metadata.googleId || null,
seriesName: metadata.seriesName || null,
seriesNumber: metadata.seriesNumber || null,
seriesTotal: metadata.seriesTotal || null,
@@ -155,18 +164,21 @@ export class MetadataEditorComponent implements OnInit {
publishedDateLocked: metadata.publishedDateLocked || false,
isbn10Locked: metadata.isbn10Locked || false,
isbn13Locked: metadata.isbn13Locked || false,
asinLocked: metadata.asinLocked || false,
descriptionLocked: metadata.descriptionLocked || false,
pageCountLocked: metadata.pageCountLocked || false,
languageLocked: metadata.languageLocked || false,
ratingLocked: metadata.ratingLocked || false,
reviewCountLocked: metadata.reviewCountLocked || false,
asinLocked: metadata.asinLocked || false,
amazonRatingLocked: metadata.amazonRatingLocked || false,
amazonReviewCountLocked: metadata.amazonReviewCountLocked || false,
goodreadsIdLocked: metadata.goodreadsIdLocked || false,
goodreadsRatingLocked: metadata.goodreadsRatingLocked || false,
goodreadsReviewCountLocked: metadata.goodreadsReviewCountLocked || false,
hardcoverIdLocked: metadata.hardcoverIdLocked || false,
hardcoverRatingLocked: metadata.hardcoverRatingLocked || false,
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked || false,
googleIdLocked: metadata.googleIdLocked || false,
seriesNameLocked: metadata.seriesNameLocked || false,
seriesNumberLocked: metadata.seriesNumberLocked || false,
seriesTotalLocked: metadata.seriesTotalLocked || false,
@@ -174,30 +186,33 @@ export class MetadataEditorComponent implements OnInit {
});
const lockableFields: { key: keyof BookMetadata, control: string }[] = [
{ key: 'titleLocked', control: 'title' },
{ key: 'subtitleLocked', control: 'subtitle' },
{ key: 'authorsLocked', control: 'authors' },
{ key: 'categoriesLocked', control: 'categories' },
{ key: 'publisherLocked', control: 'publisher' },
{ key: 'publishedDateLocked', control: 'publishedDate' },
{ key: 'languageLocked', control: 'language' },
{ key: 'isbn10Locked', control: 'isbn10' },
{ key: 'isbn13Locked', control: 'isbn13' },
{ key: 'asinLocked', control: 'asin'},
{ key: 'amazonReviewCountLocked', control: 'amazonReviewCount' },
{ key: 'amazonRatingLocked', control: 'amazonRating' },
{ key: 'goodreadsReviewCountLocked', control: 'goodreadsReviewCount' },
{ key: 'goodreadsRatingLocked', control: 'goodreadsRating' },
{ key: 'hardcoverReviewCountLocked', control: 'hardcoverReviewCount' },
{ key: 'hardcoverRatingLocked', control: 'hardcoverRating' },
{ key: 'pageCountLocked', control: 'pageCount' },
{ key: 'descriptionLocked', control: 'description' },
{ key: 'seriesNameLocked', control: 'seriesName' },
{ key: 'seriesNumberLocked', control: 'seriesNumber' },
{ key: 'seriesTotalLocked', control: 'seriesTotal' }
{key: 'titleLocked', control: 'title'},
{key: 'subtitleLocked', control: 'subtitle'},
{key: 'authorsLocked', control: 'authors'},
{key: 'categoriesLocked', control: 'categories'},
{key: 'publisherLocked', control: 'publisher'},
{key: 'publishedDateLocked', control: 'publishedDate'},
{key: 'languageLocked', control: 'language'},
{key: 'isbn10Locked', control: 'isbn10'},
{key: 'isbn13Locked', control: 'isbn13'},
{key: 'asinLocked', control: 'asin'},
{key: 'amazonReviewCountLocked', control: 'amazonReviewCount'},
{key: 'amazonRatingLocked', control: 'amazonRating'},
{key: 'goodreadsIdLocked', control: 'goodreadsId'},
{key: 'goodreadsReviewCountLocked', control: 'goodreadsReviewCount'},
{key: 'goodreadsRatingLocked', control: 'goodreadsRating'},
{key: 'hardcoverIdLocked', control: 'hardcoverId'},
{key: 'hardcoverReviewCountLocked', control: 'hardcoverReviewCount'},
{key: 'hardcoverRatingLocked', control: 'hardcoverRating'},
{key: 'googleIdLocked', control: 'googleId'},
{key: 'pageCountLocked', control: 'pageCount'},
{key: 'descriptionLocked', control: 'description'},
{key: 'seriesNameLocked', control: 'seriesName'},
{key: 'seriesNumberLocked', control: 'seriesNumber'},
{key: 'seriesTotalLocked', control: 'seriesTotal'}
];
lockableFields.forEach(({ key, control }) => {
lockableFields.forEach(({key, control}) => {
const isLocked = metadata[key] === true;
const formControl = this.metadataForm.get(control);
if (formControl) {
@@ -278,7 +293,7 @@ export class MetadataEditorComponent implements OnInit {
this.htmlTextarea = value;
const control = this.metadataForm.get('description');
if (control?.value !== value) {
control?.patchValue(value, { emitEvent: false });
control?.patchValue(value, {emitEvent: false});
if (this.quillEditor && this.quillEditor.quill) {
this.quillEditor.quill.root.innerHTML = value;
}
@@ -296,17 +311,20 @@ export class MetadataEditorComponent implements OnInit {
publishedDate: this.metadataForm.get('publishedDate')?.value,
isbn10: this.metadataForm.get('isbn10')?.value,
isbn13: this.metadataForm.get('isbn13')?.value,
asin: this.metadataForm.get('asin')?.value,
description: this.metadataForm.get('description')?.value,
pageCount: this.metadataForm.get('pageCount')?.value,
rating: this.metadataForm.get('rating')?.value,
reviewCount: this.metadataForm.get('reviewCount')?.value,
asin: this.metadataForm.get('asin')?.value,
amazonRating: this.metadataForm.get('amazonRating')?.value,
amazonReviewCount: this.metadataForm.get('amazonReviewCount')?.value,
goodreadsId: this.metadataForm.get('goodreadsId')?.value,
goodreadsRating: this.metadataForm.get('goodreadsRating')?.value,
goodreadsReviewCount: this.metadataForm.get('goodreadsReviewCount')?.value,
hardcoverId: this.metadataForm.get('hardcoverId')?.value,
hardcoverRating: this.metadataForm.get('hardcoverRating')?.value,
hardcoverReviewCount: this.metadataForm.get('hardcoverReviewCount')?.value,
googleId: this.metadataForm.get('googleId')?.value,
language: this.metadataForm.get('language')?.value,
seriesName: this.metadataForm.get('seriesName')?.value,
seriesNumber: this.metadataForm.get('seriesNumber')?.value,
@@ -320,18 +338,21 @@ export class MetadataEditorComponent implements OnInit {
publishedDateLocked: this.metadataForm.get('publishedDateLocked')?.value,
isbn10Locked: this.metadataForm.get('isbn10Locked')?.value,
isbn13Locked: this.metadataForm.get('isbn13Locked')?.value,
asinLocked: this.metadataForm.get('asinLocked')?.value,
descriptionLocked: this.metadataForm.get('descriptionLocked')?.value,
pageCountLocked: this.metadataForm.get('pageCountLocked')?.value,
languageLocked: this.metadataForm.get('languageLocked')?.value,
ratingLocked: this.metadataForm.get('ratingLocked')?.value,
asinLocked: this.metadataForm.get('asinLocked')?.value,
reviewCountLocked: this.metadataForm.get('reviewCountLocked')?.value,
amazonRatingLocked: this.metadataForm.get('amazonRatingLocked')?.value,
amazonReviewCountLocked: this.metadataForm.get('amazonReviewCountLocked')?.value,
goodreadsIdLocked: this.metadataForm.get('goodreadsIdLocked')?.value,
goodreadsRatingLocked: this.metadataForm.get('goodreadsRatingLocked')?.value,
goodreadsReviewCountLocked: this.metadataForm.get('goodreadsReviewCountLocked')?.value,
hardcoverIdLocked: this.metadataForm.get('hardcoverIdLocked')?.value,
hardcoverRatingLocked: this.metadataForm.get('hardcoverRatingLocked')?.value,
hardcoverReviewCountLocked: this.metadataForm.get('hardcoverReviewCountLocked')?.value,
googleIdLocked: this.metadataForm.get('googleIdLocked')?.value,
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value,
@@ -54,13 +54,16 @@ export class MetadataPickerComponent implements OnInit {
{label: 'Book #', controlName: 'seriesNumber', lockedKey: 'seriesNumberLocked', fetchedKey: 'seriesNumber'},
{label: 'Total Books', controlName: 'seriesTotal', lockedKey: 'seriesTotalLocked', fetchedKey: 'seriesTotal'},
{label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'},
{label: 'ASIN', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'},
{label: 'Amazon ID (ASIN)', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'},
{label: 'Amazon Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
{label: 'Amazon Rating', controlName: 'amazonRating', lockedKey: 'amazonRatingLocked', fetchedKey: 'amazonRating'},
{label: 'Goodreads ID', controlName: 'goodreadsId', lockedKey: 'goodreadsIdLocked', fetchedKey: 'goodreadsId'},
{label: 'Goodreads Reviews', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount'},
{label: 'Goodreads Rating', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating'},
{label: 'Hardcover ID', controlName: 'hardcoverId', lockedKey: 'hardcoverIdLocked', fetchedKey: 'hardcoverId'},
{label: 'Hardcover Reviews', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount'},
{label: 'Hardcover Rating', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'Google Books ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleIdRating'},
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'}
];
@@ -90,16 +93,19 @@ export class MetadataPickerComponent implements OnInit {
publishedDate: new FormControl(''),
isbn10: new FormControl(''),
isbn13: new FormControl(''),
asin: new FormControl(''),
description: new FormControl(''),
pageCount: new FormControl(''),
language: new FormControl(''),
asin: new FormControl(''),
amazonRating: new FormControl(''),
amazonReviewCount: new FormControl(''),
goodreadsId: new FormControl(''),
goodreadsRating: new FormControl(''),
goodreadsReviewCount: new FormControl(''),
hardcoverId: new FormControl(''),
hardcoverRating: new FormControl(''),
hardcoverReviewCount: new FormControl(''),
googleId: new FormControl(''),
seriesName: new FormControl(''),
seriesNumber: new FormControl(''),
seriesTotal: new FormControl(''),
@@ -113,16 +119,19 @@ export class MetadataPickerComponent implements OnInit {
publishedDateLocked: new FormControl(false),
isbn10Locked: new FormControl(false),
isbn13Locked: new FormControl(false),
asinLocked: new FormControl(false),
descriptionLocked: new FormControl(false),
pageCountLocked: new FormControl(false),
languageLocked: new FormControl(false),
asinLocked: new FormControl(false),
amazonRatingLocked: new FormControl(false),
amazonReviewCountLocked: new FormControl(false),
goodreadsIdLocked: new FormControl(false),
goodreadsRatingLocked: new FormControl(false),
goodreadsReviewCountLocked: new FormControl(false),
hardcoverIdLocked: new FormControl(false),
hardcoverRatingLocked: new FormControl(false),
hardcoverReviewCountLocked: new FormControl(false),
googleIdLocked: new FormControl(false),
seriesNameLocked: new FormControl(false),
seriesNumberLocked: new FormControl(false),
seriesTotalLocked: new FormControl(false),
@@ -145,16 +154,19 @@ export class MetadataPickerComponent implements OnInit {
publishedDate: metadata.publishedDate || null,
isbn10: metadata.isbn10 || null,
isbn13: metadata.isbn13 || null,
asin: metadata.asin || null,
description: metadata.description || null,
pageCount: metadata.pageCount || null,
language: metadata.language || null,
asin: metadata.asin || null,
amazonRating: metadata.amazonRating || null,
amazonReviewCount: metadata.amazonReviewCount || null,
goodreadsId: metadata.goodreadsId || null,
goodreadsRating: metadata.goodreadsRating || null,
goodreadsReviewCount: metadata.goodreadsReviewCount || null,
hardcoverId: metadata.hardcoverId || null,
hardcoverRating: metadata.hardcoverRating || null,
hardcoverReviewCount: metadata.hardcoverReviewCount || null,
googleId: metadata.googleId || null,
seriesName: metadata.seriesName || null,
seriesNumber: metadata.seriesNumber || null,
seriesTotal: metadata.seriesTotal || null,
@@ -168,16 +180,19 @@ export class MetadataPickerComponent implements OnInit {
publishedDateLocked: metadata.publishedDateLocked || false,
isbn10Locked: metadata.isbn10Locked || false,
isbn13Locked: metadata.isbn13Locked || false,
asinLocked: metadata.asinLocked || false,
descriptionLocked: metadata.descriptionLocked || false,
pageCountLocked: metadata.pageCountLocked || false,
languageLocked: metadata.languageLocked || false,
asinLocked: metadata.asinLocked || false,
amazonRatingLocked: metadata.amazonRatingLocked || false,
amazonReviewCountLocked: metadata.amazonReviewCountLocked || false,
goodreadsIdLocked: metadata.goodreadsIdLocked || false,
goodreadsRatingLocked: metadata.goodreadsRatingLocked || false,
goodreadsReviewCountLocked: metadata.goodreadsReviewCountLocked || false,
hardcoverIdLocked: metadata.hardcoverIdLocked || false,
hardcoverRatingLocked: metadata.hardcoverRatingLocked || false,
hardcoverReviewCountLocked: metadata.hardcoverReviewCountLocked || false,
googleIdLocked: metadata.googleIdLocked || false,
seriesNameLocked: metadata.seriesNameLocked || false,
seriesNumberLocked: metadata.seriesNumberLocked || false,
seriesTotalLocked: metadata.seriesTotalLocked || false,
@@ -196,10 +211,13 @@ export class MetadataPickerComponent implements OnInit {
if (metadata.asinLocked) this.metadataForm.get('asin')?.disable();
if (metadata.amazonReviewCountLocked) this.metadataForm.get('amazonReviewCount')?.disable();
if (metadata.amazonRatingLocked) this.metadataForm.get('amazonRating')?.disable();
if (metadata.googleIdLocked) this.metadataForm.get('googleIdCount')?.disable();
if (metadata.goodreadsReviewCountLocked) this.metadataForm.get('goodreadsReviewCount')?.disable();
if (metadata.goodreadsRatingLocked) this.metadataForm.get('goodreadsRating')?.disable();
if (metadata.hardcoverIdLocked) this.metadataForm.get('hardcoverId')?.disable();
if (metadata.hardcoverReviewCountLocked) this.metadataForm.get('hardcoverReviewCount')?.disable();
if (metadata.hardcoverRatingLocked) this.metadataForm.get('hardcoverRating')?.disable();
if (metadata.googleIdLocked) this.metadataForm.get('googleId')?.disable();
if (metadata.pageCountLocked) this.metadataForm.get('pageCount')?.disable();
if (metadata.descriptionLocked) this.metadataForm.get('description')?.disable();
if (metadata.seriesNameLocked) this.metadataForm.get('seriesName')?.disable();
@@ -238,16 +256,19 @@ export class MetadataPickerComponent implements OnInit {
publishedDate: this.metadataForm.get('publishedDate')?.value || this.copiedFields['publishedDate'] ? this.getValueOrCopied('publishedDate') : '',
isbn10: this.metadataForm.get('isbn10')?.value || this.copiedFields['isbn10'] ? this.getValueOrCopied('isbn10') : '',
isbn13: this.metadataForm.get('isbn13')?.value || this.copiedFields['isbn13'] ? this.getValueOrCopied('isbn13') : '',
asin: this.metadataForm.get('asin')?.value || this.copiedFields['asin'] ? this.getValueOrCopied('asin') : '',
description: this.metadataForm.get('description')?.value || this.copiedFields['description'] ? this.getValueOrCopied('description') : '',
pageCount: this.metadataForm.get('pageCount')?.value || this.copiedFields['pageCount'] ? this.getPageCountOrCopied() : null,
language: this.metadataForm.get('language')?.value || this.copiedFields['language'] ? this.getValueOrCopied('language') : '',
asin: this.metadataForm.get('asin')?.value || this.copiedFields['asin'] ? this.getValueOrCopied('asin') : '',
amazonRating: this.metadataForm.get('amazonRating')?.value || this.copiedFields['amazonRating'] ? this.getNumberOrCopied('amazonRating') : null,
amazonReviewCount: this.metadataForm.get('amazonReviewCount')?.value || this.copiedFields['amazonReviewCount'] ? this.getNumberOrCopied('amazonReviewCount') : null,
goodreadsId: this.metadataForm.get('goodreadsId')?.value || this.copiedFields['goodreadsId'] ? this.getValueOrCopied('goodreadsId') : '',
goodreadsRating: this.metadataForm.get('goodreadsRating')?.value || this.copiedFields['goodreadsRating'] ? this.getNumberOrCopied('goodreadsRating') : null,
goodreadsReviewCount: this.metadataForm.get('goodreadsReviewCount')?.value || this.copiedFields['goodreadsReviewCount'] ? this.getNumberOrCopied('goodreadsReviewCount') : null,
hardcoverId: this.metadataForm.get('hardcoverId')?.value || this.copiedFields['hardcoverId'] ? this.getValueOrCopied('hardcoverId') : '',
hardcoverRating: this.metadataForm.get('hardcoverRating')?.value || this.copiedFields['hardcoverRating'] ? this.getNumberOrCopied('hardcoverRating') : null,
hardcoverReviewCount: this.metadataForm.get('hardcoverReviewCount')?.value || this.copiedFields['hardcoverReviewCount'] ? this.getNumberOrCopied('hardcoverReviewCount') : null,
googleId: this.metadataForm.get('googleId')?.value || this.copiedFields['googleId'] ? this.getValueOrCopied('googleId') : '',
seriesName: this.metadataForm.get('seriesName')?.value || this.copiedFields['seriesName'] ? this.getValueOrCopied('seriesName') : '',
seriesNumber: this.metadataForm.get('seriesNumber')?.value || this.copiedFields['seriesNumber'] ? this.getNumberOrCopied('seriesNumber') : null,
seriesTotal: this.metadataForm.get('seriesTotal')?.value || this.copiedFields['seriesTotal'] ? this.getNumberOrCopied('seriesTotal') : null,
@@ -261,16 +282,19 @@ export class MetadataPickerComponent implements OnInit {
publishedDateLocked: this.metadataForm.get('publishedDateLocked')?.value,
isbn10Locked: this.metadataForm.get('isbn10Locked')?.value,
isbn13Locked: this.metadataForm.get('isbn13Locked')?.value,
asinLocked: this.metadataForm.get('asinLocked')?.value,
descriptionLocked: this.metadataForm.get('descriptionLocked')?.value,
pageCountLocked: this.metadataForm.get('pageCountLocked')?.value,
languageLocked: this.metadataForm.get('languageLocked')?.value,
asinLocked: this.metadataForm.get('asinLocked')?.value,
amazonRatingLocked: this.metadataForm.get('amazonRatingLocked')?.value,
amazonReviewCountLocked: this.metadataForm.get('amazonReviewCountLocked')?.value,
goodreadsIdLocked: this.metadataForm.get('goodreadsIdLocked')?.value,
goodreadsRatingLocked: this.metadataForm.get('goodreadsRatingLocked')?.value,
goodreadsReviewCountLocked: this.metadataForm.get('goodreadsReviewCountLocked')?.value,
hardcoverIdLocked: this.metadataForm.get('hardcoverIdLocked')?.value,
hardcoverRatingLocked: this.metadataForm.get('hardcoverRatingLocked')?.value,
hardcoverReviewCountLocked: this.metadataForm.get('hardcoverReviewCountLocked')?.value,
googleIdLocked: this.metadataForm.get('googleIdLocked')?.value,
seriesNameLocked: this.metadataForm.get('seriesNameLocked')?.value,
seriesNumberLocked: this.metadataForm.get('seriesNumberLocked')?.value,
seriesTotalLocked: this.metadataForm.get('seriesTotalLocked')?.value,
@@ -147,21 +147,17 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
}
buildProviderLink(metadata: BookMetadata): string {
if (!metadata.provider || !metadata.providerBookId) {
throw new Error("Invalid metadata: 'provider' or 'providerBookId' is missing.");
}
switch (metadata.provider) {
case "Amazon":
return `<a href="https://www.amazon.com/dp/${metadata.providerBookId}" target="_blank">Amazon</a>`;
case "GoodReads":
return `<a href="https://www.goodreads.com/book/show/${metadata.providerBookId}" target="_blank">Goodreads</a>`;
case "Google":
return `<a href="https://books.google.com/books?id=${metadata.providerBookId}" target="_blank">Google</a>`;
case "Hardcover":
return `<a href="https://hardcover.app/books/${metadata.providerBookId}" target="_blank">Hardcover</a>`;
default:
throw new Error(`Unsupported provider: ${metadata.provider}`);
if (metadata.asin) {
return `<a href="https://www.amazon.com/dp/${metadata.asin}" target="_blank">Amazon</a>`;
} else if (metadata.goodreadsId) {
return `<a href="https://www.goodreads.com/book/show/${metadata.goodreadsId}" target="_blank">Goodreads</a>`;
} else if (metadata.googleId) {
return `<a href="https://books.google.com/books?id=${metadata.googleId}" target="_blank">Google</a>`;
} else if (metadata.hardcoverId) {
return `<a href="https://hardcover.app/books/${metadata.hardcoverId}" target="_blank">Hardcover</a>`;
}
throw new Error("No provider ID found in metadata.");
}
truncateText(text: string | null, length: number): string {
@@ -43,7 +43,18 @@
<div class="flex items-center gap-2 pt-2">
<ng-container *ngIf="metadata.amazonRating || metadata.goodreadsRating || metadata.hardcoverRating; else legacyRating">
<ng-container *ngIf="metadata.amazonRating">
<p class="font-semibold">Amazon: {{ metadata.amazonRating }}</p>
<ng-container *ngIf="metadata.asin; else amazonStatic">
<a class="flex items-center gap-1" [href]="'https://www.amazon.com/dp/' + 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">{{ metadata.amazonRating }}</p>
</a>
</ng-container>
<ng-template #amazonStatic>
<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">{{ metadata.amazonRating }}</p>
</span>
</ng-template>
<p-rating [ngModel]="metadata.amazonRating" readonly stars="5"
[style.--p-rating-icon-active-color]="getStarColor(metadata.amazonRating)">
</p-rating>
@@ -52,7 +63,18 @@
</ng-container>
<ng-container *ngIf="metadata.goodreadsRating">
<p class="font-semibold">Goodreads: {{ metadata.goodreadsRating }}</p>
<ng-container *ngIf="metadata.goodreadsId; else goodreadsStatic">
<a class="flex items-center gap-1" [href]="'https://www.goodreads.com/book/show/' + 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">{{ metadata.goodreadsRating }}</p>
</a>
</ng-container>
<ng-template #goodreadsStatic>
<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">{{ metadata.goodreadsRating }}</p>
</span>
</ng-template>
<p-rating [ngModel]="metadata.goodreadsRating" readonly stars="5"
[style.--p-rating-icon-active-color]="getStarColor(metadata.goodreadsRating)">
</p-rating>
@@ -61,11 +83,28 @@
</ng-container>
<ng-container *ngIf="metadata.hardcoverRating">
<p class="font-semibold">Hardcover: {{ metadata.hardcoverRating }}</p>
<ng-container *ngIf="metadata.hardcoverId; else hardcoverStatic">
<a class="flex items-center gap-1" [href]="'https://hardcover.app/books/' + 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">{{ metadata.hardcoverRating }}</p>
</a>
</ng-container>
<ng-template #hardcoverStatic>
<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">{{ metadata.hardcoverRating }}</p>
</span>
</ng-template>
<p-rating [ngModel]="metadata.hardcoverRating" readonly stars="5"
[style.--p-rating-icon-active-color]="getStarColor(metadata.hardcoverRating)">
</p-rating>
<p class="font-semibold">({{ metadata.hardcoverReviewCount | number:'1.0-0' }})</p>
<span *ngIf="(metadata.amazonRating || metadata.goodreadsRating || metadata.hardcoverRating) && metadata.googleId">|</span>
</ng-container>
<ng-container *ngIf="metadata.googleId">
<a class="flex items-center gap-1" [href]="'https://books.google.com/books?id=' + 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>
</ng-container>
</ng-container>
@@ -46,6 +46,9 @@ export interface BookMetadata {
isbn13?: string;
isbn10?: string;
asin?: string;
goodreadsId?: string;
hardcoverId?: string;
googleId?: string;
pageCount?: number | null;
language?: string;
rating?: number | null;
@@ -74,6 +77,9 @@ export interface BookMetadata {
isbn13Locked?: boolean;
isbn10Locked?: boolean;
asinLocked?: boolean;
goodreadsIdLocked?: boolean;
hardcoverIdLocked?: boolean;
googleIdLocked?: boolean;
pageCountLocked?: boolean;
languageLocked?: boolean;
ratingLocked?: boolean;
@@ -0,0 +1,15 @@
<p class="mb-4" style="max-width: 450px; word-wrap: break-word; line-height: 1.5; font-size: 1rem;">
I hope <strong>Booklore</strong> has made managing your book collection easier and more enjoyable.
If you appreciate the project, please consider giving it a ⭐ on GitHub. Your support truly means a lot and motivates me to keep improving.
</p>
<p class="mb-4 text-left italic text-gray-300" style="max-width: 450px; font-size: 0.9rem;">
— Aditya (Creator of BookLore)
</p>
<div class="flex justify-center" style="max-width: 450px; margin: auto;">
<p-button
label="Go to GitHub"
icon="pi pi-github"
size="small"
(click)="openGithub()">
</p-button>
</div>
@@ -0,0 +1,16 @@
import { Component } from '@angular/core';
import {Button} from 'primeng/button';
@Component({
selector: 'app-github-support-dialog',
imports: [
Button
],
templateUrl: './github-support-dialog.html',
styleUrl: './github-support-dialog.scss'
})
export class GithubSupportDialog {
openGithub(): void {
window.open('https://github.com/adityachandelgit/booklore', '_blank');
}
}
@@ -58,6 +58,14 @@
<p-divider layout="vertical"/>
<div class="flex gap-6">
<li class="relative group overflow-hidden !border-transparent topbar-item" (click)="openGithubSupportDialog()">
<span
style="animation-duration: 2s; background: conic-gradient(from 90deg, #f97316, #f59e0b, #eab308, #84cc16, #22c55e, #10b981, #14a8a6, #06b6d4, #0ea5e9, #3b82f6, #6366f1, #8b5cf6, #a855f7, #d946ef, #ec4899, #f43f5e)"
class="absolute -top-5 -left-5 w-20 h-20 animate-spin">
</span>
<span style="inset: 1px; border-radius: 4px" class="absolute z-2 bg-surface-0 dark:bg-surface-900 transition-all"></span>
<i class="pi pi-thumbs-up z-10" pTooltip="Love BookLore?" tooltipPosition="top"></i>
</li>
<li class="relative">
<button type="button"
class="topbar-item config-item"
@@ -70,6 +78,9 @@
</button>
<app-theme-configurator></app-theme-configurator>
</li>
</div>
<p-divider layout="vertical"/>
<div class="flex gap-6">
<li>
<button class="topbar-item" (click)="openUserProfileDialog()" pTooltip="Profile" tooltipPosition="top">
<i class="pi pi-user text-surface-700 dark:text-surface-100"></i>
@@ -19,6 +19,7 @@ import {BookUploaderComponent} from '../../../utilities/component/book-uploader/
import {AuthService} from '../../../core/service/auth.service';
import {UserService} from '../../../settings/user-management/user.service';
import {UserProfileDialogComponent} from '../../../settings/global-preferences/user-profile-dialog/user-profile-dialog.component';
import {GithubSupportDialog} from '../../../github-support-dialog/github-support-dialog';
@Component({
selector: 'app-topbar',
@@ -72,16 +73,16 @@ export class AppTopBarComponent implements OnDestroy {
this.layoutService.onMenuToggle();
}
onMouseEnter() {
this.showEvents = true;
}
onMouseLeave() {
this.showEvents = false;
}
toggleEventDisplay(): void {
this.showEvents = !this.showEvents;
openGithubSupportDialog(): void {
this.ref = this.dialogService.open(GithubSupportDialog, {
header: 'Support BookLore on GitHub',
modal: true,
closable: true,
style: {
position: 'absolute',
top: '25%',
},
});
}
openLibraryCreatorDialog(): void {