close #1180 - add sort by fileName (#1482)

This commit is contained in:
Ionuț Staicu
2025-10-31 01:23:47 -06:00
committed by GitHub
parent 14692b0176
commit 529522cf74
4 changed files with 6 additions and 1 deletions
@@ -6,6 +6,7 @@ export class BookSorter {
sortOptions: SortOption[] = [
{ label: 'Title', field: 'title', direction: SortDirection.ASCENDING },
{ label: 'Title + Series', field: 'titleSeries', direction: SortDirection.ASCENDING },
{ label: 'File Name', field: 'fileName', direction: SortDirection.ASCENDING },
{ label: 'Author', field: 'author', direction: SortDirection.ASCENDING },
{ label: 'Last Read', field: 'lastReadTime', direction: SortDirection.ASCENDING },
{ label: 'Added On', field: 'addedOn', direction: SortDirection.ASCENDING },
@@ -38,7 +38,8 @@ export class SortService {
.every((key) => book.metadata?.[key] === true),
lastReadTime: (book) => book.lastReadTime ? new Date(book.lastReadTime).getTime() : null,
addedOn: (book) => book.addedOn ? new Date(book.addedOn).getTime() : null,
fileSizeKb: (book) => book.fileSizeKb || null
fileSizeKb: (book) => book.fileSizeKb || null,
fileName:(book) => book.fileName,
};
applySort(books: Book[], selectedSort: SortOption | null): Book[] {
@@ -7,6 +7,7 @@ import {CheckboxModule} from 'primeng/checkbox';
import {InputTextModule} from 'primeng/inputtext';
import {SelectModule} from 'primeng/select';
import {InputNumberModule} from 'primeng/inputnumber';
import {SortDirection} from "../../../book/model/sort.model";
import {DashboardConfig, ScrollerConfig, ScrollerType} from '../../models/dashboard-config.model';
import {DashboardConfigService} from '../../services/dashboard-config.service';
import {MagicShelfService} from '../../../magic-shelf/service/magic-shelf.service';
@@ -56,6 +57,7 @@ export class DashboardSettingsComponent implements OnInit {
sortFieldOptions = [
{label: 'Title', value: 'title'},
{label: 'Title + Series', value: 'titleSeries'},
{label: 'File Name', field: 'fileName'},
{label: 'Date Added', value: 'addedOn'},
{label: 'Author', value: 'author'},
{label: 'Personal Rating', value: 'personalRating'},
@@ -29,6 +29,7 @@ export class ViewPreferencesComponent implements OnInit, OnDestroy {
sortOptions = [
{label: 'Title', field: 'title'},
{label: 'Title + Series', field: 'titleSeries'},
{label: 'File Name', field: 'fileName'},
{label: 'Author', field: 'author'},
{label: 'Last Read', field: 'lastReadTime'},
{label: 'Added On', field: 'addedOn'},