mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Separate LiveTvProgram to a standalone query
This commit is contained in:
parent
69df532c27
commit
cdd330a01f
3 changed files with 59 additions and 2 deletions
|
@ -10,6 +10,8 @@ import { useVideoSearch } from './useVideoSearch';
|
|||
import { Section } from '../types';
|
||||
import { useLiveTvSearch } from './useLiveTvSearch';
|
||||
import { fetchItemsByType } from './fetchItemsByType';
|
||||
import { useProgramsSearch } from './useProgramsSearch';
|
||||
import { LIVETV_CARD_OPTIONS } from '../constants/liveTvCardOptions';
|
||||
|
||||
export const useSearchItems = (
|
||||
parentId?: string,
|
||||
|
@ -19,6 +21,7 @@ export const useSearchItems = (
|
|||
const { data: artists, isPending: isArtistsPending } = useArtistsSearch(parentId, collectionType, searchTerm);
|
||||
const { data: people, isPending: isPeoplePending } = usePeopleSearch(parentId, collectionType, searchTerm);
|
||||
const { data: videos, isPending: isVideosPending } = useVideoSearch(parentId, collectionType, searchTerm);
|
||||
const { data: programs, isPending: isProgramsPending } = useProgramsSearch(parentId, collectionType, searchTerm);
|
||||
const { data: liveTvSections, isPending: isLiveTvPending } = useLiveTvSearch(parentId, collectionType, searchTerm);
|
||||
const { api, user } = useApi();
|
||||
const userId = user?.Id;
|
||||
|
@ -26,6 +29,7 @@ export const useSearchItems = (
|
|||
const isArtistsEnabled = !isArtistsPending || (collectionType && !isMusic(collectionType));
|
||||
const isPeopleEnabled = !isPeoplePending || (collectionType && !isMovies(collectionType) && !isTVShows(collectionType));
|
||||
const isVideosEnabled = !isVideosPending || collectionType;
|
||||
const isProgramsEnabled = !isProgramsPending || collectionType;
|
||||
const isLiveTvEnabled = !isLiveTvPending || !collectionType || !isLivetv(collectionType);
|
||||
|
||||
return useQuery({
|
||||
|
@ -41,6 +45,10 @@ export const useSearchItems = (
|
|||
coverImage: true
|
||||
});
|
||||
|
||||
addSection(sections, 'Programs', programs?.Items, {
|
||||
...LIVETV_CARD_OPTIONS
|
||||
});
|
||||
|
||||
addSection(sections, 'People', people?.Items, {
|
||||
coverImage: true
|
||||
});
|
||||
|
@ -77,6 +85,6 @@ export const useSearchItems = (
|
|||
|
||||
return sortSections(sections);
|
||||
},
|
||||
enabled: !!api && !!userId && !!isArtistsEnabled && !!isPeopleEnabled && !!isVideosEnabled && !!isLiveTvEnabled
|
||||
enabled: !!api && !!userId && !!isArtistsEnabled && !!isPeopleEnabled && !!isVideosEnabled && !!isLiveTvEnabled && !!isProgramsEnabled
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue