refactor(563): removed match stream_status property usage (#246)
parent
38b1d62092
commit
76ebedfabb
@ -1,40 +0,0 @@ |
||||
import type { Match } from 'features/Matches' |
||||
|
||||
import { useCard } from '../hooks' |
||||
import { MatchInfoCard } from '../MatchInfoCard' |
||||
import { CardFinishedHover } from '../CardFinishedHover' |
||||
|
||||
type CardFinishedProps = { |
||||
match: Match, |
||||
showSportName?: boolean, |
||||
} |
||||
|
||||
export const CardFinished = ({ |
||||
match, |
||||
showSportName, |
||||
}: CardFinishedProps) => { |
||||
const { |
||||
close, |
||||
flipCard, |
||||
isOpen, |
||||
onKeyPress, |
||||
} = useCard(match) |
||||
|
||||
if (isOpen) { |
||||
return ( |
||||
<CardFinishedHover |
||||
match={match} |
||||
onClose={close} |
||||
/> |
||||
) |
||||
} |
||||
|
||||
return ( |
||||
<MatchInfoCard |
||||
match={match} |
||||
showSportName={showSportName} |
||||
onClick={flipCard} |
||||
onKeyPress={onKeyPress} |
||||
/> |
||||
) |
||||
} |
||||
@ -1,40 +0,0 @@ |
||||
import type { Match } from 'features/Matches' |
||||
|
||||
import { useCard } from '../hooks' |
||||
import { MatchInfoCard } from '../MatchInfoCard' |
||||
import { CardLiveHover } from '../CardLiveHover' |
||||
|
||||
type CardLiveProps = { |
||||
match: Match, |
||||
showSportName?: boolean, |
||||
} |
||||
|
||||
export const CardLive = ({ |
||||
match, |
||||
showSportName, |
||||
}: CardLiveProps) => { |
||||
const { |
||||
close, |
||||
flipCard, |
||||
isOpen, |
||||
onKeyPress, |
||||
} = useCard(match) |
||||
|
||||
if (isOpen) { |
||||
return ( |
||||
<CardLiveHover |
||||
match={match} |
||||
onClose={close} |
||||
/> |
||||
) |
||||
} |
||||
|
||||
return ( |
||||
<MatchInfoCard |
||||
match={match} |
||||
showSportName={showSportName} |
||||
onClick={flipCard} |
||||
onKeyPress={onKeyPress} |
||||
/> |
||||
) |
||||
} |
||||
@ -1,57 +0,0 @@ |
||||
import type { MouseEvent } from 'react' |
||||
|
||||
import { Link } from 'react-router-dom' |
||||
|
||||
import type { Match } from 'features/Matches' |
||||
import { RESUME_KEY } from 'features/MatchPage/hooks/useLastPlayPosition' |
||||
import { OutsideClick } from 'features/OutsideClick' |
||||
|
||||
import { |
||||
CardHoverInner, |
||||
CardHoverTitle, |
||||
CardHoverWrapper, |
||||
MoreVideo, |
||||
Row, |
||||
Rows, |
||||
} from '../styled' |
||||
|
||||
type CardLiveHoverProps = { |
||||
match: Match, |
||||
onClose: () => void, |
||||
} |
||||
|
||||
const stopProp = (e: MouseEvent<HTMLDivElement>) => { |
||||
e.stopPropagation() |
||||
} |
||||
|
||||
export const CardLiveHover = ({ |
||||
match: { |
||||
id, |
||||
sportName, |
||||
}, |
||||
onClose, |
||||
}: CardLiveHoverProps) => ( |
||||
<OutsideClick onClick={onClose}> |
||||
<CardHoverWrapper onClick={onClose}> |
||||
<CardHoverInner> |
||||
<CardHoverTitle t='match_video' /> |
||||
<Rows onClick={stopProp}> |
||||
<Row> |
||||
<Link to={`/${sportName}/matches/${id}`}> |
||||
<MoreVideo t='watch_now' /> |
||||
</Link> |
||||
<Link to={`/${sportName}/matches/${id}`}> |
||||
<MoreVideo t='watch_from_beginning' /> |
||||
</Link> |
||||
</Row> |
||||
|
||||
<Row> |
||||
<Link to={`/${sportName}/matches/${id}?${RESUME_KEY}=true`}> |
||||
<MoreVideo t='watch_from_last_pause' /> |
||||
</Link> |
||||
</Row> |
||||
</Rows> |
||||
</CardHoverInner> |
||||
</CardHoverWrapper> |
||||
</OutsideClick> |
||||
) |
||||
@ -1,101 +0,0 @@ |
||||
import styled from 'styled-components/macro' |
||||
|
||||
import { ProfileTypes } from 'config' |
||||
|
||||
import type { Match } from 'features/Matches' |
||||
import { SportName } from 'features/Common' |
||||
import { useName } from 'features/Name' |
||||
|
||||
import { NoAccessMessage } from '../NoAccessMessage' |
||||
import { |
||||
MatchDate, |
||||
CardWrapper as CommonCardWrapper, |
||||
Time, |
||||
Info, |
||||
PreviewWrapper, |
||||
Team, |
||||
TeamName as CommonTeamName, |
||||
Teams, |
||||
TournamentName, |
||||
TeamLogos, |
||||
TeamLogo, |
||||
BuyMatchButton, |
||||
} from '../styled' |
||||
|
||||
const CardWrapper = styled(CommonCardWrapper)` |
||||
cursor: pointer; |
||||
` |
||||
|
||||
const TeamName = styled(CommonTeamName)` |
||||
max-width: none; |
||||
` |
||||
|
||||
type CardSoonProps = { |
||||
match: Match, |
||||
showSportName?: boolean, |
||||
} |
||||
|
||||
export const CardSoon = ({ |
||||
match: { |
||||
accessibleBySubscription, |
||||
accessibleInUsersCountry, |
||||
date, |
||||
sportType, |
||||
team1, |
||||
team2, |
||||
time, |
||||
tournament, |
||||
}, |
||||
showSportName, |
||||
}: CardSoonProps) => { |
||||
const tournamentName = useName(tournament) |
||||
return ( |
||||
<CardWrapper> |
||||
<PreviewWrapper> |
||||
<TeamLogos> |
||||
<TeamLogo |
||||
id={team1.id} |
||||
nameAsTitle |
||||
altNameObj={team1} |
||||
sportType={sportType} |
||||
profileType={ProfileTypes.TEAMS} |
||||
/> |
||||
<TeamLogo |
||||
id={team2.id} |
||||
nameAsTitle |
||||
altNameObj={team2} |
||||
sportType={sportType} |
||||
profileType={ProfileTypes.TEAMS} |
||||
/> |
||||
</TeamLogos> |
||||
{!accessibleBySubscription && <BuyMatchButton />} |
||||
{(accessibleBySubscription && !accessibleInUsersCountry) |
||||
? <NoAccessMessage /> |
||||
: ( |
||||
<MatchDate> |
||||
{date} |
||||
<Time> |
||||
{time} |
||||
</Time> |
||||
</MatchDate> |
||||
)} |
||||
</PreviewWrapper> |
||||
<Info> |
||||
{showSportName && <SportName sport={sportType} />} |
||||
{tournamentName && ( |
||||
<TournamentName title={tournamentName}> |
||||
{tournamentName} |
||||
</TournamentName> |
||||
)} |
||||
<Teams> |
||||
<Team> |
||||
<TeamName nameObj={team1} /> |
||||
</Team> |
||||
<Team> |
||||
<TeamName nameObj={team2} /> |
||||
</Team> |
||||
</Teams> |
||||
</Info> |
||||
</CardWrapper> |
||||
) |
||||
} |
||||
Loading…
Reference in new issue