diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bd7c55..218aedc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - # v0.0.5-dev > **Note** : This is an unstable release - feat(web): Add new About page (#258) by @prayag17 - - feat(web): Allow managing servers from settings dialog by @prayag17 \ No newline at end of file + - feat(web): Allow managing servers from settings dialog by @prayag17 + - feat(search): Add Episode to search by @prayag17 \ No newline at end of file diff --git a/src/components/card/card.tsx b/src/components/card/card.tsx index a64e3ac..44727fc 100644 --- a/src/components/card/card.tsx +++ b/src/components/card/card.tsx @@ -120,11 +120,7 @@ export const Card = ({ overrideIcon === "User" ? `${api.basePath}/Users/${item.Id}/Images/Primary` : api.getItemImageUrl( - seriesId - ? item.SeriesId - : item.AlbumId - ? item.AlbumId - : item.Id, + seriesId ? item.SeriesId : item.AlbumId ?? item.Id, imageType, { quality: 90, diff --git a/src/components/card/episodeCard.jsx b/src/components/card/episodeCard.jsx index 827125a..37bffe8 100644 --- a/src/components/card/episodeCard.jsx +++ b/src/components/card/episodeCard.jsx @@ -24,6 +24,7 @@ import PlayButton from "../buttons/playButton"; * @property {string} imageBlurhash * @property {Array} queryKey * @property {string} userId + * @property {boolean} disableRunTime * @property {() => {}} onClick */ @@ -40,6 +41,7 @@ export const EpisodeCard = ({ imageBlurhash, queryKey, userId, + disableRunTime = false, onClick, }) => { const [api] = useApi((state) => [state.api]); @@ -126,7 +128,7 @@ export const EpisodeCard = ({ @@ -172,15 +174,17 @@ export const EpisodeCard = ({ > {cardTitle} - - {getRuntimeCompact(item.RunTimeTicks)} - + {!disableRunTime && ( + + {getRuntimeCompact(item.RunTimeTicks)} + + )} { enabled: user.isSuccess, cacheTime: 0, }); + const episodes = useQuery({ + queryKey: ["search", "items", "Episodes", searchParam], + queryFn: async () => { + const result = await getSearchApi(api).get({ + userId: user.data.Id, + searchTerm, + limit: itemLimit, + includeItemTypes: ["Episode"], + }); + return result.data; + }, + enabled: user.isSuccess, + cacheTime: 0, + }); const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]); @@ -269,6 +285,23 @@ const SearchPage = () => { ))} )} + {episodes.isSuccess && episodes.data.TotalRecordCount > 0 && ( + + {episodes.data.SearchHints.map((episode) => { + return ( + + ); + })} + + )} {audio.isSuccess && audio.data.Items.length > 0 && ( {audio.data.Items.map((item, index) => (