From 5b7ad10d5b0973c824f5f1204f5ccd72d984c23e Mon Sep 17 00:00:00 2001 From: Sergio Betanzos Date: Fri, 17 Dec 2021 15:32:06 +0100 Subject: [PATCH] F #5637: Lint (#1677) (cherry picked from commit 0e5af4c5c88fedf3feb9be19be18ab25a62f3e00) --- .../src/client/components/Timer/index.js | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/src/fireedge/src/client/components/Timer/index.js b/src/fireedge/src/client/components/Timer/index.js index 0d45a6e417..9c6a9d0b07 100644 --- a/src/fireedge/src/client/components/Timer/index.js +++ b/src/fireedge/src/client/components/Timer/index.js @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * * limitations under the License. * * ------------------------------------------------------------------------- */ -import { ReactElement, useMemo, memo, useState, useEffect } from 'react' +import { ReactElement, memo, useState, useEffect } from 'react' +import PropTypes from 'prop-types' import { DateTime } from 'luxon' import { Translate } from 'client/components/HOC' @@ -62,34 +63,13 @@ const Timer = memo( prev.initial === next.initial && prev.translateWord === next.translateWord ) -/* const Timer = memo(({ initial, luxon, translateWord, interval = 1000 }) => { - const ensuredInitial = useMemo(() => { - const isLuxon = luxon || initial?.isValid - const val = isLuxon ? initial : timeFromMilliseconds(+initial) - - return val.toRelative() - }, []) - - const [timer, setTimer] = useState(() => ensuredInitial) - - useEffect(() => { - const tick = setInterval(() => { - const newTimer = DateTime.local().toRelative() - - newTimer !== timer && setTimer(newTimer) - }, interval) - - return () => { - clearInterval(tick) - } - }, []) - - /* if (translateWord) { - return - } - - return <>{timer} -}) */ +Timer.propTypes = { + initial: PropTypes.any, + luxon: PropTypes.bool, + translateWord: PropTypes.string, + interval: PropTypes.number, + finishAt: PropTypes.number, +} Timer.displayName = 'Timer'