@ -1,9 +1,12 @@
import React , { Fragment } from 'react'
import React , { Fragment } from 'react'
import isEmpty from 'lodash/isEmpty '
import isNull from 'lodash/isNull '
import { getProfileUrl } from 'helpers'
import { getSportColor } from 'helpers/getSportColor'
import { getSportColor } from 'helpers/getSportColor'
import { ProfileTypes } from 'config'
import { SportName } from 'features/Common/SportName'
import { SportName } from 'features/Common/SportName'
import { useScoreStore } from 'features/ToggleScore'
import { useScoreStore } from 'features/ToggleScore'
@ -16,32 +19,52 @@ import {
Score ,
Score ,
Tournament ,
Tournament ,
Dash ,
Dash ,
StyledLink ,
} from './styled'
} from './styled'
export const MatchProfileCard = ( ) = > {
export const MatchProfileCard = ( ) = > {
const {
const {
matchProfile ,
matchProfile ,
matchProfileNames : {
team1Name ,
team2Name ,
tournament ,
} ,
} = useMatchProfileCard ( )
} = useMatchProfileCard ( )
const { sportName , sportType } = useSportNameParam ( )
const { sportName , sportType } = useSportNameParam ( )
const { isHidden } = useScoreStore ( )
const { isHidden } = useScoreStore ( )
const { team1 , team2 } = matchProfile || { }
const color = getSportColor ( sportType )
const color = getSportColor ( sportType )
const {
team1 ,
team2 ,
tournament ,
} = matchProfile || { }
return (
return (
< Wrapper >
< Wrapper >
{ ! isEmpty ( matchProfile )
{ ! isNull ( matchProfile )
&& (
&& (
< Fragment >
< Fragment >
< Teams >
< Teams >
{ team1Name } < Dash / > { team2Name }
{ team1 && (
< StyledLink
to = { getProfileUrl ( {
id : team1.id ,
profileType : ProfileTypes.TEAMS ,
sportType ,
} ) }
>
{ team1 . name }
< / StyledLink >
) }
< Dash / >
{ team2 && (
< StyledLink to = { getProfileUrl ( {
id : team2.id ,
profileType : ProfileTypes.TEAMS ,
sportType ,
} ) }
>
{ team2 . name }
< / StyledLink >
) }
< / Teams >
< / Teams >
{ ! isHidden && (
{ ! isHidden && (
< Score >
< Score >
@ -52,7 +75,17 @@ export const MatchProfileCard = () => {
< SportName
< SportName
color = { color }
color = { color }
t = { sportName }
t = { sportName }
/ > { t o u r n a m e n t }
/ >
{ tournament && (
< StyledLink to = { getProfileUrl ( {
id : tournament.id ,
profileType : ProfileTypes.TEAMS ,
sportType ,
} ) }
>
{ tournament ? . name }
< / StyledLink >
) }
< / Tournament >
< / Tournament >
< / Fragment >
< / Fragment >
) }
) }