From 71a1493ac2b94bcce8fda84db60a85ff9a9735c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=20=D0=9F=D0=B8=D0=BC=D0=B8=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2?= <61900450+ivan-piminov@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:56:41 +0300 Subject: [PATCH] feat(cardfrontside): hiding score in future matches (#283) * feat(cardfrontside): hiding score in future matches * refactor(cardfrontside): refactoring code * refactor(cardfrontside): renamed variable --- src/features/MatchCard/CardFrontside/index.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/features/MatchCard/CardFrontside/index.tsx b/src/features/MatchCard/CardFrontside/index.tsx index a9dbd0e8..9669bd19 100644 --- a/src/features/MatchCard/CardFrontside/index.tsx +++ b/src/features/MatchCard/CardFrontside/index.tsx @@ -26,6 +26,7 @@ import { TeamLogo, BuyMatchButton, } from '../styled' +import { MatchStatuses, useHeaderFiltersStore } from '../../HeaderFilters' type Props = { match: Match, @@ -55,7 +56,10 @@ export const CardFrontside = ({ }: Props) => { const tournamentName = useName(tournament) const { isScoreHidden } = useMatchSwitchesStore() + const { selectedMatchStatus } = useHeaderFiltersStore() const unixTimeOfMatch = getUnixTime(date) + const isInFuture = unixTimeOfMatch > getUnixTime(new Date()) + const isFutureMatch = isInFuture || selectedMatchStatus === MatchStatuses.Soon return ( } {formattedDate} - {unixTimeOfMatch > getUnixTime(new Date()) && (!hasVideo || !storage) - ? ( - - ) + {(isInFuture && (!hasVideo || !storage)) + ? : null} @@ -114,11 +114,11 @@ export const CardFrontside = ({ - {!isScoreHidden && {team1.score}} + {isFutureMatch ? null : !isScoreHidden && {team1.score}} - {!isScoreHidden && {team2.score}} + {isFutureMatch ? null : !isScoreHidden && {team2.score}}