|
|
|
|
@ -18,6 +18,7 @@ import { isIOS } from 'config/userAgent' |
|
|
|
|
import { usePageLogger } from 'hooks/usePageLogger' |
|
|
|
|
import { usePageParams } from 'hooks/usePageParams' |
|
|
|
|
|
|
|
|
|
import { checkUrlParams } from 'helpers/parseUrlParams/parseUrlParams' |
|
|
|
|
import { MatchPageStore, useMatchPageStore } from './store' |
|
|
|
|
import { SubscriptionGuard } from './components/SubscriptionGuard' |
|
|
|
|
import { LiveMatch } from './components/LiveMatch' |
|
|
|
|
@ -31,6 +32,7 @@ const MatchPageComponent = () => { |
|
|
|
|
const { addRemoveFavorite, userFavorites } = useUserFavoritesStore() |
|
|
|
|
|
|
|
|
|
const { isStarted, profile } = useMatchPageStore() |
|
|
|
|
const isFavorite = profile && userFavorites.find((fav) => fav.id === profile?.tournament.id) |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
profileType, |
|
|
|
|
@ -40,7 +42,6 @@ const MatchPageComponent = () => { |
|
|
|
|
useEffect(() => { |
|
|
|
|
let timer = 0 |
|
|
|
|
timer = window.setTimeout(() => { |
|
|
|
|
const isFavorite = profile && userFavorites.find((fav) => fav.id === profile?.tournament.id) |
|
|
|
|
if (profile && !isFavorite) { |
|
|
|
|
addRemoveFavorite({ |
|
|
|
|
action: FavoritesActions.ADD, |
|
|
|
|
@ -57,6 +58,21 @@ const MatchPageComponent = () => { |
|
|
|
|
} |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [profile, profileType]) |
|
|
|
|
useEffect(() => { |
|
|
|
|
if ( |
|
|
|
|
profile |
|
|
|
|
&& !isFavorite |
|
|
|
|
&& checkUrlParams('from') === 'landing') { |
|
|
|
|
addRemoveFavorite({ |
|
|
|
|
action: FavoritesActions.ADD, |
|
|
|
|
id: profile?.tournament.id, |
|
|
|
|
isAuto: true, |
|
|
|
|
sport: sportType, |
|
|
|
|
type: ProfileTypes.TOURNAMENTS, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [profile]) |
|
|
|
|
|
|
|
|
|
const playFromScout = profile?.has_video && !profile?.live && !profile.has_hls |
|
|
|
|
const playFromOTT = (!profile?.has_video && (profile?.live || profile?.storage)) |
|
|
|
|
|