Display the file size in the book metadata details section

* Display the file size in the Book Metadata details section

- Implement AppMigration feature
- Populate missing file sizes for books with null file size in 'populateFileSizes' migration

---------

Co-authored-by: adityachandelgit
This commit is contained in:
Aditya Chandel
2025-04-25 13:55:15 -06:00
committed by GitHub
co-authored by adityachandelgit
parent 285bc83a98
commit 2df8e193cc
16 changed files with 176 additions and 20 deletions
@@ -13,6 +13,7 @@ export interface Book {
epubProgress?: string;
pdfProgress?: number;
filePath?: string;
fileSizeKb?: number;
}
export interface BookMetadata {
@@ -50,13 +50,14 @@
<p-tag *ngFor="let category of metadata.categories" [value]="category" class="shrink-0"></p-tag>
</div>
<div class="grid gap-x-20 gap-y-2 pt-6" style="grid-template-columns: repeat(3, max-content);">
<div class="grid gap-x-20 gap-y-2 pt-6" style="grid-template-columns: repeat(4, max-content);">
<p class="whitespace-nowrap"><span class="font-bold">Publisher:</span> {{ metadata.publisher || '-' }}</p>
<p class="whitespace-nowrap"><span class="font-bold">Published:</span> {{ metadata.publishedDate || '-' }}</p>
<p class="whitespace-nowrap"><span class="font-bold">Language:</span> {{ metadata.language || '-' }}</p>
<p class="whitespace-nowrap"><span class="font-bold">ISBN 10:</span> {{ metadata.isbn10 || '-' }}</p>
<p class="whitespace-nowrap"><span class="font-bold">ISBN 13:</span> {{ metadata.isbn13 || '-' }}</p>
<p class="whitespace-nowrap"><span class="font-bold">Page Count:</span> {{ metadata.pageCount || '-' }}</p>
<p class="whitespace-nowrap"><span class="font-bold">File Size:</span> {{ getFileSizeInMB() }}</p>
</div>
<p class="pt-2"><span class="font-bold">File Path:</span> {{ book?.filePath }}</p>
@@ -154,4 +154,13 @@ export class MetadataViewerComponent implements OnInit {
}
return lockedKeys.every(key => metadata[key] === true);
}
getFileSizeInMB(): string {
const sizeKb = this.book?.fileSizeKb;
if (sizeKb != null) {
const sizeMb = sizeKb / 1024;
return `${sizeMb.toFixed(2)} MB`;
}
return '-';
}
}