From cb3abbc1c72253254c4ed818f6e67bf9bd68b810 Mon Sep 17 00:00:00 2001 From: Aj - Thomas Date: Mon, 9 May 2022 22:03:09 +0200 Subject: [PATCH] Use general media display component Instead of a different one for each media type --- components/modules/calendar/MediaDisplay.tsx | 94 ++++++++++---------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/components/modules/calendar/MediaDisplay.tsx b/components/modules/calendar/MediaDisplay.tsx index 5c6a5c2bc..dcea62458 100644 --- a/components/modules/calendar/MediaDisplay.tsx +++ b/components/modules/calendar/MediaDisplay.tsx @@ -2,22 +2,20 @@ import { Stack, Image, Group, Title, Badge, Text, ActionIcon, Anchor } from '@ma import { Link } from 'tabler-icons-react'; export interface IMedia { - id: string; + overview: string; + imdbId: any; title: string; - description: string; poster: string; - type: string; genres: string[]; + seasonNumber?: number; + episodeNumber?: number; } -export function RadarrMediaDisplay(props: any) { - const { media }: { media: any } = props; - // Find a poster CoverType - const poster = media.images.find((image: any) => image.coverType === 'poster'); - // Return a movie poster containting the title and the description +function MediaDisplay(props: { media: IMedia }) { + const { media }: { media: IMedia } = props; return ( - - {media.title} + + {media.title} ({ @@ -33,7 +31,17 @@ export function RadarrMediaDisplay(props: any) { - {media.overview} + {media.episodeNumber && media.seasonNumber && ( + + Season {media.seasonNumber} episode {media.episodeNumber} + + )} + {media.overview} {/*Add the genres at the bottom of the poster*/} @@ -46,46 +54,40 @@ export function RadarrMediaDisplay(props: any) { ); } +export function RadarrMediaDisplay(props: any) { + const { media }: { media: any } = props; + // Find a poster CoverType + const poster = media.images.find((image: any) => image.coverType === 'poster'); + // Return a movie poster containting the title and the description + return ( + + ); +} + export function SonarrMediaDisplay(props: any) { const { media }: { media: any } = props; // Find a poster CoverType const poster = media.series.images.find((image: any) => image.coverType === 'poster'); // Return a movie poster containting the title and the description return ( - - {media.series.title} - ({ - height: 400, - })} - > - - - {media.series.title} - - - - - - - - Season {media.seasonNumber} episode {media.episodeNumber} - - {media.series.overview} - - {/*Add the genres at the bottom of the poster*/} - - {media.series.genres.map((genre: string, i: number) => ( - {genre} - ))} - - - + ); }