Ott 813 calc hide score (#296)

* refactor(799): display mdash

* refactor(799): updated score showing condition
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent 75f6911da1
commit 082fa10967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/features/BuyMatchPopup/components/MatchSubscriptions/index.tsx
  2. 15
      src/features/MatchCard/CardFrontside/index.tsx
  3. 4
      src/features/MatchPopup/components/FinishedPlaylistPage/index.tsx
  4. 2
      src/features/MatchPopup/components/LivePlaylistPage/index.tsx
  5. 3
      src/features/MatchPopup/types.tsx
  6. 2
      src/features/Matches/helpers/prepareMatches.tsx
  7. 1
      src/requests/getMatches/types.tsx

@ -45,7 +45,7 @@ export const MatchSubscriptionsStep = () => {
<Header height={50}>
<HeaderTitle>
<Name nameObj={match.team1} />
{' '} {MDASH} {' '}
{` ${MDASH} `}
<Name nameObj={match.team2} />
</HeaderTitle>
<HeaderActions position='right'>

@ -45,6 +45,7 @@ export const CardFrontside = ({
const {
accessibleBySubscription,
accessibleInUsersCountry,
calc,
date,
formattedDate,
hasVideo,
@ -60,9 +61,13 @@ export const CardFrontside = ({
const { open } = useBuyMatchPopupStore()
const { isScoreHidden } = useMatchSwitchesStore()
const { selectedMatchStatus } = useHeaderFiltersStore()
const unixTimeOfMatch = getUnixTime(date)
const isInFuture = unixTimeOfMatch > getUnixTime(new Date())
const isFutureMatch = isInFuture || selectedMatchStatus === MatchStatuses.Soon
const isInFuture = getUnixTime(date) > getUnixTime(new Date())
const showScore = !(
!calc
|| isInFuture
|| selectedMatchStatus === MatchStatuses.Soon
|| isScoreHidden
)
return (
<CardWrapper
@ -121,11 +126,11 @@ export const CardFrontside = ({
<Teams>
<Team>
<TeamName nameObj={team1} />
{isFutureMatch ? null : !isScoreHidden && <Score>{team1.score}</Score>}
{showScore && <Score>{team1.score}</Score>}
</Team>
<Team>
<TeamName nameObj={team2} />
{isFutureMatch ? null : !isScoreHidden && <Score>{team2.score}</Score>}
{showScore && <Score>{team2.score}</Score>}
</Team>
</Teams>
</Info>

@ -2,6 +2,8 @@ import { Fragment } from 'react'
import isEmpty from 'lodash/isEmpty'
import { MDASH } from 'config'
import { useMatchSwitchesStore } from 'features/MatchSwitches'
import { Name } from 'features/Name'
import { MediaQuery } from 'features/MediaQuery'
@ -47,7 +49,7 @@ export const FinishedPlaylistPage = () => {
<HeaderTitle>
<Name nameObj={team1} />
{isScoreHidden ? ' - ' : score}
{isScoreHidden || !match.calc ? ` ${MDASH} ` : score}
<Name nameObj={team2} />
</HeaderTitle>

@ -28,7 +28,7 @@ export const LivePlaylistPage = () => {
<Header>
<HeaderTitle>
<Name nameObj={team1} />
{' '} {MDASH} {' '}
{` ${MDASH} `}
<Name nameObj={team2} />
</HeaderTitle>

@ -3,7 +3,8 @@ import { SportTypes } from 'config'
import type { Match } from 'features/Matches/hooks'
export type MatchData = Pick<Match, (
'id'
'calc'
| 'id'
| 'team1'
| 'team2'
| 'sportType'

@ -7,6 +7,7 @@ import { getSportLexic } from 'helpers'
const prepareMatch = ({
access,
calc,
date: matchDate,
has_video,
id,
@ -23,6 +24,7 @@ const prepareMatch = ({
return {
accessibleBySubscription: sub,
accessibleInUsersCountry: access,
calc,
date,
formattedDate: format(date, 'dd.MM.yy'),
hasVideo: has_video,

@ -15,6 +15,7 @@ export type Team = {
export type Match = {
access: boolean,
calc: boolean,
date: string,
/** наличие mp4 видео */
has_video: boolean,

Loading…
Cancel
Save