feat(cardfrontside): hiding score in future matches (#283)

* feat(cardfrontside): hiding score in future matches

* refactor(cardfrontside): refactoring code

* refactor(cardfrontside): renamed variable
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Иван Пиминов 5 years ago committed by GitHub
parent fa86dc6602
commit 71a1493ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/features/MatchCard/CardFrontside/index.tsx

@ -26,6 +26,7 @@ import {
TeamLogo, TeamLogo,
BuyMatchButton, BuyMatchButton,
} from '../styled' } from '../styled'
import { MatchStatuses, useHeaderFiltersStore } from '../../HeaderFilters'
type Props = { type Props = {
match: Match, match: Match,
@ -55,7 +56,10 @@ export const CardFrontside = ({
}: Props) => { }: Props) => {
const tournamentName = useName(tournament) const tournamentName = useName(tournament)
const { isScoreHidden } = useMatchSwitchesStore() const { isScoreHidden } = useMatchSwitchesStore()
const { selectedMatchStatus } = useHeaderFiltersStore()
const unixTimeOfMatch = getUnixTime(date) const unixTimeOfMatch = getUnixTime(date)
const isInFuture = unixTimeOfMatch > getUnixTime(new Date())
const isFutureMatch = isInFuture || selectedMatchStatus === MatchStatuses.Soon
return ( return (
<CardWrapper <CardWrapper
@ -95,12 +99,8 @@ export const CardFrontside = ({
{(accessibleBySubscription && !accessibleInUsersCountry) && <NoAccessMessage />} {(accessibleBySubscription && !accessibleInUsersCountry) && <NoAccessMessage />}
<MatchDate> <MatchDate>
{formattedDate} {formattedDate}
{unixTimeOfMatch > getUnixTime(new Date()) && (!hasVideo || !storage) {(isInFuture && (!hasVideo || !storage))
? ( ? <Time>{time}</Time>
<Time>
{time}
</Time>
)
: null} : null}
</MatchDate> </MatchDate>
</PreviewWrapper> </PreviewWrapper>
@ -114,11 +114,11 @@ export const CardFrontside = ({
<Teams> <Teams>
<Team> <Team>
<TeamName nameObj={team1} /> <TeamName nameObj={team1} />
{!isScoreHidden && <Score>{team1.score}</Score>} {isFutureMatch ? null : !isScoreHidden && <Score>{team1.score}</Score>}
</Team> </Team>
<Team> <Team>
<TeamName nameObj={team2} /> <TeamName nameObj={team2} />
{!isScoreHidden && <Score>{team2.score}</Score>} {isFutureMatch ? null : !isScoreHidden && <Score>{team2.score}</Score>}
</Team> </Team>
</Teams> </Teams>
</Info> </Info>

Loading…
Cancel
Save