mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 06:32:11 +00:00
feat(LibItem): use navigate instead window location
This commit is contained in:
parent
9a3ac82479
commit
173745042c
1 changed files with 6 additions and 4 deletions
|
|
@ -1,14 +1,15 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
|
||||
const React = require('react');
|
||||
const { useNavigate } = require('react-router');
|
||||
const { useServices } = require('stremio/services');
|
||||
const PropTypes = require('prop-types');
|
||||
const MetaItem = require('stremio/components/MetaItem');
|
||||
const { t } = require('i18next');
|
||||
|
||||
const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
||||
|
||||
const { core } = useServices();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const newVideos = React.useMemo(() => {
|
||||
const count = notifications.items?.[_id]?.length ?? 0;
|
||||
|
|
@ -50,7 +51,8 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
|||
switch (event.value) {
|
||||
case 'play': {
|
||||
if (props.deepLinks && typeof props.deepLinks.player === 'string') {
|
||||
window.location = props.deepLinks.player;
|
||||
// TODO: remove # from deeplinks in core for web?
|
||||
navigate(props.deepLinks.player.replace('#', ''));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -58,9 +60,9 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
|||
case 'details': {
|
||||
if (props.deepLinks) {
|
||||
if (typeof props.deepLinks.metaDetailsVideos === 'string') {
|
||||
window.location = props.deepLinks.metaDetailsVideos;
|
||||
navigate(props.deepLinks.metaDetailsVideos.replace('#', ''));
|
||||
} else if (typeof props.deepLinks.metaDetailsStreams === 'string') {
|
||||
window.location = props.deepLinks.metaDetailsStreams;
|
||||
navigate(props.deepLinks.metaDetailsStreams.replace('#', ''));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue