|
|
|
|
@ -1,8 +1,4 @@ |
|
|
|
|
import { |
|
|
|
|
useEffect, |
|
|
|
|
useMemo, |
|
|
|
|
useState, |
|
|
|
|
} from 'react' |
|
|
|
|
import { useEffect, useMemo } from 'react' |
|
|
|
|
import { useHistory } from 'react-router' |
|
|
|
|
|
|
|
|
|
import { useTour } from '@reactour/tour' |
|
|
|
|
@ -28,7 +24,11 @@ import { |
|
|
|
|
isMobileDevice, |
|
|
|
|
} from 'config' |
|
|
|
|
|
|
|
|
|
import { usePageLogger, usePageParams } from 'hooks' |
|
|
|
|
import { |
|
|
|
|
useScreenOrientation, |
|
|
|
|
usePageLogger, |
|
|
|
|
usePageParams, |
|
|
|
|
} from 'hooks' |
|
|
|
|
|
|
|
|
|
import { checkUrlParams } from 'helpers/parseUrlParams/parseUrlParams' |
|
|
|
|
|
|
|
|
|
@ -46,6 +46,7 @@ import { Wrapper } from './styled' |
|
|
|
|
const MatchPageComponent = () => { |
|
|
|
|
usePageLogger() |
|
|
|
|
const history = useHistory() |
|
|
|
|
const orientation = useScreenOrientation() |
|
|
|
|
const { addRemoveFavorite, userFavorites } = useUserFavoritesStore() |
|
|
|
|
const { colors } = useTheme() |
|
|
|
|
|
|
|
|
|
@ -111,20 +112,14 @@ const MatchPageComponent = () => { |
|
|
|
|
history.push(`/${sportName}/tournaments/${profile.tournament.id}`) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const [orientation, setOrientation] = useState(window.orientation) |
|
|
|
|
const currentOrientation = orientation === 0 |
|
|
|
|
? VERTICAL_FULL_SCREEN |
|
|
|
|
: HORIZONTAL_FULL_SCREEN |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
const handleOrientationChange = () => setOrientation(window.orientation) |
|
|
|
|
window.addEventListener('orientationchange', handleOrientationChange) |
|
|
|
|
return () => window.removeEventListener('orientationchange', handleOrientationChange) |
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
const currentAds = useMemo(() => ( |
|
|
|
|
window.orientation === 0 |
|
|
|
|
? find(ads.mobile, (ad) => ad.position.id === VERTICAL_FULL_SCREEN) |
|
|
|
|
: find(ads.mobile, (ad) => ad.position.id === HORIZONTAL_FULL_SCREEN) |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
), [ads.mobile, orientation]) |
|
|
|
|
const currentAds = useMemo( |
|
|
|
|
() => (find(ads, (ad) => ad.position.id === currentOrientation)), |
|
|
|
|
[ads, currentOrientation], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<PageWrapper |
|
|
|
|
|