diff --git a/src/components/ContinueWatchingItem/ContinueWatchingItem.js b/src/components/ContinueWatchingItem/ContinueWatchingItem.js index 8a0143619..8e56179df 100644 --- a/src/components/ContinueWatchingItem/ContinueWatchingItem.js +++ b/src/components/ContinueWatchingItem/ContinueWatchingItem.js @@ -5,24 +5,11 @@ const PropTypes = require('prop-types'); const { useServices } = require('stremio/services'); const LibItem = require('stremio/components/LibItem'); -const ContinueWatchingItem = ({ _id, notifications, deepLinks, ...props }) => { +const ContinueWatchingItem = ({ _id, notifications, ...props }) => { const { core } = useServices(); - const onClick = React.useCallback(() => { - if (deepLinks?.metaDetailsVideos ?? deepLinks?.metaDetailsStreams) { - window.location = deepLinks?.metaDetailsVideos ?? deepLinks?.metaDetailsStreams; - } - }, [deepLinks]); - - const onPlayClick = React.useCallback((event) => { - event.stopPropagation(); - if (deepLinks?.player ?? deepLinks?.metaDetailsStreams ?? deepLinks?.metaDetailsVideos) { - window.location = deepLinks?.player ?? deepLinks?.metaDetailsStreams ?? deepLinks?.metaDetailsVideos; - } - }, [deepLinks]); - const onDismissClick = React.useCallback((event) => { - event.stopPropagation(); + event.preventDefault(); if (typeof _id === 'string') { core.transport.dispatch({ action: 'Ctx', @@ -47,8 +34,6 @@ const ContinueWatchingItem = ({ _id, notifications, deepLinks, ...props }) => { _id={_id} posterChangeCursor={true} notifications={notifications} - onClick={onClick} - onPlayClick={onPlayClick} onDismissClick={onDismissClick} /> ); diff --git a/src/components/LibItem/LibItem.js b/src/components/LibItem/LibItem.js index a42def27f..7157d913a 100644 --- a/src/components/LibItem/LibItem.js +++ b/src/components/LibItem/LibItem.js @@ -29,7 +29,7 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => { case 'details': return props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string'); case 'watched': - return props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string'); + return typeof watched !== 'undefined' && props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string'); case 'dismiss': return typeof _id === 'string' && props.progress !== null && !isNaN(props.progress) && props.progress > 0; case 'remove': @@ -119,6 +119,13 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => { } }, [_id, props.deepLinks, props.optionOnSelect]); + const onPlayClick = React.useCallback((event) => { + if (props.deepLinks && typeof props.deepLinks.player === 'string') { + event.preventDefault(); + window.location = props.deepLinks.player; + } + }, [props.deepLinks]); + return ( { newVideos={newVideos} options={options} optionOnSelect={optionOnSelect} + onPlayClick={props.deepLinks && typeof props.deepLinks.player === 'string' ? onPlayClick : null} /> ); }; diff --git a/src/components/MetaItem/MetaItem.js b/src/components/MetaItem/MetaItem.js index 1e19054c1..0e66c6a9e 100644 --- a/src/components/MetaItem/MetaItem.js +++ b/src/components/MetaItem/MetaItem.js @@ -18,14 +18,14 @@ const MetaItem = React.memo(({ className, type, name, poster, posterShape, poste const [menuOpen, onMenuOpen, onMenuClose] = useBinaryState(false); const href = React.useMemo(() => { return deepLinks ? - typeof deepLinks.player === 'string' ? - deepLinks.player + typeof deepLinks.metaDetailsStreams === 'string' ? + deepLinks.metaDetailsStreams : - typeof deepLinks.metaDetailsStreams === 'string' ? - deepLinks.metaDetailsStreams + typeof deepLinks.metaDetailsVideos === 'string' ? + deepLinks.metaDetailsVideos : - typeof deepLinks.metaDetailsVideos === 'string' ? - deepLinks.metaDetailsVideos + typeof deepLinks.player === 'string' ? + deepLinks.player : null :