Build a lazy-loading PDF viewer for large files
This commit is contained in:
committed by
Aditya Chandel
parent
38487f8e5d
commit
fce5ccf22c
+1
-1
@@ -129,7 +129,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="userService.userState$ | async as userData" class="pl-6 pt-4 flex flex-row w-full gap-4">
|
||||
<p-button label="Read" icon="pi pi-book" severity="info" (onClick)="read(metadata.bookId)"></p-button>
|
||||
<p-splitbutton label="Read" icon="pi pi-book" [model]="readMenuItems" (onClick)="read(metadata.bookId, 'ngx')" severity="info"/>
|
||||
<p-button label="Assign Shelf" icon="pi pi-folder" severity="info" outlined (onClick)="assignShelf(metadata.bookId)"></p-button>
|
||||
<p-button *ngIf="userData.permissions.canDownload || userData.permissions.admin" label="Download" icon="pi pi-download" severity="info" outlined
|
||||
(onClick)="download(metadata.bookId)"></p-button>
|
||||
|
||||
+12
-2
@@ -54,6 +54,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
|
||||
metadata$: Observable<BookMetadata | null> = this.metadataCenterService.currentMetadata$;
|
||||
emailMenuItems: MenuItem[] | undefined;
|
||||
readMenuItems: MenuItem[] | undefined;
|
||||
refreshMenuItems: MenuItem[] | undefined;
|
||||
bookInSeries: Book[] = [];
|
||||
isExpanded = false;
|
||||
@@ -102,6 +103,15 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
}
|
||||
];
|
||||
|
||||
this.readMenuItems = [
|
||||
{
|
||||
label: 'Streaming Reader',
|
||||
command: () => {
|
||||
this.read(this.book?.id, "streaming")
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
this.metadata$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((metadata) => {
|
||||
@@ -144,8 +154,8 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
}
|
||||
|
||||
read(bookId: number): void {
|
||||
this.bookService.readBook(bookId);
|
||||
read(bookId: number | undefined, reader: "ngx" | "streaming"): void {
|
||||
this.bookService.readPdf(bookId!, reader);
|
||||
}
|
||||
|
||||
getAuthorNames(authors: string[]): string {
|
||||
|
||||
Reference in New Issue
Block a user