mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-09-03 03:50:02 +03:00
Fix favorite handling for studios
This commit is contained in:
@@ -68,6 +68,7 @@ const FiltersStatus: FC<FiltersStatusProps> = ({
|
||||
&& viewType !== LibraryTab.PhotoAlbums
|
||||
&& viewType !== LibraryTab.Authors
|
||||
&& viewType !== LibraryTab.Photos
|
||||
&& viewType !== LibraryTab.Studios
|
||||
) {
|
||||
visibleFiltersStatus.push(ItemFilter.IsUnplayed);
|
||||
visibleFiltersStatus.push(ItemFilter.IsPlayed);
|
||||
|
||||
@@ -54,7 +54,6 @@ const playlistsTabContent: LibraryTabContent = {
|
||||
const studiosTabContent: LibraryTabContent = {
|
||||
viewType: LibraryTab.Studios,
|
||||
itemType: [BaseItemKind.Movie],
|
||||
isBtnFilterEnabled: false,
|
||||
isBtnGridListEnabled: false,
|
||||
isBtnSortEnabled: false
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ const seriesTabContent: LibraryTabContent = {
|
||||
const studiosTabContent: LibraryTabContent = {
|
||||
viewType: LibraryTab.Studios,
|
||||
itemType: [BaseItemKind.Series],
|
||||
isBtnFilterEnabled: false,
|
||||
isBtnGridListEnabled: false,
|
||||
isBtnSortEnabled: false
|
||||
};
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
|
||||
import { ImageType } from '@jellyfin/sdk/lib/generated-client/models/image-type';
|
||||
import { ItemFields } from '@jellyfin/sdk/lib/generated-client/models/item-fields';
|
||||
import { ItemSortBy } from '@jellyfin/sdk/lib/generated-client/models/item-sort-by';
|
||||
import { getStudiosApi } from '@jellyfin/sdk/lib/utils/api/studios-api';
|
||||
|
||||
import cardBuilder from 'components/cardbuilder/cardBuilder';
|
||||
import { getBackdropShape, getPortraitShape, getSquareShape } from 'components/cardbuilder/utils/shape';
|
||||
@@ -7,6 +10,7 @@ import focusManager from 'components/focusManager';
|
||||
import layoutManager from 'components/layoutManager';
|
||||
import { appRouter } from 'components/router/appRouter';
|
||||
import dom from 'utils/dom';
|
||||
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
||||
import globalize from 'lib/globalize';
|
||||
import { ServerConnections } from 'lib/jellyfin-apiclient';
|
||||
|
||||
@@ -92,6 +96,15 @@ function getSections() {
|
||||
centerText: true,
|
||||
overlayPlayButton: true,
|
||||
coverImage: true
|
||||
}, {
|
||||
name: 'Studios',
|
||||
types: BaseItemKind.Studio,
|
||||
shape: getBackdropShape(enableScrollX()),
|
||||
preferThumb: true,
|
||||
showTitle: true,
|
||||
overlayText: false,
|
||||
centerText: true,
|
||||
overlayPlayButton: true
|
||||
}, {
|
||||
name: 'People',
|
||||
types: 'Person',
|
||||
@@ -189,6 +202,19 @@ function getFetchDataFn(section) {
|
||||
options.Limit = 20;
|
||||
const userId = apiClient.getCurrentUserId();
|
||||
|
||||
if (section.types === BaseItemKind.Studio) {
|
||||
return getStudiosApi(toApi(apiClient))
|
||||
.getStudios({
|
||||
userId,
|
||||
isFavorite: true,
|
||||
fields: [ItemFields.PrimaryImageAspectRatio],
|
||||
enableImageTypes: [ImageType.Thumb],
|
||||
enableTotalRecordCount: false,
|
||||
limit: options.Limit
|
||||
})
|
||||
.then(({ data }) => data);
|
||||
}
|
||||
|
||||
if (section.types === 'MusicArtist') {
|
||||
return apiClient.getArtists(userId, options);
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ const fetchGetItemsViewByType = async (
|
||||
) => {
|
||||
const { api, user } = currentApi;
|
||||
if (api && user?.Id) {
|
||||
const isFavorite = libraryViewSettings.Filters?.Status?.includes(ItemFilter.IsFavorite) || undefined;
|
||||
let response;
|
||||
switch (viewType) {
|
||||
case LibraryTab.AlbumArtists: {
|
||||
@@ -304,6 +305,7 @@ const fetchGetItemsViewByType = async (
|
||||
...getLimitQuery(),
|
||||
...getAlphaPickerQuery(libraryViewSettings),
|
||||
includeItemTypes: itemType,
|
||||
isFavorite,
|
||||
enableImageTypes: [ImageType.Thumb],
|
||||
startIndex: libraryViewSettings.StartIndex
|
||||
},
|
||||
@@ -318,9 +320,7 @@ const fetchGetItemsViewByType = async (
|
||||
userId: user.Id,
|
||||
fields: [ItemFields.PrimaryImageAspectRatio],
|
||||
startIndex: libraryViewSettings.StartIndex,
|
||||
isFavorite: libraryViewSettings.Filters?.Status?.includes(ItemFilter.IsFavorite) ?
|
||||
true :
|
||||
undefined,
|
||||
isFavorite,
|
||||
enableImageTypes: [ImageType.Primary]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user