You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.2 KiB
61 lines
1.2 KiB
import React, { Fragment } from 'react'
|
|
|
|
import isEmpty from 'lodash/isEmpty'
|
|
|
|
import { getSportColor } from 'helpers/getSportColor'
|
|
|
|
import { SportName } from 'features/Common/SportName'
|
|
import { useScoreStore } from 'features/ToggleScore'
|
|
|
|
import { useSportNameParam } from 'hooks/useSportNameParam'
|
|
import { useMatchPage } from '../hooks'
|
|
|
|
import {
|
|
Wrapper,
|
|
Teams,
|
|
Score,
|
|
Tournament,
|
|
Dash,
|
|
} from './styled'
|
|
|
|
export const MatchProfileCard = () => {
|
|
const {
|
|
matchProfile,
|
|
matchProfileNames: {
|
|
team1Name,
|
|
team2Name,
|
|
tournament,
|
|
},
|
|
} = useMatchPage()
|
|
|
|
const { sportName, sportType } = useSportNameParam()
|
|
const { isHidden } = useScoreStore()
|
|
|
|
const { team1, team2 } = matchProfile || {}
|
|
|
|
const color = getSportColor(sportType)
|
|
|
|
return (
|
|
<Wrapper>
|
|
{!isEmpty(matchProfile)
|
|
&& (
|
|
<Fragment>
|
|
<Teams>
|
|
{team1Name} <Dash /> {team2Name}
|
|
</Teams>
|
|
{!isHidden && (
|
|
<Score>
|
|
{team1?.score} : {team2?.score}
|
|
</Score>
|
|
)}
|
|
<Tournament>
|
|
<SportName
|
|
color={color}
|
|
t={sportName}
|
|
/>{tournament}
|
|
</Tournament>
|
|
</Fragment>
|
|
)}
|
|
</Wrapper>
|
|
)
|
|
}
|
|
|