|
|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
import { useHistory } from 'react-router' |
|
|
|
|
|
|
|
|
|
import { usePageLogger } from 'hooks/usePageLogger' |
|
|
|
|
|
|
|
|
|
import { ProfileHeader } from 'features/ProfileHeader' |
|
|
|
|
@ -16,11 +18,23 @@ import { Wrapper } from './styled' |
|
|
|
|
|
|
|
|
|
const MatchPage = () => { |
|
|
|
|
usePageLogger() |
|
|
|
|
const { events, profile } = useMatchProfile() |
|
|
|
|
const history = useHistory() |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
events, |
|
|
|
|
isStarted, |
|
|
|
|
profile, |
|
|
|
|
} = useMatchProfile() |
|
|
|
|
|
|
|
|
|
const playFromScout = profile?.has_video && !profile?.live |
|
|
|
|
const playFromOTT = !profile?.has_video && (profile?.live || profile?.storage) |
|
|
|
|
|
|
|
|
|
// TODO Добавить попап 'Данный матч ещё не начался'
|
|
|
|
|
if (!isStarted && profile) { |
|
|
|
|
const sportName = history.location.pathname.split('/')[1] |
|
|
|
|
history.push(`/${sportName}/tournaments/${profile.tournament.id}`) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<PageWrapper> |
|
|
|
|
<ProfileHeader color='rgb(0,0,0)' height={4.5}> |
|
|
|
|
@ -30,8 +44,18 @@ const MatchPage = () => { |
|
|
|
|
<UserFavorites /> |
|
|
|
|
<SubscriptionGuard matchProfile={profile}> |
|
|
|
|
<Wrapper> |
|
|
|
|
{playFromOTT && <LiveMatch events={events} profile={profile} />} |
|
|
|
|
{playFromScout && <FinishedMatch events={events} profile={profile} />} |
|
|
|
|
{playFromOTT && ( |
|
|
|
|
<LiveMatch |
|
|
|
|
events={events} |
|
|
|
|
profile={profile} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
{playFromScout && ( |
|
|
|
|
<FinishedMatch |
|
|
|
|
events={events} |
|
|
|
|
profile={profile} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
</Wrapper> |
|
|
|
|
</SubscriptionGuard> |
|
|
|
|
</Main> |
|
|
|
|
|