From b3fd860783ec5546e754bd07658f9907ab472876 Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <8075870+adityachandelgit@users.noreply.github.com> Date: Mon, 1 Sep 2025 10:33:36 -0600 Subject: [PATCH 1/5] Add text selection tool in PDF reader --- .../app/book/components/pdf-viewer/pdf-viewer.component.html | 4 +++- .../app/book/components/pdf-viewer/pdf-viewer.component.ts | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/booklore-ui/src/app/book/components/pdf-viewer/pdf-viewer.component.html b/booklore-ui/src/app/book/components/pdf-viewer/pdf-viewer.component.html index 7226873cc..abcd8f410 100644 --- a/booklore-ui/src/app/book/components/pdf-viewer/pdf-viewer.component.html +++ b/booklore-ui/src/app/book/components/pdf-viewer/pdf-viewer.component.html @@ -7,7 +7,9 @@ @if (!isLoading) { Date: Mon, 1 Sep 2025 11:04:26 -0600 Subject: [PATCH 2/5] Show bookdrop button on mobile view --- .../bookdrop-file-review.component.html | 533 +++++++++--------- .../layout-topbar/app.topbar.component.html | 9 + 2 files changed, 276 insertions(+), 266 deletions(-) diff --git a/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.html b/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.html index d786d6954..d3951a06b 100644 --- a/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.html +++ b/booklore-ui/src/app/bookdrop/bookdrop-file-review-component/bookdrop-file-review.component.html @@ -1,307 +1,308 @@ -
+
+
+
+
+

+ Review Bookdrop Files + + + +

+

+ These files were uploaded to the + Bookdrop Folder. + Review their fetched metadata, assign a library and subpath, and finalize where they belong in your collection. +

+
-
-
-

- Review Bookdrop Files - - - -

-

- These files were uploaded to the - Bookdrop Folder. - Review their fetched metadata, assign a library and subpath, and finalize where they belong in your collection. -

-
- -
- - -
-
- - @if (loading) { - -
-
- - Loading Bookdrop files. Please wait... +
+ +
- } @else { + @if (loading) { -
- @if (saving) { -
+
+
-
+ Loading Bookdrop files. Please wait... +
+
+ + } @else { + +
+ @if (saving) { +
+ +
Organizing and moving files to their designated libraries. Please wait... +
-
- } + } - @if (bookdropFileUis.length !== 0) { -
- -
- Library for All Files: - - - - Subpath for All Files: - - - - - -
- -
- - - - - - - - -
-
- } -
- -
- @if (bookdropFileUis.length === 0) { -
- No bookdrop files to review. -
- } @else { - @for (file of bookdropFileUis; track file) { - -
-
- - - - - - - - @if (file.metadataForm.get('thumbnailUrl')?.value) { - Cover - } - - @if (file.file.fetchedMetadata?.thumbnailUrl) { - Fetched Cover - } - -
- {{ file.file.fileName }} -
- - - + @if (bookdropFileUis.length !== 0) { +
+
+ Library for All Files: + [(ngModel)]="defaultLibraryId"> + Subpath for All Files: + [(ngModel)]="defaultPathId">
- @if (file.showDetails) { - - - } +
+ + + + + + + + +
} - } -
+
- - -
- -
- @if (bookdropFileUis.length > 0) { - - - - - +
+ @if (bookdropFileUis.length === 0) { +
+ No bookdrop files to review. +
} @else { -
+ @for (file of bookdropFileUis; track file) { + +
+
+ + + + + + + + @if (file.metadataForm.get('thumbnailUrl')?.value) { + Cover + } + + @if (file.file.fetchedMetadata?.thumbnailUrl) { + Fetched Cover + } + +
+ {{ file.file.fileName }} +
+ + + + + + + + + + + + +
+ + @if (file.showDetails) { + + + } +
+ } }
-
- - -
+ -
- - - - -
+
-
- } +
+ @if (bookdropFileUis.length > 0) { + + + + + + } @else { +
+ } +
+ +
+ + +
+ +
+ + + + +
+ +
+ } +
diff --git a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html index 31bd72ed2..759a19bd0 100644 --- a/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html +++ b/booklore-ui/src/app/layout/component/layout-topbar/app.topbar.component.html @@ -162,6 +162,15 @@ Upload Book +
  • + +
  • } }
  • From 0159fcf2a80dd682975a47ded9fe13cff3f4242b Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <8075870+adityachandelgit@users.noreply.github.com> Date: Mon, 1 Sep 2025 12:29:25 -0600 Subject: [PATCH 3/5] Allow free-text and suggestion selection in authors and categories auto-complete --- .../metadata-editor.component.html | 28 +++++- .../metadata-editor.component.ts | 92 +++++++++++-------- .../metadata-picker.component.html | 13 ++- .../metadata-picker.component.ts | 71 +++++++++++--- 4 files changed, 148 insertions(+), 56 deletions(-) diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html index eba0a64af..1a8f96f24 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.html @@ -102,9 +102,18 @@
    -
    - -
    + + @if (!book.metadata!['authorsLocked']) { } @@ -144,7 +153,18 @@
    - + +
    @if (!book.metadata!['categoriesLocked']) { diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.ts b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.ts index 51811a091..a7ee5d29d 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.ts +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-editor/metadata-editor.component.ts @@ -1,4 +1,4 @@ -import {Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output, ViewChild} from '@angular/core'; +import {Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output} from '@angular/core'; import {InputText} from 'primeng/inputtext'; import {Button} from 'primeng/button'; import {Divider} from 'primeng/divider'; @@ -13,8 +13,7 @@ import {HttpResponse} from '@angular/common/http'; import {BookService} from '../../../book/service/book.service'; import {ProgressSpinner} from 'primeng/progressspinner'; import {Tooltip} from 'primeng/tooltip'; -import {Editor} from 'primeng/editor'; -import {debounceTime} from 'rxjs/operators'; +import {filter, take} from 'rxjs/operators'; import {MetadataRestoreDialogComponent} from '../../../book/components/book-browser/metadata-restore-dialog-component/metadata-restore-dialog-component'; import {DialogService} from 'primeng/dynamicdialog'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; @@ -51,8 +50,6 @@ import {LazyLoadImageModule} from 'ng-lazyload-image'; }) export class MetadataEditorComponent implements OnInit { - @ViewChild(Editor) quillEditor!: Editor; - @Input() book$!: Observable; @Output() nextBookClicked = new EventEmitter(); @Output() previousBookClicked = new EventEmitter(); @@ -72,7 +69,6 @@ export class MetadataEditorComponent implements OnInit { currentBookId!: number; isUploading = false; isLoading = false; - htmlTextarea = ''; isSaving = false; refreshingBookIds = new Set(); @@ -80,22 +76,23 @@ export class MetadataEditorComponent implements OnInit { originalMetadata!: BookMetadata; - // Handle blur event for AutoComplete to add custom values - onAutoCompleteBlur(fieldName: string, event: any) { - const inputValue = event.target.value?.trim(); - if (inputValue) { - const currentValue = this.metadataForm.get(fieldName)?.value || []; - const values = Array.isArray(currentValue) ? currentValue : - typeof currentValue === 'string' && currentValue ? currentValue.split(',').map((v: string) => v.trim()) : []; + allAuthors!: string[]; + allCategories!: string[]; + filteredCategories: string[] = []; + filteredAuthors: string[] = []; - // Add the new value if it's not already in the array - if (!values.includes(inputValue)) { - values.push(inputValue); - this.metadataForm.get(fieldName)?.setValue(values); - } - // Clear the input - event.target.value = ''; - } + filterCategories(event: { query: string }) { + const query = event.query.toLowerCase(); + this.filteredCategories = this.allCategories.filter(cat => + cat.toLowerCase().includes(query) + ); + } + + filterAuthors(event: { query: string }) { + const query = event.query.toLowerCase(); + this.filteredAuthors = this.allAuthors.filter(cat => + cat.toLowerCase().includes(query) + ); } constructor() { @@ -164,30 +161,31 @@ export class MetadataEditorComponent implements OnInit { .subscribe(book => { const metadata = book?.metadata; if (!metadata) return; - this.currentBookId = metadata.bookId; - if (this.refreshingBookIds.has(book.id)) { this.refreshingBookIds.delete(book.id); this.isAutoFetching = false; } - this.originalMetadata = structuredClone(metadata); - - if (this.quillEditor?.quill) { - this.quillEditor.quill.root.innerHTML = metadata.description; - this.quillDisabled(); - } - this.populateFormFromMetadata(metadata); }); - this.metadataForm.get('description')?.valueChanges - .pipe(debounceTime(100), takeUntilDestroyed(this.destroyRef)) - .subscribe(value => { - if (this.htmlTextarea !== value) { - this.htmlTextarea = value; - } + this.bookService.bookState$ + .pipe( + filter(bookState => bookState.loaded), + take(1) + ) + .subscribe(bookState => { + const authors = new Set(); + const categories = new Set(); + + (bookState.books ?? []).forEach(book => { + book.metadata?.authors?.forEach(author => authors.add(author)); + book.metadata?.categories?.forEach(category => categories.add(category)); + }); + + this.allAuthors = Array.from(authors); + this.allCategories = Array.from(categories); }); } @@ -289,6 +287,28 @@ export class MetadataEditorComponent implements OnInit { } } + onAutoCompleteSelect(fieldName: string, event: any) { + const values = this.metadataForm.get(fieldName)?.value || []; + if (!values.includes(event.value)) { + this.metadataForm.get(fieldName)?.setValue([...values, event.value]); + } + (event.originalEvent.target as HTMLInputElement).value = ''; + } + + onAutoCompleteKeyUp(fieldName: string, event: KeyboardEvent) { + if (event.key === 'Enter') { + const input = event.target as HTMLInputElement; + const value = input.value?.trim(); + if (value) { + const values = this.metadataForm.get(fieldName)?.value || []; + if (!values.includes(value)) { + this.metadataForm.get(fieldName)?.setValue([...values, value]); + } + input.value = ''; + } + } + } + onSave(): void { this.isSaving = true; this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadataWrapper(undefined), false).subscribe({ diff --git a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-picker/metadata-picker.component.html b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-picker/metadata-picker.component.html index 725f9b2ed..4f9c79994 100644 --- a/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-picker/metadata-picker.component.html +++ b/booklore-ui/src/app/metadata/book-metadata-center-component/metadata-picker/metadata-picker.component.html @@ -100,7 +100,18 @@ }
    - + +
    ; @Output() goBack = new EventEmitter(); - // Handle blur event for AutoComplete to add custom values - onAutoCompleteBlur(fieldName: string, event: any) { - const inputValue = event.target.value?.trim(); - if (inputValue) { - const currentValue = this.metadataForm.get(fieldName)?.value || []; - const values = Array.isArray(currentValue) ? currentValue : - typeof currentValue === 'string' && currentValue ? currentValue.split(',').map((v: string) => v.trim()) : []; + allAuthors!: string[]; + allCategories!: string[]; + filteredCategories: string[] = []; + filteredAuthors: string[] = []; - // Add the new value if it's not already in the array - if (!values.includes(inputValue)) { - values.push(inputValue); - this.metadataForm.get(fieldName)?.setValue(values); - } - // Clear the input - event.target.value = ''; + getFiltered(controlName: string): string[] { + return controlName === 'authors' ? this.filteredAuthors : this.filteredCategories; + } + + filterItems(event: { query: string }, controlName: string) { + const query = event.query.toLowerCase(); + if (controlName === 'authors') { + this.filteredAuthors = this.allAuthors.filter(a => a.toLowerCase().includes(query)); + } else if (controlName === 'categories') { + this.filteredCategories = this.allCategories.filter(c => c.toLowerCase().includes(query)); } } @@ -171,6 +171,25 @@ export class MetadataPickerComponent implements OnInit { } ngOnInit(): void { + + this.bookService.bookState$ + .pipe( + filter(bookState => bookState.loaded), + take(1) + ) + .subscribe(bookState => { + const authors = new Set(); + const categories = new Set(); + + (bookState.books ?? []).forEach(book => { + book.metadata?.authors?.forEach(author => authors.add(author)); + book.metadata?.categories?.forEach(category => categories.add(category)); + }); + + this.allAuthors = Array.from(authors); + this.allCategories = Array.from(categories); + }); + this.book$ .pipe( filter((book): book is Book => !!book && !!book.metadata), @@ -275,6 +294,28 @@ export class MetadataPickerComponent implements OnInit { }); } + onAutoCompleteSelect(fieldName: string, event: any) { + const values = this.metadataForm.get(fieldName)?.value || []; + if (!values.includes(event.value)) { + this.metadataForm.get(fieldName)?.setValue([...values, event.value]); + } + (event.originalEvent.target as HTMLInputElement).value = ''; + } + + onAutoCompleteKeyUp(fieldName: string, event: KeyboardEvent) { + if (event.key === 'Enter') { + const input = event.target as HTMLInputElement; + const value = input.value?.trim(); + if (value) { + const values = this.metadataForm.get(fieldName)?.value || []; + if (!values.includes(value)) { + this.metadataForm.get(fieldName)?.setValue([...values, value]); + } + input.value = ''; + } + } + } + onSave(): void { this.isSaving = true; const updatedBookMetadata = this.buildMetadataWrapper(undefined); From cdd9b06b1de0a626f225ddff0855441a8d2ba537 Mon Sep 17 00:00:00 2001 From: "aditya.chandel" <8075870+adityachandelgit@users.noreply.github.com> Date: Mon, 1 Sep 2025 12:33:55 -0600 Subject: [PATCH 4/5] Fix settings page EPUB's reader font color --- .../component/epub-viewer.component.html | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html index 6789e5676..f1beda23e 100644 --- a/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html +++ b/booklore-ui/src/app/book/components/epub-viewer/component/epub-viewer.component.html @@ -29,14 +29,14 @@ }
    - +
    - Font Size: + Font Size:
    - {{ fontSize }}% + {{ fontSize }}%
    @@ -44,7 +44,7 @@
    - +
    - +
    @for (theme of themes; track theme) {