Movies get a theatre/stream/blu-ray icon in the info row, series get the latest aired episode as S03 E07. Both reveal the relevant dates on hover or tap through a shared Hint tooltip. Release dates ride along on the details request via append_to_response and the series fields are already in the tv payload, so neither indicator costs an extra call. Theatre state is only claimed while the run can still be current, otherwise a classic with no digital entry would read as in cinemas. The credits carousel now opens with the director, read from the crew array that the credits response already carries. A series has no single director, so the one behind most episodes stands in. Drop with_cast from the starring query: TMDB ANDs it with with_people, so every director link would have resolved to an empty list. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
29 lines
879 B
TypeScript
29 lines
879 B
TypeScript
import movieAdvisor from '../clients/movieAdvisor';
|
|
import mapMoviesSeriesResponseToShows from '../dto/Show';
|
|
|
|
export type PopularQueryProps = {
|
|
sortBy?: string;
|
|
starring?: string;
|
|
};
|
|
|
|
const popularQuery = ({ sortBy = 'popularity.desc', starring }: PopularQueryProps = {}) => ({
|
|
queryKey: ['popular', sortBy, starring],
|
|
initialPageParam: '1',
|
|
queryFn: ({ pageParam = '1' }: { pageParam?: string }) =>
|
|
movieAdvisor
|
|
.get<TMDBPagination<Movie>>('/discover/movie', {
|
|
params: {
|
|
page: pageParam,
|
|
sort_by: sortBy,
|
|
// with_people covers cast and crew, with_cast on top of it would AND directors away
|
|
with_people: starring,
|
|
'vote_count.gte': 300,
|
|
'vote_average.lte': 10,
|
|
'vote_average.gte': 5
|
|
}
|
|
})
|
|
.then(mapMoviesSeriesResponseToShows)
|
|
});
|
|
|
|
export default popularQuery;
|