1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

refactor: use ItemSortBy from generated SDK

This commit is contained in:
Dmitry Lyzo 2024-03-29 01:01:31 +03:00
parent 2e4eb68d59
commit 52c150a2e7
2 changed files with 17 additions and 15 deletions

View file

@ -13,6 +13,7 @@ import '../elements/emby-scroller/emby-scroller';
import ServerConnections from '../components/ServerConnections';
import LibraryMenu from '../scripts/libraryMenu';
import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type';
import { ItemSortBy } from '@jellyfin/sdk/lib/generated-client/models/item-sort-by';
function getInitialLiveTvQuery(instance, params, startIndex = 0, limit = 300) {
const query = {
@ -223,7 +224,7 @@ function updateAlphaPickerState(instance) {
if (alphaPicker) {
const values = instance.getSortValues();
if (values.sortBy.indexOf('SortName') !== -1) {
if (values.sortBy.indexOf(ItemSortBy.SortName) !== -1) {
alphaPicker.classList.remove('hide');
instance.itemsContainer.parentNode.classList.add('padded-right-withalphapicker');
} else {
@ -981,7 +982,7 @@ class ItemsView {
return sortNameOption.value;
}
return 'IsFolder,' + sortNameOption.value;
return `${ItemSortBy.IsFolder},${sortNameOption.value}`;
}
getSortMenuOptions() {
@ -990,7 +991,7 @@ class ItemsView {
if (this.params.type === 'Programs') {
sortBy.push({
name: globalize.translate('AirDate'),
value: 'StartDate,SortName'
value: [ItemSortBy.StartDate, ItemSortBy.SortName].join(',')
});
}
@ -1015,7 +1016,7 @@ class ItemsView {
if (this.params.type !== 'Programs') {
sortBy.push({
name: globalize.translate('DateAdded'),
value: 'DateCreated,SortName'
value: [ItemSortBy.DateCreated, ItemSortBy.SortName].join(',')
});
}
@ -1029,13 +1030,13 @@ class ItemsView {
option = this.getNameSortOption(this.params);
sortBy.push({
name: globalize.translate('Folders'),
value: 'IsFolder,' + option.value
value: `${ItemSortBy.IsFolder},${option.value}`
});
}
sortBy.push({
name: globalize.translate('ParentalRating'),
value: 'OfficialRating,SortName'
value: [ItemSortBy.OfficialRating, ItemSortBy.SortName].join(',')
});
option = this.getPlayCountSortOption();
@ -1045,11 +1046,11 @@ class ItemsView {
sortBy.push({
name: globalize.translate('ReleaseDate'),
value: 'ProductionYear,PremiereDate,SortName'
value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName].join(',')
});
sortBy.push({
name: globalize.translate('Runtime'),
value: 'Runtime,SortName'
value: [ItemSortBy.Runtime, ItemSortBy.SortName].join(',')
});
return sortBy;
}
@ -1058,13 +1059,13 @@ class ItemsView {
if (params.type === 'Episode') {
return {
name: globalize.translate('Name'),
value: 'SeriesSortName,SortName'
value: [ItemSortBy.SeriesSortName, ItemSortBy.SortName].join(',')
};
}
return {
name: globalize.translate('Name'),
value: 'SortName'
value: ItemSortBy.SortName
};
}
@ -1075,7 +1076,7 @@ class ItemsView {
return {
name: globalize.translate('PlayCount'),
value: 'PlayCount,SortName'
value: [ItemSortBy.PlayCount, ItemSortBy.SortName].join(',')
};
}
@ -1086,7 +1087,7 @@ class ItemsView {
return {
name: globalize.translate('DatePlayed'),
value: 'DatePlayed,SortName'
value: [ItemSortBy.DatePlayed, ItemSortBy.SortName].join(',')
};
}
@ -1097,14 +1098,14 @@ class ItemsView {
return {
name: globalize.translate('CriticRating'),
value: 'CriticRating,SortName'
value: [ItemSortBy.CriticRating, ItemSortBy.SortName].join(',')
};
}
getCommunityRatingSortOption() {
return {
name: globalize.translate('CommunityRating'),
value: 'CommunityRating,SortName'
value: [ItemSortBy.CommunityRating, ItemSortBy.SortName].join(',')
};
}