Ott 723 match date fix (#276)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Andrey Razdorskiy 5 years ago committed by GitHub
parent f24facb684
commit d9467279db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/features/MatchCard/CardFrontside/index.tsx
  2. 2
      src/features/Matches/helpers/prepareMatches.tsx

@ -7,6 +7,7 @@ import { SportName } from 'features/Common'
import { useMatchSwitchesStore } from 'features/MatchSwitches' import { useMatchSwitchesStore } from 'features/MatchSwitches'
import { useName } from 'features/Name' import { useName } from 'features/Name'
import { getUnixTime } from 'date-fns'
import { NoAccessMessage } from '../NoAccessMessage' import { NoAccessMessage } from '../NoAccessMessage'
import { import {
CardWrapper, CardWrapper,
@ -37,12 +38,15 @@ export const CardFrontside = ({
accessibleBySubscription, accessibleBySubscription,
accessibleInUsersCountry, accessibleInUsersCountry,
date, date,
hasVideo,
preview, preview,
sportType, sportType,
storage,
team1, team1,
team2, team2,
time, time,
tournament, tournament,
unformattedDate,
}, },
onClick, onClick,
onKeyPress, onKeyPress,
@ -50,6 +54,7 @@ export const CardFrontside = ({
}: Props) => { }: Props) => {
const tournamentName = useName(tournament) const tournamentName = useName(tournament)
const { isScoreHidden } = useMatchSwitchesStore() const { isScoreHidden } = useMatchSwitchesStore()
const unixTimeOfMatch = getUnixTime(new Date(unformattedDate))
return ( return (
<CardWrapper <CardWrapper
@ -91,9 +96,13 @@ export const CardFrontside = ({
: ( : (
<MatchDate> <MatchDate>
{date} {date}
<Time> {unixTimeOfMatch > getUnixTime(new Date()) && (!hasVideo || !storage)
{time} ? (
</Time> <Time>
{time}
</Time>
)
: null}
</MatchDate> </MatchDate>
)} )}
</PreviewWrapper> </PreviewWrapper>

@ -32,10 +32,12 @@ const prepareMatch = ({
preview, preview,
sportName: getSportLexic(sport), sportName: getSportLexic(sport),
sportType: sport, sportType: sport,
storage,
team1, team1,
team2, team2,
time: format(new Date(date), 'HH:mm'), time: format(new Date(date), 'HH:mm'),
tournament, tournament,
unformattedDate: date,
}) })
export const prepareMatches = (matches: Array<Match>) => map( export const prepareMatches = (matches: Array<Match>) => map(

Loading…
Cancel
Save