feat(person): add tmdb- and imdb link on person detail page (#2136)
Signed-off-by: Florian Hoech <code@florians-web.de>
This commit is contained in:
@@ -12,8 +12,10 @@ import useSettings from '@app/hooks/useSettings';
|
|||||||
import { MediaType } from '@server/constants/media';
|
import { MediaType } from '@server/constants/media';
|
||||||
import { MediaServerType } from '@server/constants/server';
|
import { MediaServerType } from '@server/constants/server';
|
||||||
|
|
||||||
|
type ExternalLinkType = 'movie' | 'tv' | 'person';
|
||||||
|
|
||||||
interface ExternalLinkBlockProps {
|
interface ExternalLinkBlockProps {
|
||||||
mediaType: 'movie' | 'tv';
|
mediaType: ExternalLinkType;
|
||||||
tmdbId?: number;
|
tmdbId?: number;
|
||||||
tvdbId?: number;
|
tvdbId?: number;
|
||||||
imdbId?: string;
|
imdbId?: string;
|
||||||
@@ -71,7 +73,7 @@ const ExternalLinkBlock = ({
|
|||||||
<TvdbLogo />
|
<TvdbLogo />
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{imdbId && (
|
{imdbId && mediaType !== 'person' && (
|
||||||
<a
|
<a
|
||||||
href={`https://www.imdb.com/title/${imdbId}`}
|
href={`https://www.imdb.com/title/${imdbId}`}
|
||||||
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
|
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
|
||||||
@@ -81,6 +83,16 @@ const ExternalLinkBlock = ({
|
|||||||
<ImdbLogo />
|
<ImdbLogo />
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
{imdbId && mediaType === 'person' && (
|
||||||
|
<a
|
||||||
|
href={`https://www.imdb.com/name/${imdbId}`}
|
||||||
|
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
|
<ImdbLogo />
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
{rtUrl && (
|
{rtUrl && (
|
||||||
<a
|
<a
|
||||||
href={rtUrl}
|
href={rtUrl}
|
||||||
@@ -91,7 +103,7 @@ const ExternalLinkBlock = ({
|
|||||||
<RTLogo />
|
<RTLogo />
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{tmdbId && (
|
{tmdbId && mediaType !== 'person' && (
|
||||||
<a
|
<a
|
||||||
href={`https://trakt.tv/search/tmdb/${tmdbId}?id_type=${
|
href={`https://trakt.tv/search/tmdb/${tmdbId}?id_type=${
|
||||||
mediaType === 'movie' ? 'movie' : 'show'
|
mediaType === 'movie' ? 'movie' : 'show'
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import CachedImage from '@app/components/Common/CachedImage';
|
|||||||
import ImageFader from '@app/components/Common/ImageFader';
|
import ImageFader from '@app/components/Common/ImageFader';
|
||||||
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||||
import PageTitle from '@app/components/Common/PageTitle';
|
import PageTitle from '@app/components/Common/PageTitle';
|
||||||
|
import ExternalLinkBlock from '@app/components/ExternalLinkBlock';
|
||||||
import TitleCard from '@app/components/TitleCard';
|
import TitleCard from '@app/components/TitleCard';
|
||||||
import globalMessages from '@app/i18n/globalMessages';
|
import globalMessages from '@app/i18n/globalMessages';
|
||||||
import ErrorPage from '@app/pages/_error';
|
import ErrorPage from '@app/pages/_error';
|
||||||
@@ -277,6 +278,15 @@ const PersonDetails = () => {
|
|||||||
{mediaTypePicker}
|
{mediaTypePicker}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex w-full items-center justify-center lg:justify-between">
|
||||||
|
<div className="mb-3 mt-3">
|
||||||
|
<ExternalLinkBlock
|
||||||
|
mediaType="person"
|
||||||
|
tmdbId={data.id}
|
||||||
|
imdbId={data.imdbId}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="mb-2 mt-1 space-y-1 text-xs text-white sm:text-sm lg:text-base">
|
<div className="mb-2 mt-1 space-y-1 text-xs text-white sm:text-sm lg:text-base">
|
||||||
<div>{personAttributes.join(' | ')}</div>
|
<div>{personAttributes.join(' | ')}</div>
|
||||||
{(data.alsoKnownAs ?? []).length > 0 && (
|
{(data.alsoKnownAs ?? []).length > 0 && (
|
||||||
|
|||||||
Reference in New Issue
Block a user