From 2f5365dceb09d62909729c3092dadd19534ddf20 Mon Sep 17 00:00:00 2001 From: Armen <35077035+Armen9393@users.noreply.github.com> Date: Fri, 28 Aug 2020 11:18:56 +0300 Subject: [PATCH] feat(ott-345): deleted timer (#108) --- src/features/MatchCard/CardLive/index.tsx | 28 +++-------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/src/features/MatchCard/CardLive/index.tsx b/src/features/MatchCard/CardLive/index.tsx index 9bcefc0d..9c086aaa 100644 --- a/src/features/MatchCard/CardLive/index.tsx +++ b/src/features/MatchCard/CardLive/index.tsx @@ -1,14 +1,9 @@ -import React, { - useState, - useEffect, - useCallback, -} from 'react' +import React from 'react' import styled from 'styled-components/macro' -import differenceInMilliseconds from 'date-fns/differenceInMilliseconds' import type { Match } from 'features/Matches' -import { getSportColor, msToMinutesAndSeconds } from 'helpers' +import { getSportColor } from 'helpers' import { SportName } from 'features/Common' import { T9n } from 'features/T9n' @@ -27,8 +22,6 @@ import { } from '../styled' import { CardLiveHover } from '../CardLiveHover' -const UPDATE_INTERVAL = 1000 - const MatchStatus = styled(CommonMatchStatus)` color: #fff; background-color: #cc0000; @@ -60,21 +53,6 @@ export const CardLive = ({ showScore, } = useCard() - const getMs = useCallback(() => differenceInMilliseconds( - new Date(), - new Date(date), - ), [date]) - - const [matchDuration, setMatchDuration] = useState(msToMinutesAndSeconds(getMs())) - - useEffect(() => { - const timer = setInterval(() => { - setMatchDuration(msToMinutesAndSeconds(getMs())) - }, UPDATE_INTERVAL) - - return () => clearInterval(timer) - }, [getMs]) - if (isOpen) return return ( @@ -82,7 +60,7 @@ export const CardLive = ({ onClick={open} onKeyPress={onKeyPress} > - {matchDuration} +