From c9868effeb3baedc39d1796f2a8cb70678c96ed7 Mon Sep 17 00:00:00 2001 From: Rakov Date: Mon, 24 Apr 2023 18:15:17 +0300 Subject: [PATCH] fix(#495): india client fixes --- public/images/dollar-sign-grey.svg | 3 -- public/images/dollar-sign.svg | 3 -- src/config/clients/facr.tsx | 5 ++ src/config/clients/india.tsx | 7 ++- src/config/clients/insports.tsx | 5 ++ src/config/clients/instat.tsx | 5 ++ src/config/clients/lff.tsx | 5 ++ src/config/clients/tunisia.tsx | 5 ++ src/config/clients/types.tsx | 5 ++ src/features/CompanyInfo/config.tsx | 6 +++ src/features/CompanyInfo/index.tsx | 24 +++++++++ src/features/GlobalStores/index.tsx | 50 +++++++++++++++---- .../CardFrontside/MatchCardMobile/index.tsx | 20 ++++++-- .../CardFrontside/MatchCardMobile/styled.tsx | 15 ++---- .../MatchCard/CardFrontside/index.tsx | 31 ++++++++++-- src/features/MatchCard/styled.tsx | 7 ++- src/features/UserAccount/index.tsx | 4 +- src/libs/index.ts | 1 + src/libs/objects/Dollar.tsx | 4 -- src/libs/objects/Rupee.tsx | 10 ++++ 20 files changed, 170 insertions(+), 45 deletions(-) delete mode 100644 public/images/dollar-sign-grey.svg delete mode 100644 public/images/dollar-sign.svg create mode 100644 src/libs/objects/Rupee.tsx diff --git a/public/images/dollar-sign-grey.svg b/public/images/dollar-sign-grey.svg deleted file mode 100644 index ff9b7154..00000000 --- a/public/images/dollar-sign-grey.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/public/images/dollar-sign.svg b/public/images/dollar-sign.svg deleted file mode 100644 index ae6c8b37..00000000 --- a/public/images/dollar-sign.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/config/clients/facr.tsx b/src/config/clients/facr.tsx index 6c3fc9c2..6b4f0ed9 100644 --- a/src/config/clients/facr.tsx +++ b/src/config/clients/facr.tsx @@ -21,6 +21,11 @@ export const facr: ClientConfig = { clientId: ClientIds.Facr, metaDataUrlParams: `?hash=${randomHash()}`, }, + currencyBadge: { + color: '#333333', + secondColor: 'rgba(255, 255, 255, 0.7)', + sign: 'Dollar', + }, 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: false, diff --git a/src/config/clients/india.tsx b/src/config/clients/india.tsx index 0eac3a13..3cf869c5 100644 --- a/src/config/clients/india.tsx +++ b/src/config/clients/india.tsx @@ -8,9 +8,14 @@ import { insports } from './insports' export const india: ClientConfig = { ...insports, - about_the_project: 'https://prsolution.pro', auth: { clientId: ClientIds.India, }, + currencyBadge: { + color: '#000000', + secondColor: 'rgba(255, 255, 255, 0.7)', + sign: 'Rupee', + }, + disabledHighlights: true, name: ClientNames.India, } diff --git a/src/config/clients/insports.tsx b/src/config/clients/insports.tsx index 95bb14cb..4a80cb4b 100644 --- a/src/config/clients/insports.tsx +++ b/src/config/clients/insports.tsx @@ -9,6 +9,11 @@ export const insports: ClientConfig = { auth: { clientId: ClientIds.Insports, }, + currencyBadge: { + color: '#333333', + secondColor: 'rgba(255, 255, 255, 0.7)', + sign: 'Dollar', + }, defaultLanguage: 'en', description: 'Live sports streaming platform. Football, basketball, ice hockey and more. Access to various player playlists and game highlights. Multiple subscription options. Available across all devices.', disabledPreferences: true, diff --git a/src/config/clients/instat.tsx b/src/config/clients/instat.tsx index 394a2df0..c57d0a53 100644 --- a/src/config/clients/instat.tsx +++ b/src/config/clients/instat.tsx @@ -9,6 +9,11 @@ export const instat: ClientConfig = { auth: { clientId: ClientIds.Instat, }, + currencyBadge: { + color: '#333333', + secondColor: 'rgba(255, 255, 255, 0.7)', + sign: 'Dollar', + }, defaultLanguage: 'en', description: 'Live sports streaming platform. Football, basketball, ice hockey and more. Access to various player playlists and game highlights. Multiple subscription options. Available across all devices.', disabledPreferences: true, diff --git a/src/config/clients/lff.tsx b/src/config/clients/lff.tsx index 53b69bf7..2a00328c 100644 --- a/src/config/clients/lff.tsx +++ b/src/config/clients/lff.tsx @@ -9,6 +9,11 @@ export const lff: ClientConfig = { auth: { clientId: ClientIds.Lff, }, + currencyBadge: { + color: '#333333', + secondColor: 'rgba(255, 255, 255, 0.7)', + sign: 'Dollar', + }, defaultLanguage: 'lv', description: 'Latvijas Futbola federācija (LFF) pašmāju futbola spēļu tiešraižu, apskatu un ierakstu platforma.', disabledHighlights: true, diff --git a/src/config/clients/tunisia.tsx b/src/config/clients/tunisia.tsx index 46336c21..e27d68a8 100644 --- a/src/config/clients/tunisia.tsx +++ b/src/config/clients/tunisia.tsx @@ -15,6 +15,11 @@ export const tunisia: ClientConfig = { clientId: ClientIds.Tunisia, metaDataUrlParams: `?hash=${randomHash()}`, }, + currencyBadge: { + color: '#333333', + secondColor: 'rgba(255, 255, 255, 0.7)', + sign: 'Dollar', + }, defaultLanguage: 'fr', description: '', disabledFilters: true, diff --git a/src/config/clients/types.tsx b/src/config/clients/types.tsx index b79c084b..6848cb30 100644 --- a/src/config/clients/types.tsx +++ b/src/config/clients/types.tsx @@ -30,6 +30,11 @@ export type ClientConfig = { clientId: ClientIds, metaDataUrlParams?: string, }, + currencyBadge: { + color: string, + secondColor: string, + sign: 'Dollar' | 'Rupee', + }, defaultLanguage: string, description: string, disabledFilters?: boolean, diff --git a/src/features/CompanyInfo/config.tsx b/src/features/CompanyInfo/config.tsx index ca31d8d1..bca5a2ee 100644 --- a/src/features/CompanyInfo/config.tsx +++ b/src/features/CompanyInfo/config.tsx @@ -7,4 +7,10 @@ export const lexics = [ 18170, 19588, 19590, + 20140, + 20141, + 20142, + 20143, + 20144, + 20145, ] diff --git a/src/features/CompanyInfo/index.tsx b/src/features/CompanyInfo/index.tsx index 9661e60d..4819c317 100644 --- a/src/features/CompanyInfo/index.tsx +++ b/src/features/CompanyInfo/index.tsx @@ -64,6 +64,30 @@ export const CompanyInfo = ({ ) + case ClientNames.India: + return ( + + + + + + + + + + +
+ + + + + + + + + +
+ ) default: return ( diff --git a/src/features/GlobalStores/index.tsx b/src/features/GlobalStores/index.tsx index 9d858a1e..f41eaada 100644 --- a/src/features/GlobalStores/index.tsx +++ b/src/features/GlobalStores/index.tsx @@ -1,20 +1,52 @@ -import { ReactNode } from 'react' +import { + ReactNode, + useEffect, + useState, +} from 'react' -import { getLanguageUrlParam } from 'helpers/languageUrlParam' +import { useLocation } from 'react-router' + +import { getLanguageUrlParam, redirectToUrl } from 'helpers' import { AuthStore } from 'features/AuthStore' import { LexicsStore } from 'features/LexicsStore' +import { getGeoInfo } from 'requests' + +import { isInSportsClient } from 'config' + const initialLanguage = getLanguageUrlParam() type Props = { children: ReactNode, } -export const GlobalStores = ({ children }: Props) => ( - - - {children} - - -) +export const GlobalStores = ({ children }: Props) => { + const { pathname, search } = useLocation() + const [isGeoReady, setIsGeoReady] = useState(false) + + useEffect(() => { + (async () => { + if (isInSportsClient) { + const geo = await getGeoInfo() + + if (geo.country_code === 'IN') { + redirectToUrl(`https://india.insports.tv${pathname}${search}`) + return + } + } + setIsGeoReady(true) + })() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + + if (!isGeoReady) return null + + return ( + + + {children} + + + ) +} diff --git a/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx b/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx index 6034f830..45e27e4e 100644 --- a/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx +++ b/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx @@ -3,8 +3,12 @@ import { useLocation, useRouteMatch } from 'react-router' import getUnixTime from 'date-fns/getUnixTime' -import { ProfileTypes, PAGES } from 'config' -import { isLffClient } from 'config/clients' +import { + ProfileTypes, + PAGES, + client, + isLffClient, +} from 'config' import type { Match } from 'features/Matches' import { useMatchSwitchesStore } from 'features/MatchSwitches' @@ -12,6 +16,7 @@ import { useName } from 'features/Name' import { T9n } from 'features/T9n' import { MatchAccess } from 'features/Matches/helpers/getMatchClickAction' import { useUserFavoritesStore } from 'features/UserFavorites/store' +import { Icon } from 'features/Icon' import { getCardColor } from 'helpers/getCardColor' @@ -42,7 +47,6 @@ import { FavoriteSign, NameSignWrapper, HoverFrame, - ScDollar, MobTime, } from './styled' import { useCardPreview } from '../hooks' @@ -169,7 +173,15 @@ export const CardFrontsideMobile = ({ {isHomePage || isMatchPage ? : null} {access === MatchAccess.CanBuyMatch && ( - + )} diff --git a/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx b/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx index f70b7372..7c5f3237 100644 --- a/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx +++ b/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx @@ -4,7 +4,6 @@ import { devices } from 'config/devices' import { isMobileDevice } from 'config/userAgent' import { Name } from 'features/Name' -import { Icon } from 'features/Icon' import { ProfileLogo } from 'features/ProfileLogo' export const CardWrapperOuter = styled.li.attrs({ @@ -347,7 +346,6 @@ export const BuyMatchBadge = styled.span` height: 1.18rem; cursor: pointer; - /* background-image: url(/images/dollar-sign.svg); */ color: rgba(255, 255, 255, 0.7); background-position: center; background-repeat: no-repeat; @@ -355,22 +353,15 @@ export const BuyMatchBadge = styled.span` background-color: rgba(255, 255, 255, 0.19); border-radius: 50%; box-shadow: 0px 0.08rem 0.283rem rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; ${isMobileDevice ? css` position: static; - display: flex; - align-items: center; - justify-content: center; width: 15px; height: 15px; - /* background-size: 40%; */ ` : ''}; ` - -export const ScDollar = styled(Icon)` - display: flex; - justify-content: center; - align-items: center; -` diff --git a/src/features/MatchCard/CardFrontside/index.tsx b/src/features/MatchCard/CardFrontside/index.tsx index f8900bf3..6eef3cdf 100644 --- a/src/features/MatchCard/CardFrontside/index.tsx +++ b/src/features/MatchCard/CardFrontside/index.tsx @@ -4,7 +4,7 @@ import { useLocation, useRouteMatch } from 'react-router' import getUnixTime from 'date-fns/getUnixTime' import { ProfileTypes, PAGES } from 'config' -import { isLffClient } from 'config/clients' +import { client, isLffClient } from 'config/clients' import type { LiveScore } from 'requests' @@ -44,6 +44,7 @@ import { import { useCardPreview } from './hooks' import { getPrepareTimeFormat } from '../helpers' import { getPrepareDateFormat } from '../helpers/getPrepareDateFormat' +import { Icon } from '../../Icon' type Props = { isNeedFormatTimeChanged: boolean, @@ -149,9 +150,33 @@ export const CardFrontside = ({ /> )} - {access === MatchAccess.CanBuyMatch && } + {access === MatchAccess.CanBuyMatch && !isMatchPage && ( + + + + )} - {access === MatchAccess.CanBuyMatch && isMatchPage && } + {access === MatchAccess.CanBuyMatch && isMatchPage && ( + + + + )} {isHomePage || isMatchPage ? null : prepareDate} diff --git a/src/features/MatchCard/styled.tsx b/src/features/MatchCard/styled.tsx index e89069ac..bf8e50b6 100644 --- a/src/features/MatchCard/styled.tsx +++ b/src/features/MatchCard/styled.tsx @@ -314,7 +314,6 @@ export const BuyMatchBadge = styled.span` width: 1.18rem; height: 1.18rem; cursor: pointer; - background-image: url(/images/dollar-sign.svg); background-position: center; background-repeat: no-repeat; background-size: 0.472rem 0.71rem; @@ -322,20 +321,20 @@ export const BuyMatchBadge = styled.span` border-radius: 50%; border: 0.5px solid rgba(0, 0, 0, 0.2); box-shadow: 0px 0.08rem 0.283rem rgba(0, 0, 0, 0.5); - display: ${({ isMatchPage }) => (isMatchPage ? 'none' : 'block')}; + display: flex; + justify-content: center; + align-items: center; ${isMobileDevice ? css` width: 19px; height: 17px; - background-size: 40%; ` : ''}; ` export const BuyMatchBadgeCustom = styled(BuyMatchBadge)` background-color: rgba(255, 255, 255, 0.19); - background-image: url(/images/dollar-sign-grey.svg); background-size: auto; min-width: 18px; min-height: 18px; diff --git a/src/features/UserAccount/index.tsx b/src/features/UserAccount/index.tsx index d4af259d..62563155 100644 --- a/src/features/UserAccount/index.tsx +++ b/src/features/UserAccount/index.tsx @@ -15,10 +15,10 @@ import { T9n } from 'features/T9n' import { client, + isFacrClient, isInSportsClient, isInstatClient, isLffClient, - isTunisClient, } from 'config/clients' import { Header } from './components/Header' @@ -79,7 +79,7 @@ const UserAccount = () => { > - {!isLffClient && !isInSportsClient && !isTunisClient && ( + {isFacrClient && ( ( diff --git a/src/libs/objects/Rupee.tsx b/src/libs/objects/Rupee.tsx new file mode 100644 index 00000000..1b7acf85 --- /dev/null +++ b/src/libs/objects/Rupee.tsx @@ -0,0 +1,10 @@ +export const Rupee = () => ( + + + +)