-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to use fanart as thumbnail fallback (#924)
- Loading branch information
1 parent
e516e79
commit 80a840e
Showing
9 changed files
with
55 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
import { useMemo } from 'react'; | ||
|
||
import { useSettingsQuery } from '@/core/react-query/settings/queries'; | ||
|
||
import type { ImageType } from '@/core/types/api/common'; | ||
import type { EpisodeType } from '@/core/types/api/episode'; | ||
|
||
function useEpisodeThumbnail(episode: EpisodeType): ImageType | null { | ||
return useMemo(() => episode.TvDB?.[0]?.Thumbnail ?? null, [episode]); | ||
function useEpisodeThumbnail( | ||
episode: EpisodeType, | ||
fanart: ImageType | undefined, | ||
): ImageType | null { | ||
const { useThumbnailFallback } = useSettingsQuery().data.WebUI_Settings.collection.image; | ||
return useMemo(() => { | ||
if (episode.TvDB?.[0]?.Thumbnail) return episode.TvDB[0].Thumbnail; | ||
if (useThumbnailFallback && fanart) return fanart; | ||
return null; | ||
}, [episode.TvDB, fanart, useThumbnailFallback]); | ||
} | ||
|
||
export default useEpisodeThumbnail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters