mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 12:18:35 -05:00
111 lines
3.1 KiB
TypeScript
111 lines
3.1 KiB
TypeScript
import EmbyLogo from '@app/assets/services/emby.svg';
|
|
import ImdbLogo from '@app/assets/services/imdb.svg';
|
|
import JellyfinLogo from '@app/assets/services/jellyfin.svg';
|
|
import PlexLogo from '@app/assets/services/plex.svg';
|
|
import RTLogo from '@app/assets/services/rt.svg';
|
|
import TmdbLogo from '@app/assets/services/tmdb.svg';
|
|
import TraktLogo from '@app/assets/services/trakt.svg';
|
|
import TvdbLogo from '@app/assets/services/tvdb.svg';
|
|
import useLocale from '@app/hooks/useLocale';
|
|
import useSettings from '@app/hooks/useSettings';
|
|
import { MediaType } from '@server/constants/media';
|
|
import { MediaServerType } from '@server/constants/server';
|
|
import getConfig from 'next/config';
|
|
|
|
interface ExternalLinkBlockProps {
|
|
mediaType: 'movie' | 'tv';
|
|
tmdbId?: number;
|
|
tvdbId?: number;
|
|
imdbId?: string;
|
|
rtUrl?: string;
|
|
mediaUrl?: string;
|
|
}
|
|
|
|
const ExternalLinkBlock = ({
|
|
mediaType,
|
|
tmdbId,
|
|
tvdbId,
|
|
imdbId,
|
|
rtUrl,
|
|
mediaUrl,
|
|
}: ExternalLinkBlockProps) => {
|
|
const settings = useSettings();
|
|
const { publicRuntimeConfig } = getConfig();
|
|
const { locale } = useLocale();
|
|
|
|
return (
|
|
<div className="flex w-full items-center justify-center space-x-5">
|
|
{mediaUrl && (
|
|
<a
|
|
href={mediaUrl}
|
|
className="w-12 opacity-50 transition duration-300 hover:opacity-100"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
{settings.currentSettings.mediaServerType === MediaServerType.PLEX ? (
|
|
<PlexLogo />
|
|
) : publicRuntimeConfig.JELLYFIN_TYPE == 'emby' ? (
|
|
<EmbyLogo />
|
|
) : (
|
|
<JellyfinLogo />
|
|
)}
|
|
</a>
|
|
)}
|
|
{tmdbId && (
|
|
<a
|
|
href={`https://www.themoviedb.org/${mediaType}/${tmdbId}?language=${locale}`}
|
|
className="w-8 opacity-50 transition duration-300 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-9 opacity-50 transition duration-300 hover:opacity-100"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
<TvdbLogo />
|
|
</a>
|
|
)}
|
|
{imdbId && (
|
|
<a
|
|
href={`https://www.imdb.com/title/${imdbId}`}
|
|
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
<ImdbLogo />
|
|
</a>
|
|
)}
|
|
{rtUrl && (
|
|
<a
|
|
href={rtUrl}
|
|
className="w-14 opacity-50 transition duration-300 hover:opacity-100"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
<RTLogo />
|
|
</a>
|
|
)}
|
|
{tmdbId && (
|
|
<a
|
|
href={`https://trakt.tv/search/tmdb/${tmdbId}?id_type=${
|
|
mediaType === 'movie' ? 'movie' : 'show'
|
|
}`}
|
|
className="w-8 opacity-50 transition duration-300 hover:opacity-100"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
<TraktLogo />
|
|
</a>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ExternalLinkBlock;
|