diff --git a/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts b/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts index ac13a669..b0f71130 100644 --- a/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts +++ b/booklore-ui/src/app/features/book/components/book-browser/sorting/BookSorter.ts @@ -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) {} diff --git a/booklore-ui/src/app/features/book/service/sort.service.ts b/booklore-ui/src/app/features/book/service/sort.service.ts index 21ea1957..142de754 100644 --- a/booklore-ui/src/app/features/book/service/sort.service.ts +++ b/booklore-ui/src/app/features/book/service/sort.service.ts @@ -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[] { diff --git a/booklore-ui/src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts b/booklore-ui/src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts index 00b77801..d20106cd 100644 --- a/booklore-ui/src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts +++ b/booklore-ui/src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts @@ -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 = [