diff --git a/front/packages/models/src/resources/movie.ts b/front/packages/models/src/resources/movie.ts index 9571f042..ca3d99fb 100644 --- a/front/packages/models/src/resources/movie.ts +++ b/front/packages/models/src/resources/movie.ts @@ -25,64 +25,74 @@ import { Genre } from "./genre"; import { StudioP } from "./studio"; import { Status } from "./show"; -export const MovieP = ResourceP.merge(ImagesP).extend({ - /** - * The title of this movie. - */ - name: z.string(), - /** - * A catchphrase for this show. - */ - tagline: z.string().nullable(), - /** - * The list of alternative titles of this movie. - */ - aliases: z.array(z.string()), - /** - * The summary of this movie. - */ - overview: z.string().nullable(), - /** - * A list of tags that match this movie. - */ - tags: z.array(z.string()), - /** - /** - * Is this movie not aired yet or finished? - */ - status: z.nativeEnum(Status), - /** - * The date this movie aired. It can also be null if this is unknown. - */ - airDate: zdate().nullable(), - /** - * A youtube url for the trailer. - */ - trailer: z.string().optional().nullable(), - /** - * The list of genres (themes) this movie has. - */ - genres: z.array(z.nativeEnum(Genre)), - /** - * The studio that made this movie. - */ - studio: StudioP.optional().nullable(), - - /** - * The links to see a movie or an episode. - */ - links: z.object({ +export const MovieP = ResourceP.merge(ImagesP) + .extend({ /** - * The direct link to the unprocessed video (pristine quality). + * The title of this movie. */ - direct: z.string().transform(imageFn), + name: z.string(), + /** + * A catchphrase for this show. + */ + tagline: z.string().nullable(), + /** + * The list of alternative titles of this movie. + */ + aliases: z.array(z.string()), + /** + * The summary of this movie. + */ + overview: z.string().nullable(), + /** + * A list of tags that match this movie. + */ + tags: z.array(z.string()), + /** + * /** Is this movie not aired yet or finished? + */ + status: z.nativeEnum(Status), + /** + * The date this movie aired. It can also be null if this is unknown. + */ + airDate: zdate().nullable(), + /** + * A youtube url for the trailer. + */ + trailer: z.string().optional().nullable(), + /** + * The list of genres (themes) this movie has. + */ + genres: z.array(z.nativeEnum(Genre)), + /** + * The studio that made this movie. + */ + studio: StudioP.optional().nullable(), /** - * The link to an HLS master playlist containing all qualities available for this video. + * The links to see a movie or an episode. */ - hls: z.string().transform(imageFn), - }), -}); + links: z.object({ + /** + * The direct link to the unprocessed video (pristine quality). + */ + direct: z.string().transform(imageFn), + + /** + * The link to an HLS master playlist containing all qualities available for this video. + */ + hls: z.string().transform(imageFn), + }), + }) + .transform((x) => { + if (!x.thumbnail && x.poster) { + x.thumbnail = { ...x.poster }; + if (x.thumbnail) { + x.thumbnail.low = x.thumbnail.high; + x.thumbnail.medium = x.thumbnail.high; + } + } + return x; + }); /** * A Movie type diff --git a/front/packages/models/src/resources/show.ts b/front/packages/models/src/resources/show.ts index 30bbeba8..3b1b2d5b 100644 --- a/front/packages/models/src/resources/show.ts +++ b/front/packages/models/src/resources/show.ts @@ -35,56 +35,67 @@ export enum Status { Planned = "Planned", } -export const ShowP = ResourceP.merge(ImagesP).extend({ - /** - * The title of this show. - */ - name: z.string(), - /** - * A catchphrase for this show. - */ - tagline: z.string().nullable(), - /** - * The list of alternative titles of this show. - */ - aliases: z.array(z.string()), - /** - * The summary of this show. - */ - overview: z.string().nullable(), - /** - * A list of tags that match this movie. - */ - tags: z.array(z.string()), - /** - * Is this show airing, not aired yet or finished? - */ - status: z.nativeEnum(Status), - /** - * The date this show started airing. It can be null if this is unknown. - */ - startAir: zdate().nullable(), - /** - * The date this show finished airing. It can also be null if this is unknown. - */ - endAir: zdate().nullable(), - /** - * The list of genres (themes) this show has. - */ - genres: z.array(z.nativeEnum(Genre)), - /** - * A youtube url for the trailer. - */ - trailer: z.string().optional().nullable(), - /** - * The studio that made this show. - */ - studio: StudioP.optional().nullable(), - /** - * The list of seasons of this show. - */ - seasons: z.array(SeasonP).optional(), -}); +export const ShowP = ResourceP.merge(ImagesP) + .extend({ + /** + * The title of this show. + */ + name: z.string(), + /** + * A catchphrase for this show. + */ + tagline: z.string().nullable(), + /** + * The list of alternative titles of this show. + */ + aliases: z.array(z.string()), + /** + * The summary of this show. + */ + overview: z.string().nullable(), + /** + * A list of tags that match this movie. + */ + tags: z.array(z.string()), + /** + * Is this show airing, not aired yet or finished? + */ + status: z.nativeEnum(Status), + /** + * The date this show started airing. It can be null if this is unknown. + */ + startAir: zdate().nullable(), + /** + * The date this show finished airing. It can also be null if this is unknown. + */ + endAir: zdate().nullable(), + /** + * The list of genres (themes) this show has. + */ + genres: z.array(z.nativeEnum(Genre)), + /** + * A youtube url for the trailer. + */ + trailer: z.string().optional().nullable(), + /** + * The studio that made this show. + */ + studio: StudioP.optional().nullable(), + /** + * The list of seasons of this show. + */ + seasons: z.array(SeasonP).optional(), + }) + .transform((x) => { + if (!x.thumbnail && x.poster) { + x.thumbnail = { ...x.poster }; + if (x.thumbnail) { + x.thumbnail.low = x.thumbnail.high; + x.thumbnail.medium = x.thumbnail.high; + } + } + return x; + }); /** * A tv serie or an anime. diff --git a/front/packages/ui/src/browse/list.tsx b/front/packages/ui/src/browse/list.tsx index 46017216..e2ddaf60 100644 --- a/front/packages/ui/src/browse/list.tsx +++ b/front/packages/ui/src/browse/list.tsx @@ -46,7 +46,7 @@ export const ItemList = ({ setHovered((i) => i + 1)}