diff --git a/src/components/modules/calendar/MediaDisplay.tsx b/src/components/modules/calendar/MediaDisplay.tsx index a3e5a5674af..e3a4a90b704 100644 --- a/src/components/modules/calendar/MediaDisplay.tsx +++ b/src/components/modules/calendar/MediaDisplay.tsx @@ -1,5 +1,7 @@ -import { Stack, Image, Group, Title, Badge, Text, ActionIcon, Anchor } from '@mantine/core'; +import { Image, Group, Title, Badge, Text, ActionIcon, Anchor, ScrollArea } from '@mantine/core'; import { Link } from 'tabler-icons-react'; +import { useConfig } from '../../../tools/state'; +import { serviceItem } from '../../../tools/types'; export interface IMedia { overview: string; @@ -15,39 +17,34 @@ export interface IMedia { function MediaDisplay(props: { media: IMedia }) { const { media }: { media: IMedia } = props; return ( - - {media.poster && ( - {media.title} - )} - - ({ - height: 400, - })} - > - - - {media.title} - {media.imdbId && ( - - - - - - )} - + + + {media.poster && ( + {media.title} + )} + + {media.title} + {media.imdbId && ( + + + + + + )} {media.artist && ( - New album from {media.artist} + New release from {media.artist} )} {media.episodeNumber && media.seasonNumber && ( @@ -68,31 +65,42 @@ function MediaDisplay(props: { media: IMedia }) { Season {media.seasonNumber} episode {media.episodeNumber} )} - - {media.overview} - - {/*Add the genres at the bottom of the poster*/} - - {media.genres.map((genre: string, i: number) => ( - {genre} - ))} + + {media.overview} + + {media.genres.map((genre: string, i: number) => ( + + {genre} + + ))} + - + ); } export function ReadarrMediaDisplay(props: any) { const { media }: { media: any } = props; + const { config } = useConfig(); + // Find lidarr in services + const readarr = config.services.find((service: serviceItem) => service.type === 'Readarr'); // Find a poster CoverType - const poster = media.author.images.find((image: any) => image.coverType === 'poster'); + const poster = media.images.find((image: any) => image.coverType === 'cover'); + if (!readarr) { + return null; + } + const baseUrl = new URL(readarr.url).origin; + // Remove '/' from the end of the lidarr url + console.log(poster); + const fullLink = `${baseUrl}${poster.url}`; // Return a movie poster containting the title and the description return ( service.type === 'Lidarr'); // Find a poster CoverType - const poster = media.artist.images.find((image: any) => image.coverType === 'poster'); + const poster = media.images.find((image: any) => image.coverType === 'cover'); + if (!lidarr) { + return null; + } + const baseUrl = new URL(lidarr.url).origin; + // Remove '/' from the end of the lidarr url + const fullLink = `${baseUrl}${poster.url}`; // Return a movie poster containting the title and the description return (