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>
24 lines
693 B
TypeScript
24 lines
693 B
TypeScript
const ENDED_STATUSES = ['Ended', 'Canceled'];
|
|
|
|
export const mapDetailsToAiring = ({
|
|
last_episode_to_air,
|
|
next_episode_to_air,
|
|
number_of_seasons,
|
|
status
|
|
}: TMDBSeriesDetails): Airing | undefined => {
|
|
// before a premiere there is nothing aired yet, the upcoming episode is the only position we have
|
|
const current = last_episode_to_air || next_episode_to_air;
|
|
|
|
if (!current) return undefined;
|
|
|
|
return {
|
|
season: current.season_number,
|
|
episode: current.episode_number,
|
|
seasons: number_of_seasons || current.season_number,
|
|
ended: ENDED_STATUSES.includes(status || ''),
|
|
next: next_episode_to_air?.air_date || undefined
|
|
};
|
|
};
|
|
|
|
export default mapDetailsToAiring;
|