|
|
|
|
@ -1,8 +1,9 @@ |
|
|
|
|
import type { KeyboardEvent } from 'react' |
|
|
|
|
import { useRouteMatch } from 'react-router' |
|
|
|
|
|
|
|
|
|
import getUnixTime from 'date-fns/getUnixTime' |
|
|
|
|
|
|
|
|
|
import { ProfileTypes } from 'config' |
|
|
|
|
import { ProfileTypes, PAGES } from 'config' |
|
|
|
|
|
|
|
|
|
import type { Match } from 'features/Matches' |
|
|
|
|
import { SportName } from 'features/Common' |
|
|
|
|
@ -36,14 +37,12 @@ type Props = { |
|
|
|
|
match: Match, |
|
|
|
|
onClick: () => void, |
|
|
|
|
onKeyPress: (e: KeyboardEvent<HTMLLIElement>) => void, |
|
|
|
|
showSportName?: boolean, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const CardFrontside = ({ |
|
|
|
|
match, |
|
|
|
|
onClick, |
|
|
|
|
onKeyPress, |
|
|
|
|
showSportName, |
|
|
|
|
}: Props) => { |
|
|
|
|
const { |
|
|
|
|
access, |
|
|
|
|
@ -60,6 +59,7 @@ export const CardFrontside = ({ |
|
|
|
|
time, |
|
|
|
|
tournament, |
|
|
|
|
} = match |
|
|
|
|
const isHomePage = useRouteMatch(PAGES.home)?.isExact |
|
|
|
|
const tournamentName = useName(tournament) |
|
|
|
|
const { isScoreHidden } = useMatchSwitchesStore() |
|
|
|
|
const { selectedMatchStatus } = useHeaderFiltersStore() |
|
|
|
|
@ -108,8 +108,9 @@ export const CardFrontside = ({ |
|
|
|
|
{access === MatchAccess.NoCountryAccess && <NoAccessMessage />} |
|
|
|
|
{access === MatchAccess.CanBuyMatch && <BuyMatchBadge />} |
|
|
|
|
<MatchTimeInfo> |
|
|
|
|
<MatchDate> |
|
|
|
|
{formattedDate} |
|
|
|
|
<MatchDate isHomePage={isHomePage}> |
|
|
|
|
{!isHomePage ? formattedDate : ''} |
|
|
|
|
|
|
|
|
|
{(isInFuture && (!hasVideo || !storage)) |
|
|
|
|
? <Time>{time}</Time> |
|
|
|
|
: null} |
|
|
|
|
@ -122,7 +123,7 @@ export const CardFrontside = ({ |
|
|
|
|
</MatchTimeInfo> |
|
|
|
|
</PreviewWrapper> |
|
|
|
|
<Info> |
|
|
|
|
{showSportName && <SportName sport={sportType} />} |
|
|
|
|
{isHomePage && <SportName sport={sportType} />} |
|
|
|
|
{tournament && ( |
|
|
|
|
<TournamentName title={tournamentName}> |
|
|
|
|
{tournamentName} |
|
|
|
|
|