diff --git a/src/apps/modern/features/libraries/components/ItemsView.tsx b/src/apps/modern/features/libraries/components/ItemsView.tsx index 5f3f5f8979..629fb6281d 100644 --- a/src/apps/modern/features/libraries/components/ItemsView.tsx +++ b/src/apps/modern/features/libraries/components/ItemsView.tsx @@ -57,7 +57,7 @@ const ItemsView: FC = () => { listOptions.showArtist = true; listOptions.addToListButton = true; } else if (viewType === LibraryTab.Albums) { - listOptions.sortBy = libraryViewSettings.SortBy; + listOptions.sortBy = libraryViewSettings.SortBy[0]; listOptions.addToListButton = true; } else if (viewType === LibraryTab.Episodes) { listOptions.showParentTitle = true; @@ -171,7 +171,7 @@ const ItemsView: FC = () => { noItemsMessage ]); - const hasSortName = libraryViewSettings.SortBy !== ItemSortBy.Random; + const hasSortName = !libraryViewSettings.SortBy.includes(ItemSortBy.Random); const itemsContainerClass = classNames( 'padded-left padded-right', diff --git a/src/apps/modern/features/libraries/components/PlayAllButton.tsx b/src/apps/modern/features/libraries/components/PlayAllButton.tsx index 8b24a665e4..19a1f43245 100644 --- a/src/apps/modern/features/libraries/components/PlayAllButton.tsx +++ b/src/apps/modern/features/libraries/components/PlayAllButton.tsx @@ -43,7 +43,7 @@ const PlayAllButton: FC = ({ items: [item], autoplay: true, queryOptions: { - SortBy: [libraryViewSettings.SortBy], + SortBy: libraryViewSettings.SortBy, SortOrder: [libraryViewSettings.SortOrder] } }).catch(err => { @@ -56,7 +56,7 @@ const PlayAllButton: FC = ({ queryOptions: { ParentId: item?.Id ?? undefined, ...getFiltersQuery(viewType, libraryViewSettings), - SortBy: [libraryViewSettings.SortBy], + SortBy: libraryViewSettings.SortBy, SortOrder: [libraryViewSettings.SortOrder] } }).catch(err => { diff --git a/src/apps/modern/features/libraries/components/SortButton.tsx b/src/apps/modern/features/libraries/components/SortButton.tsx index 5b99aee1e6..a53bf3e01f 100644 --- a/src/apps/modern/features/libraries/components/SortButton.tsx +++ b/src/apps/modern/features/libraries/components/SortButton.tsx @@ -14,52 +14,53 @@ import Popover from '@mui/material/Popover'; import globalize from 'lib/globalize'; import { LibraryViewSettings } from 'types/library'; import { LibraryTab } from 'types/libraryTab'; +import isEqual from 'lodash-es/isEqual'; type SortOption = { label: string; - value: ItemSortBy; + value: ItemSortBy[]; }; type SortOptionsMapping = Record; const collectionMovieOptions: SortOption[] = [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] } ]; const movieOrFavoriteOptions = [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionCriticRating', value: ItemSortBy.CriticRating }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionPlayCount', value: ItemSortBy.PlayCount }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionCriticRating', value: [ItemSortBy.CriticRating, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionPlayCount', value: [ItemSortBy.PlayCount, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.SortName] } ]; const photosOrPhotoAlbumsOptions = [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] } ]; const videoOrMusicVideoOptions = [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionPlayCount', value: ItemSortBy.PlayCount }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionPlayCount', value: [ItemSortBy.PlayCount, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.SortName] } ]; const sortOptionsMapping: SortOptionsMapping = { @@ -67,91 +68,91 @@ const sortOptionsMapping: SortOptionsMapping = { [LibraryTab.Collections]: collectionMovieOptions, [LibraryTab.Favorites]: movieOrFavoriteOptions, [LibraryTab.Series]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionDateShowAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDateEpisodeAdded', value: ItemSortBy.DateLastContentAdded }, - { label: 'OptionDatePlayed', value: ItemSortBy.SeriesDatePlayed }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionDateShowAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDateEpisodeAdded', value: [ItemSortBy.DateLastContentAdded, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.SeriesDatePlayed, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] } ], [LibraryTab.Episodes]: [ - { label: 'Name', value: ItemSortBy.SeriesSortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionPlayCount', value: ItemSortBy.PlayCount }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'Name', value: [ItemSortBy.SeriesSortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionPlayCount', value: [ItemSortBy.PlayCount, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.SortName] } ], [LibraryTab.Albums]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'AlbumArtist', value: ItemSortBy.AlbumArtist }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionCriticRating', value: ItemSortBy.CriticRating }, - { label: 'OptionReleaseDate', value: ItemSortBy.ProductionYear }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'AlbumArtist', value: [ItemSortBy.AlbumArtist, ItemSortBy.SortName] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionCriticRating', value: [ItemSortBy.CriticRating, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] } ], [LibraryTab.Books]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionReleaseDate', value: ItemSortBy.ProductionYear }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'IndexNumber', value: ItemSortBy.IndexNumber } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'IndexNumber', value: [ItemSortBy.IndexNumber, ItemSortBy.SortName] } ], [LibraryTab.Songs]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'Album', value: ItemSortBy.Album }, - { label: 'AlbumArtist', value: ItemSortBy.AlbumArtist }, - { label: 'Artist', value: ItemSortBy.Artist }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'OptionPlayCount', value: ItemSortBy.PlayCount }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'OptionTrackName', value: [ItemSortBy.Name] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'Album', value: [ItemSortBy.Album, ItemSortBy.AlbumArtist, ItemSortBy.SortName] }, + { label: 'AlbumArtist', value: [ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName] }, + { label: 'Artist', value: [ItemSortBy.Artist, ItemSortBy.Album, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'OptionPlayCount', value: [ItemSortBy.PlayCount, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName] } ], [LibraryTab.Playlists]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDatePlaylistUpdated', value: ItemSortBy.DateLastContentAdded }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDatePlaylistUpdated', value: [ItemSortBy.DateLastContentAdded, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.SortName] } ], [LibraryTab.PhotoAlbums]: photosOrPhotoAlbumsOptions, [LibraryTab.Photos]: photosOrPhotoAlbumsOptions, [LibraryTab.Videos]:videoOrMusicVideoOptions, [LibraryTab.MusicVideos]:videoOrMusicVideoOptions, [LibraryTab.Folders]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'Folders', value: ItemSortBy.IsFolder }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionPlayCount', value: ItemSortBy.PlayCount }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'Folders', value: [ItemSortBy.IsFolder, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionPlayCount', value: [ItemSortBy.PlayCount, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.SortName] } ], [LibraryTab.Mixed]: [ - { label: 'Name', value: ItemSortBy.SortName }, - { label: 'OptionRandom', value: ItemSortBy.Random }, - { label: 'OptionCommunityRating', value: ItemSortBy.CommunityRating }, - { label: 'OptionCriticRating', value: ItemSortBy.CriticRating }, - { label: 'OptionDateAdded', value: ItemSortBy.DateCreated }, - { label: 'OptionDateEpisodeAdded', value: ItemSortBy.DateLastContentAdded }, - { label: 'OptionDatePlayed', value: ItemSortBy.DatePlayed }, - { label: 'OptionParentalRating', value: ItemSortBy.OfficialRating }, - { label: 'OptionPlayCount', value: ItemSortBy.PlayCount }, - { label: 'OptionReleaseDate', value: ItemSortBy.PremiereDate }, - { label: 'Runtime', value: ItemSortBy.Runtime } + { label: 'Name', value: [ItemSortBy.SortName] }, + { label: 'OptionRandom', value: [ItemSortBy.Random] }, + { label: 'OptionCommunityRating', value: [ItemSortBy.CommunityRating, ItemSortBy.SortName] }, + { label: 'OptionCriticRating', value: [ItemSortBy.CriticRating, ItemSortBy.SortName] }, + { label: 'OptionDateAdded', value: [ItemSortBy.DateCreated, ItemSortBy.SortName] }, + { label: 'OptionDateEpisodeAdded', value: [ItemSortBy.DateLastContentAdded, ItemSortBy.SortName] }, + { label: 'OptionDatePlayed', value: [ItemSortBy.DatePlayed, ItemSortBy.SortName] }, + { label: 'OptionParentalRating', value: [ItemSortBy.OfficialRating, ItemSortBy.SortName] }, + { label: 'OptionPlayCount', value: [ItemSortBy.PlayCount, ItemSortBy.SortName] }, + { label: 'OptionReleaseDate', value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName] }, + { label: 'Runtime', value: [ItemSortBy.Runtime, ItemSortBy.SortName] } ] }; @@ -186,11 +187,11 @@ const SortButton: FC = ({ }, []); const onMenuItemClick = useCallback( - (sortBy: ItemSortBy) => { + (sortBy: ItemSortBy[]) => { setLibraryViewSettings((prevState) => { let sortOrder: SortOrder = SortOrder.Ascending; // If the user clicks the currently selected sort option, toggle the sort order - if (prevState.SortBy === sortBy) { + if (isEqual(prevState.SortBy, sortBy)) { sortOrder = prevState.SortOrder === SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending; } @@ -235,7 +236,7 @@ const SortButton: FC = ({ {sortMenuOptions .map((option) => ( onMenuItemClick(option.value)} > @@ -243,7 +244,7 @@ const SortButton: FC = ({ {globalize.translate(option.label)} - {libraryViewSettings.SortBy === option.value && ( + {isEqual(libraryViewSettings.SortBy, option.value) && ( libraryViewSettings.SortOrder === SortOrder.Ascending ? ( ) : ( diff --git a/src/apps/modern/features/libraries/utils/settings.ts b/src/apps/modern/features/libraries/utils/settings.ts index 79eae16e3e..d379b8fcb7 100644 --- a/src/apps/modern/features/libraries/utils/settings.ts +++ b/src/apps/modern/features/libraries/utils/settings.ts @@ -6,12 +6,12 @@ import { SortOrder } from '@jellyfin/sdk/lib/generated-client/models/sort-order' import { type ParentId, ViewMode, type LibraryViewSettings } from 'types/library'; import { LibraryTab } from 'types/libraryTab'; -export const getDefaultSortBy = (viewType: LibraryTab) => { +export const getDefaultSortBy = (viewType: LibraryTab): ItemSortBy[] => { if (viewType === LibraryTab.Episodes) { - return ItemSortBy.SeriesSortName; + return [ItemSortBy.SeriesSortName]; } - return ItemSortBy.SortName; + return [ItemSortBy.SortName]; }; export const getDefaultLibraryViewSettings = (viewType: LibraryTab): LibraryViewSettings => { diff --git a/src/hooks/useFetchItems.ts b/src/hooks/useFetchItems.ts index b819bb4452..5d6ab0c75f 100644 --- a/src/hooks/useFetchItems.ts +++ b/src/hooks/useFetchItems.ts @@ -246,7 +246,7 @@ const fetchGetItemsViewByType = async ( ...getFiltersQuery(viewType, libraryViewSettings), ...getLimitQuery(), ...getAlphaPickerQuery(libraryViewSettings), - sortBy: [libraryViewSettings.SortBy], + sortBy: libraryViewSettings.SortBy, sortOrder: [libraryViewSettings.SortOrder], includeItemTypes: itemType, startIndex: libraryViewSettings.StartIndex @@ -267,7 +267,7 @@ const fetchGetItemsViewByType = async ( ...getFiltersQuery(viewType, libraryViewSettings), ...getLimitQuery(), ...getAlphaPickerQuery(libraryViewSettings), - sortBy: [libraryViewSettings.SortBy], + sortBy: libraryViewSettings.SortBy, sortOrder: [libraryViewSettings.SortOrder], includeItemTypes: itemType, startIndex: libraryViewSettings.StartIndex @@ -342,9 +342,7 @@ const fetchGetItemsViewByType = async ( ...getFiltersQuery(viewType, libraryViewSettings), ...getLimitQuery(), ...getAlphaPickerQuery(libraryViewSettings), - sortBy: libraryViewSettings.SortBy === ItemSortBy.IsFolder ? - [ItemSortBy.IsFolder, ItemSortBy.SortName] : - [libraryViewSettings.SortBy], + sortBy: libraryViewSettings.SortBy, sortOrder: [libraryViewSettings.SortOrder], includeItemTypes: itemType, startIndex: libraryViewSettings.StartIndex @@ -379,7 +377,7 @@ const fetchGetItemsViewByType = async ( ...getLimitQuery(), ...getAlphaPickerQuery(libraryViewSettings), isFavorite: viewType === LibraryTab.Favorites ? true : undefined, - sortBy: [libraryViewSettings.SortBy], + sortBy: libraryViewSettings.SortBy, sortOrder: [libraryViewSettings.SortOrder], includeItemTypes: itemType, startIndex: libraryViewSettings.StartIndex diff --git a/src/types/library.ts b/src/types/library.ts index 20a0bfa410..065918328c 100644 --- a/src/types/library.ts +++ b/src/types/library.ts @@ -55,7 +55,7 @@ export enum ViewMode { } export interface LibraryViewSettings { - SortBy: ItemSortBy; + SortBy: ItemSortBy[]; SortOrder: SortOrder; StartIndex: number; CardLayout: boolean;