From f2c72bda7de689c8bba8c4e36a72082c6275e31d Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Fri, 11 Feb 2022 18:50:26 +0700 Subject: [PATCH] feat(#2239): add tournaments popup for facr --- src/config/clients/facr.tsx | 2 +- src/features/App/AuthenticatedApp.tsx | 4 ++- src/features/Menu/index.tsx | 6 ++-- src/features/TournamentsPopup/hooks.tsx | 19 +++++++++++ src/features/TournamentsPopup/index.tsx | 43 ++++++++++++++++++++++++ src/features/TournamentsPopup/styled.tsx | 8 +++++ 6 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 src/features/TournamentsPopup/hooks.tsx create mode 100644 src/features/TournamentsPopup/index.tsx create mode 100644 src/features/TournamentsPopup/styled.tsx diff --git a/src/config/clients/facr.tsx b/src/config/clients/facr.tsx index 9475a216..acc29599 100644 --- a/src/config/clients/facr.tsx +++ b/src/config/clients/facr.tsx @@ -23,7 +23,7 @@ export const facr: ClientConfig = { }, defaultLanguage: 'cs', description: 'Live sports streaming platform. All matches playing under the auspices of Czech Republic FA. Access to full matches, various player playlists, and highlights. Free access in the Czech Republic. Available across all devices', - disabledPreferences: true, + disabledPreferences: false, name: ClientNames.Facr, privacyLink: '/clients/facr/terms-and-conditions.html', requests: { diff --git a/src/features/App/AuthenticatedApp.tsx b/src/features/App/AuthenticatedApp.tsx index 4edb35ef..500b186f 100644 --- a/src/features/App/AuthenticatedApp.tsx +++ b/src/features/App/AuthenticatedApp.tsx @@ -9,6 +9,7 @@ import { import { indexLexics } from 'config/lexics/indexLexics' import { isProduction } from 'config/env' import { PAGES } from 'config/pages' +import { client } from 'config/clients' import { StripeElements } from 'features/StripeElements' @@ -20,6 +21,7 @@ import { UserFavoritesStore } from 'features/UserFavorites/store' import { MatchPopup, MatchPopupStore } from 'features/MatchPopup' import { BuyMatchPopup, BuyMatchPopupStore } from 'features/BuyMatchPopup' import { PreferencesPopup, PreferencesPopupStore } from 'features/PreferencesPopup' +import { TournamentsPopup } from 'features/TournamentsPopup' import { CardsStore } from 'features/CardsStore' import { NoNetworkPopup, NoNetworkPopupStore } from 'features/NoNetworkPopup' @@ -46,7 +48,7 @@ export const AuthenticatedApp = () => { - + { client.name === 'facr' ? : } {/* в Switch как прямой children можно рендерить только Route или Redirect */} diff --git a/src/features/Menu/index.tsx b/src/features/Menu/index.tsx index f46e1b0a..1999717b 100644 --- a/src/features/Menu/index.tsx +++ b/src/features/Menu/index.tsx @@ -5,8 +5,9 @@ import { client } from 'config/clients' import { PAGES } from 'config/pages' import { usePreferencesStore } from 'features/PreferencesPopup' - +import { useTournamentsPopup } from 'features/TournamentsPopup/hooks' import { FavoritesMobilePopup } from '../FavoritesMobilePopup' + import { MenuList, MenuItem, @@ -15,6 +16,7 @@ import { export const Menu = () => { const { openPopup } = usePreferencesStore() + const { openTournamentsPopup } = useTournamentsPopup() const isHomePage = useRouteMatch(PAGES.home)?.isExact return ( @@ -22,7 +24,7 @@ export const Menu = () => { {isMobileDevice && } { isHomePage && !client.disabledPreferences && ( - + ) diff --git a/src/features/TournamentsPopup/hooks.tsx b/src/features/TournamentsPopup/hooks.tsx new file mode 100644 index 00000000..682680fd --- /dev/null +++ b/src/features/TournamentsPopup/hooks.tsx @@ -0,0 +1,19 @@ +import { useState } from 'react' + +export const useTournamentsPopup = () => { + const [isOpen, setIsOpen] = useState(false) + + const closePopup = () => { + setIsOpen(false) + } + + const openTournamentsPopup = () => { + setIsOpen(true) + } + + return { + closePopup, + isOpen, + openTournamentsPopup, + } +} diff --git a/src/features/TournamentsPopup/index.tsx b/src/features/TournamentsPopup/index.tsx new file mode 100644 index 00000000..dd2eb117 --- /dev/null +++ b/src/features/TournamentsPopup/index.tsx @@ -0,0 +1,43 @@ +// import { HeaderActions, CloseButton } from 'features/PopupComponents' +// import { T9n } from 'features/T9n' + +// import { SportsList } from './components/SportList' +// import { TournamentsBlock } from './components/TournamentsBlock' +import { HeaderActions, CloseButton } from 'features/PopupComponents' +import { T9n } from 'features/T9n' + +import { + Modal, + Wrapper, + Header, + HeaderTitle, + // Body, + // Footer, + // ApplyButton, +} from 'features/PreferencesPopup/styled' + +import { useTournamentsPopup } from './hooks' + +export const TournamentsPopup = () => { + const { closePopup, isOpen } = useTournamentsPopup() +console.log('isOpen', isOpen) + + return ( + + +
+ + + + + + +
+
+
+ ) +} diff --git a/src/features/TournamentsPopup/styled.tsx b/src/features/TournamentsPopup/styled.tsx new file mode 100644 index 00000000..f118abc0 --- /dev/null +++ b/src/features/TournamentsPopup/styled.tsx @@ -0,0 +1,8 @@ +import styled, { css } from 'styled-components/macro' + +import { isMobileDevice } from 'config/userAgent' + +import { Modal } from 'features/PreferencesPopup/styled' + +export const ScModal = styled(Modal)` +`