fix: added deep links to issues and status badges (#3065)

This commit is contained in:
Brandon Cohen
2022-10-15 01:39:33 -04:00
committed by GitHub
parent 1dfa9431a9
commit bfe56c3470
6 changed files with 99 additions and 74 deletions

View File

@@ -22,6 +22,7 @@ import RequestModal from '@app/components/RequestModal';
import Slider from '@app/components/Slider';
import StatusBadge from '@app/components/StatusBadge';
import Season from '@app/components/TvDetails/Season';
import useDeepLinks from '@app/hooks/useDeepLinks';
import useLocale from '@app/hooks/useLocale';
import useSettings from '@app/hooks/useSettings';
import { Permission, useUser } from '@app/hooks/useUser';
@@ -122,29 +123,12 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
setShowManager(router.query.manage == '1' ? true : false);
}, [router.query.manage]);
const [plexUrl, setPlexUrl] = useState(data?.mediaInfo?.plexUrl);
const [plexUrl4k, setPlexUrl4k] = useState(data?.mediaInfo?.plexUrl4k);
useEffect(() => {
if (data) {
if (
/iPad|iPhone|iPod/.test(navigator.userAgent) ||
(navigator.userAgent === 'MacIntel' && navigator.maxTouchPoints > 1)
) {
setPlexUrl(data.mediaInfo?.iOSPlexUrl);
setPlexUrl4k(data.mediaInfo?.iOSPlexUrl4k);
} else {
setPlexUrl(data.mediaInfo?.plexUrl);
setPlexUrl4k(data.mediaInfo?.plexUrl4k);
}
}
}, [
data,
data?.mediaInfo?.iOSPlexUrl,
data?.mediaInfo?.iOSPlexUrl4k,
data?.mediaInfo?.plexUrl,
data?.mediaInfo?.plexUrl4k,
]);
const { plexUrl, plexUrl4k } = useDeepLinks({
plexUrl: data?.mediaInfo?.plexUrl,
plexUrl4k: data?.mediaInfo?.plexUrl4k,
iOSPlexUrl: data?.mediaInfo?.iOSPlexUrl,
iOSPlexUrl4k: data?.mediaInfo?.iOSPlexUrl4k,
});
if (!data && !error) {
return <LoadingSpinner />;
@@ -337,7 +321,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
inProgress={(data.mediaInfo?.downloadStatus ?? []).length > 0}
tmdbId={data.mediaInfo?.tmdbId}
mediaType="tv"
plexUrl={data.mediaInfo?.plexUrl}
plexUrl={plexUrl}
serviceUrl={data.mediaInfo?.serviceUrl}
/>
{settings.currentSettings.series4kEnabled &&
@@ -359,7 +343,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
}
tmdbId={data.mediaInfo?.tmdbId}
mediaType="tv"
plexUrl={data.mediaInfo?.plexUrl4k}
plexUrl={plexUrl4k}
serviceUrl={data.mediaInfo?.serviceUrl4k}
/>
)}