Skip to content

Commit

Permalink
feat(frontend): add TheTVDB external link (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCatLady committed Feb 1, 2021
1 parent 6c437c5 commit 72cffd7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/assets/services/tvdb.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 22 additions & 8 deletions src/components/ExternalLinkBlock/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import React from 'react';
import TmdbLogo from '../../assets/services/tmdb.svg';
import TvdbLogo from '../../assets/services/tvdb.svg';
import ImdbLogo from '../../assets/services/imdb.svg';
import RTLogo from '../../assets/services/rt.svg';
import PlexLogo from '../../assets/services/plex.svg';
import { MediaType } from '../../../server/constants/media';

interface ExternalLinkBlockProps {
mediaType: 'movie' | 'tv';
imdbId?: string;
tmdbId?: number;
tvdbId?: number;
imdbId?: string;
rtUrl?: string;
plexUrl?: string;
}

const ExternalLinkBlock: React.FC<ExternalLinkBlockProps> = ({
imdbId,
mediaType,
tmdbId,
tvdbId,
imdbId,
rtUrl,
mediaType,
plexUrl,
}) => {
return (
<div className="flex justify-end items-center">
<div className="flex items-center justify-end">
{plexUrl && (
<a
href={plexUrl}
className="w-8 mx-2 opacity-50 hover:opacity-100 transition duration-300"
className="w-8 mx-2 transition duration-300 opacity-50 hover:opacity-100"
target="_blank"
rel="noreferrer"
>
Expand All @@ -34,17 +38,27 @@ const ExternalLinkBlock: React.FC<ExternalLinkBlockProps> = ({
{tmdbId && (
<a
href={`https://www.themoviedb.org/${mediaType}/${tmdbId}`}
className="w-8 mx-2 opacity-50 hover:opacity-100 transition duration-300"
className="w-8 mx-2 transition duration-300 opacity-50 hover:opacity-100"
target="_blank"
rel="noreferrer"
>
<TmdbLogo />
</a>
)}
{tvdbId && mediaType === MediaType.TV && (
<a
href={`http://www.thetvdb.com/?tab=series&id=${tvdbId}`}
className="w-8 mx-2 transition duration-300 opacity-50 hover:opacity-100"
target="_blank"
rel="noreferrer"
>
<TvdbLogo />
</a>
)}
{imdbId && (
<a
href={`https://www.imdb.com/title/${imdbId}`}
className="w-8 mx-2 opacity-50 hover:opacity-100 transition duration-300"
className="w-8 mx-2 transition duration-300 opacity-50 hover:opacity-100"
target="_blank"
rel="noreferrer"
>
Expand All @@ -54,7 +68,7 @@ const ExternalLinkBlock: React.FC<ExternalLinkBlockProps> = ({
{rtUrl && (
<a
href={`${rtUrl}`}
className="w-14 mx-2 opacity-50 hover:opacity-100 transition duration-300"
className="mx-2 transition duration-300 opacity-50 w-14 hover:opacity-100"
target="_blank"
rel="noreferrer"
>
Expand Down
1 change: 1 addition & 0 deletions src/components/MovieDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
<ExternalLinkBlock
mediaType="movie"
tmdbId={data.id}
tvdbId={data.externalIds.tvdbId}
imdbId={data.externalIds.imdbId}
rtUrl={ratingData?.url}
plexUrl={data.mediaInfo?.plexUrl ?? data.mediaInfo?.plexUrl4k}
Expand Down
1 change: 1 addition & 0 deletions src/components/TvDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
<ExternalLinkBlock
mediaType="tv"
tmdbId={data.id}
tvdbId={data.externalIds.tvdbId}
imdbId={data.externalIds.imdbId}
rtUrl={ratingData?.url}
plexUrl={data.mediaInfo?.plexUrl ?? data.mediaInfo?.plexUrl4k}
Expand Down

0 comments on commit 72cffd7

Please sign in to comment.