Skip to content

Commit

Permalink
WJ-125 - Update: Tv info;
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Teixeira committed Nov 17, 2020
1 parent 809e437 commit 13d70f6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/domains/Tv/api/Details/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ const parseResponse = (tv: RawResponse): Response => {
tagline: tv.tagline,
runtime: `${tv.episode_run_time} min`,

seasonsCount: tv.number_of_seasons,
seasonsDescription:
tv.number_of_seasons > 1
? `${tv.number_of_seasons} temporadas`
: `${tv.number_of_seasons} temporada`,

episodesCount: tv.number_of_episodes,
episodesDescription:
tv.number_of_episodes > 1
? `${tv.number_of_episodes} episódios`
: `${tv.number_of_episodes} episódio`,

creatorName: tv.created_by[0]?.name,

releaseDate: getReleaseDate(tv),
Expand Down
2 changes: 2 additions & 0 deletions src/domains/Tv/api/Details/types/RawResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default interface RawResponse {
vote_count: number;
vote_average: number;
created_by: any[];
number_of_seasons: number;
number_of_episodes: number;

credits?: Credits;
recommendations?: {
Expand Down
5 changes: 5 additions & 0 deletions src/domains/Tv/api/Details/types/Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default interface Response {
voteAverage: number;
creatorName: string;

seasonsCount: number;
seasonsDescription: string;
episodesCount: number;
episodesDescription: string;

recommendations?: Recommendations[];
images?: Images;
credits?: Credits;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Tv/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ const Tv: React.FC<any> = () => {
<TitleContainer>
<Title>{tv.title}</Title>
<Subtitle>
{tv.releaseDate} | {tv.genresNames} | {tv.runtime}
{tv.releaseDate} | {tv.genresNames} |{' '}
{tv.seasonsDescription} | {tv.runtime}
</Subtitle>
</TitleContainer>
{tv.tagline && <Tagline>{`"${tv.tagline}"`}</Tagline>}
Expand Down

0 comments on commit 13d70f6

Please sign in to comment.