Merge pull request #1622 from Tagaishi/overseerr-link-in-search-fix

This commit is contained in:
Thomas Camlong
2023-11-14 20:04:55 +01:00
committed by GitHub

View File

@@ -2,7 +2,6 @@ import {
Button, Button,
Card, Card,
Center, Center,
Divider,
Grid, Grid,
Group, Group,
Loader, Loader,
@@ -134,8 +133,11 @@ const MovieDisplay = ({ movie, type }: MovieDisplayProps) => {
const service = config.apps.find((service) => service.integration.type === type); const service = config.apps.find((service) => service.integration.type === type);
const mediaUrl = movie.mediaInfo?.plexUrl ?? movie.mediaInfo?.mediaUrl; const mediaUrl = movie.mediaInfo?.plexUrl ?? movie.mediaInfo?.mediaUrl;
const serviceUrl = service?.behaviour.externalUrl ? service.behaviour.externalUrl : service?.url; const serviceUrl = service?.behaviour.externalUrl ?? service?.url;
const externalUrl = movie.mediaInfo?.serviceUrl; const externalUrl = new URL(
`${movie.mediaType}/${movie.id}`,
serviceUrl ?? 'https://www.themoviedb.org'
);
return ( return (
<Card withBorder> <Card withBorder>
@@ -192,16 +194,16 @@ const MovieDisplay = ({ movie, type }: MovieDisplayProps) => {
{t('buttons.play')} {t('buttons.play')}
</Button> </Button>
)} )}
{serviceUrl && ( {externalUrl && (
<Button <Button
component="a" component="a"
target="_blank" target="_blank"
href={externalUrl} href={externalUrl.href}
variant="outline" variant="outline"
size="sm" size="sm"
rightIcon={<IconExternalLink size={15} />} rightIcon={<IconExternalLink size={15} />}
> >
{type === 'jellyseerr' ? 'Jellyfin' : 'Overseerr'} {serviceUrl ? (type === 'jellyseerr' ? 'Jellyfin' : 'Overseerr') : 'TMDB'}
</Button> </Button>
)} )}
</Group> </Group>