mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-16 17:22:38 +00:00
refactor: simplify handling on the libitem
This commit is contained in:
parent
e26c33fe33
commit
68c0a4fb13
1 changed files with 7 additions and 4 deletions
|
|
@ -119,11 +119,14 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
||||||
}
|
}
|
||||||
}, [_id, props.deepLinks, props.optionOnSelect]);
|
}, [_id, props.deepLinks, props.optionOnSelect]);
|
||||||
|
|
||||||
const onPlayClick = React.useCallback((event) => {
|
const onPlayClick = React.useMemo(() => {
|
||||||
if (props.deepLinks && typeof props.deepLinks.player === 'string') {
|
if (props.deepLinks && typeof props.deepLinks.player === 'string') {
|
||||||
event.preventDefault();
|
return (event) => {
|
||||||
window.location = props.deepLinks.player;
|
event.preventDefault();
|
||||||
|
window.location = props.deepLinks.player;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}, [props.deepLinks]);
|
}, [props.deepLinks]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -133,7 +136,7 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
||||||
newVideos={newVideos}
|
newVideos={newVideos}
|
||||||
options={options}
|
options={options}
|
||||||
optionOnSelect={optionOnSelect}
|
optionOnSelect={optionOnSelect}
|
||||||
onPlayClick={props.deepLinks && typeof props.deepLinks.player === 'string' ? onPlayClick : null}
|
onPlayClick={onPlayClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue