Skip to content

Commit fb2ee7c

Browse files
authored
feat(person): add tmdb- and imdb link on person detail page (#2136)
Signed-off-by: Florian Hoech <code@florians-web.de>
1 parent eaf397a commit fb2ee7c

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

src/components/ExternalLinkBlock/index.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import useSettings from '@app/hooks/useSettings';
1212
import { MediaType } from '@server/constants/media';
1313
import { MediaServerType } from '@server/constants/server';
1414

15+
type ExternalLinkType = 'movie' | 'tv' | 'person';
16+
1517
interface ExternalLinkBlockProps {
16-
mediaType: 'movie' | 'tv';
18+
mediaType: ExternalLinkType;
1719
tmdbId?: number;
1820
tvdbId?: number;
1921
imdbId?: string;
@@ -71,7 +73,7 @@ const ExternalLinkBlock = ({
7173
<TvdbLogo />
7274
</a>
7375
)}
74-
{imdbId && (
76+
{imdbId && mediaType !== 'person' && (
7577
<a
7678
href={`https://www.imdb.com/title/${imdbId}`}
7779
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
@@ -81,6 +83,16 @@ const ExternalLinkBlock = ({
8183
<ImdbLogo />
8284
</a>
8385
)}
86+
{imdbId && mediaType === 'person' && (
87+
<a
88+
href={`https://www.imdb.com/name/${imdbId}`}
89+
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
90+
target="_blank"
91+
rel="noreferrer"
92+
>
93+
<ImdbLogo />
94+
</a>
95+
)}
8496
{rtUrl && (
8597
<a
8698
href={rtUrl}
@@ -91,7 +103,7 @@ const ExternalLinkBlock = ({
91103
<RTLogo />
92104
</a>
93105
)}
94-
{tmdbId && (
106+
{tmdbId && mediaType !== 'person' && (
95107
<a
96108
href={`https://trakt.tv/search/tmdb/${tmdbId}?id_type=${
97109
mediaType === 'movie' ? 'movie' : 'show'

src/components/PersonDetails/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import CachedImage from '@app/components/Common/CachedImage';
33
import ImageFader from '@app/components/Common/ImageFader';
44
import LoadingSpinner from '@app/components/Common/LoadingSpinner';
55
import PageTitle from '@app/components/Common/PageTitle';
6+
import ExternalLinkBlock from '@app/components/ExternalLinkBlock';
67
import TitleCard from '@app/components/TitleCard';
78
import globalMessages from '@app/i18n/globalMessages';
89
import ErrorPage from '@app/pages/_error';
@@ -277,6 +278,15 @@ const PersonDetails = () => {
277278
{mediaTypePicker}
278279
</div>
279280
</div>
281+
<div className="flex w-full items-center justify-center lg:justify-between">
282+
<div className="mb-3 mt-3">
283+
<ExternalLinkBlock
284+
mediaType="person"
285+
tmdbId={data.id}
286+
imdbId={data.imdbId}
287+
/>
288+
</div>
289+
</div>
280290
<div className="mb-2 mt-1 space-y-1 text-xs text-white sm:text-sm lg:text-base">
281291
<div>{personAttributes.join(' | ')}</div>
282292
{(data.alsoKnownAs ?? []).length > 0 && (

0 commit comments

Comments
 (0)