mirror of
https://github.com/booklore-app/booklore.git
synced 2025-12-23 22:28:11 -05:00
Random sort option for libraries and shelves (#1817)
This commit is contained in:
@@ -22,6 +22,7 @@ export class BookSorter {
|
||||
{ label: 'Hardcover Rating', field: 'hardcoverRating', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Hardcover #', field: 'hardcoverReviewCount', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Pages', field: 'pageCount', direction: SortDirection.ASCENDING },
|
||||
{ label: 'Random', field: 'random', direction: SortDirection.ASCENDING },
|
||||
];
|
||||
|
||||
constructor(private applySortOption: (sort: SortOption) => void) {}
|
||||
|
||||
@@ -95,6 +95,7 @@ export class SortService {
|
||||
addedOn: (book) => book.addedOn ? new Date(book.addedOn).getTime() : null,
|
||||
fileSizeKb: (book) => book.fileSizeKb || null,
|
||||
fileName: (book) => book.fileName,
|
||||
random: (book) => Math.random(),
|
||||
};
|
||||
|
||||
applySort(books: Book[], selectedSort: SortOption | null): Book[] {
|
||||
|
||||
@@ -44,7 +44,8 @@ export class ViewPreferencesComponent implements OnInit, OnDestroy {
|
||||
{label: 'Goodreads #', field: 'goodreadsReviewCount'},
|
||||
{label: 'Hardcover Rating', field: 'hardcoverRating'},
|
||||
{label: 'Hardcover #', field: 'hardcoverReviewCount'},
|
||||
{label: 'Pages', field: 'pageCount'}
|
||||
{label: 'Pages', field: 'pageCount'},
|
||||
{label: 'Random', field: 'random'},
|
||||
];
|
||||
|
||||
entityTypeOptions = [
|
||||
|
||||
Reference in New Issue
Block a user