From 082fa109679996f4aafddf31bfbf7339d8039968 Mon Sep 17 00:00:00 2001 From: Mirlan Date: Tue, 9 Feb 2021 16:44:34 +0600 Subject: [PATCH] Ott 813 calc hide score (#296) * refactor(799): display mdash * refactor(799): updated score showing condition --- .../components/MatchSubscriptions/index.tsx | 2 +- src/features/MatchCard/CardFrontside/index.tsx | 15 ++++++++++----- .../components/FinishedPlaylistPage/index.tsx | 4 +++- .../components/LivePlaylistPage/index.tsx | 2 +- src/features/MatchPopup/types.tsx | 3 ++- src/features/Matches/helpers/prepareMatches.tsx | 2 ++ src/requests/getMatches/types.tsx | 1 + 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/features/BuyMatchPopup/components/MatchSubscriptions/index.tsx b/src/features/BuyMatchPopup/components/MatchSubscriptions/index.tsx index 24ce4084..b8481bd6 100644 --- a/src/features/BuyMatchPopup/components/MatchSubscriptions/index.tsx +++ b/src/features/BuyMatchPopup/components/MatchSubscriptions/index.tsx @@ -45,7 +45,7 @@ export const MatchSubscriptionsStep = () => {
- {' '} {MDASH} {' '} + {` ${MDASH} `} diff --git a/src/features/MatchCard/CardFrontside/index.tsx b/src/features/MatchCard/CardFrontside/index.tsx index 0d5d6f8a..c912d2e5 100644 --- a/src/features/MatchCard/CardFrontside/index.tsx +++ b/src/features/MatchCard/CardFrontside/index.tsx @@ -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 ( - {isFutureMatch ? null : !isScoreHidden && {team1.score}} + {showScore && {team1.score}} - {isFutureMatch ? null : !isScoreHidden && {team2.score}} + {showScore && {team2.score}} diff --git a/src/features/MatchPopup/components/FinishedPlaylistPage/index.tsx b/src/features/MatchPopup/components/FinishedPlaylistPage/index.tsx index 1871325b..27bccbdd 100644 --- a/src/features/MatchPopup/components/FinishedPlaylistPage/index.tsx +++ b/src/features/MatchPopup/components/FinishedPlaylistPage/index.tsx @@ -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 = () => { - {isScoreHidden ? ' - ' : score} + {isScoreHidden || !match.calc ? ` ${MDASH} ` : score} diff --git a/src/features/MatchPopup/components/LivePlaylistPage/index.tsx b/src/features/MatchPopup/components/LivePlaylistPage/index.tsx index cdac1619..6afd7b46 100644 --- a/src/features/MatchPopup/components/LivePlaylistPage/index.tsx +++ b/src/features/MatchPopup/components/LivePlaylistPage/index.tsx @@ -28,7 +28,7 @@ export const LivePlaylistPage = () => {
- {' '} {MDASH} {' '} + {` ${MDASH} `} diff --git a/src/features/MatchPopup/types.tsx b/src/features/MatchPopup/types.tsx index 37103301..d30a29cd 100644 --- a/src/features/MatchPopup/types.tsx +++ b/src/features/MatchPopup/types.tsx @@ -3,7 +3,8 @@ import { SportTypes } from 'config' import type { Match } from 'features/Matches/hooks' export type MatchData = Pick