From 12c01cbc638b499da2bf72bf507d49e4e6445c85 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Thu, 24 Nov 2022 17:49:50 +0300 Subject: [PATCH] fix(timer): add timer for unavailable text --- src/features/App/index.tsx | 9 ++++++++- src/features/UserFavorites/hooks/index.tsx | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/features/App/index.tsx b/src/features/App/index.tsx index 6c1764eb..80f86180 100644 --- a/src/features/App/index.tsx +++ b/src/features/App/index.tsx @@ -44,6 +44,10 @@ const Main = () => { return } +const date = new Date() +const startDate = '2022-11-24T23:00:00' +const stopDate = '2022-11-25T05:00:00' + const OTTApp = () => ( @@ -52,7 +56,10 @@ const OTTApp = () => ( - {isAvailable ? (
) : ()} + {isAvailable + && (date.getTime() < new Date(startDate).getTime() + || date.getTime() > new Date(stopDate).getTime()) + ? (
) : ()} diff --git a/src/features/UserFavorites/hooks/index.tsx b/src/features/UserFavorites/hooks/index.tsx index f276ef4d..624c67e9 100644 --- a/src/features/UserFavorites/hooks/index.tsx +++ b/src/features/UserFavorites/hooks/index.tsx @@ -56,7 +56,7 @@ export const useUserFavorites = () => { userFavorites, (acc, item) => { if ( - item.info.super_tournament + item?.info?.super_tournament && !uniqueTournamnetIds[item.info.super_tournament.id] ) { uniqueTournamnetIds[item.info.super_tournament.id] = item.info.super_tournament.id