diff --git a/src/components/ItemInfo/ItemInfo.tsx b/src/components/ItemInfo/ItemInfo.tsx
index 11f68f32..318192bf 100644
--- a/src/components/ItemInfo/ItemInfo.tsx
+++ b/src/components/ItemInfo/ItemInfo.tsx
@@ -2,7 +2,7 @@
import {
ProfileTypes,
PROFILE_NAMES,
- SportTypes,
+
URL_AWS,
} from 'config'
@@ -17,7 +17,7 @@ type ItemInfoType = {
id: number,
name: string,
onClick: (val: any) => void,
- sportId: SportTypes,
+ sportId: number,
type: ProfileTypes,
}
export const ItemInfo = ({
diff --git a/src/components/SportIcon/SportIcon.tsx b/src/components/SportIcon/SportIcon.tsx
index 45a19e73..99ecc58f 100644
--- a/src/components/SportIcon/SportIcon.tsx
+++ b/src/components/SportIcon/SportIcon.tsx
@@ -1,111 +1,36 @@
-/* eslint sort-keys: 0 */
-import styled from 'styled-components/macro'
+import styled, { css } from 'styled-components/macro'
-import { SportTypes } from 'config'
-import { getSportLexic } from 'helpers'
+import {
+ isMobileDevice,
+ querieKeys,
+ URL_AWS,
+} from 'config'
-import { Icon } from 'features/Icon'
-
-const IconWrap = styled.div`
- color: white;
+export const Icon = styled.img`
+ ${isMobileDevice
+ ? css`
+ width: 10px;
+ height: 10px;
+ `
+ : css`
+ width: 0.65rem;
+ height: 0.65rem;
+ `};
`
-
type Props = {
- fill?: string,
- size?: number | string,
- sport: SportTypes,
-}
-
-const sportIcons = {
- basketball: {
- color: '#f1903b',
- icon: 'Basketball',
- },
- boxing: {
- color: '#ffffff',
- icon: 'Boxing',
- },
- football: {
- color: '#5CDD86',
- icon: 'Football',
- },
- handball: {
- color: '#F6BE4F',
- icon: 'Handball',
- },
- hockey: {
- color: '#5eb2ff',
- icon: 'Hockey',
- },
- streetball: {
- color: '#f1903b',
- icon: 'Streetball',
- },
- volleyball: {
- color: '#2D8B8A',
- icon: 'Volleyball',
- },
- baseball: {
- color: '#ffffff',
- icon: 'Baseball',
- },
- tennis: {
- color: '#ffffff',
- icon: 'Tennis',
- },
- field_hockey: {
- color: '#ffffff',
- icon: 'FIELD_HOCKEY',
- },
- figure_skating: {
- color: '#ffffff',
- icon: 'FIGURE_SKATING',
- },
- american_football: {
- color: '#ffffff',
- icon: 'AMERICAN_FOOTBALL',
- },
- futsal: {
- color: '#ffffff',
- icon: 'FUTSAL',
- },
- floorball: {
- color: '#ffffff',
- icon: 'FLOORBALL',
- },
- cricket: {
- color: '#ffffff',
- icon: 'CRICKET',
- },
- softball: {
- color: '#ffffff',
- icon: 'Softball',
- },
+ sportType?: number,
}
-
-export const SportIcon = ({
- fill,
- size,
- sport,
-}: Props) => {
- const sportType = getSportLexic(sport)
- const IconSport = sportIcons[sportType]?.icon
+export const SportIcon = ({ sportType }: Props) => {
+ const sportList = localStorage.getItem(querieKeys.sportsList)
+ const isHasSport = sportType && sportList && JSON.parse(sportList)[sportType]
return (
-
- {IconSport && (
+ isHasSport
+ ? (
- )}
-
+ ) : null
)
}
+
diff --git a/src/config/index.tsx b/src/config/index.tsx
index 165cff95..e94d0b69 100644
--- a/src/config/index.tsx
+++ b/src/config/index.tsx
@@ -2,7 +2,6 @@ export * from './routes'
export * from './pages'
export * from './authKeys'
export * from './procedures'
-export * from './sportTypes'
export * from './profileTypes'
export * from './history'
export * from './devices'
diff --git a/src/config/lexics/indexLexics.tsx b/src/config/lexics/indexLexics.tsx
index 4ea9695b..8ec44532 100644
--- a/src/config/lexics/indexLexics.tsx
+++ b/src/config/lexics/indexLexics.tsx
@@ -112,6 +112,7 @@ const preferencesPopupLexics = {
}
const sportsPopup = {
+ all_sports: 13824,
football_popup: 12980,
hockey_popup: 15217,
}
@@ -128,7 +129,6 @@ export const indexLexics = {
add_to_favorites_error: 12943,
all_competitions: 17926,
all_matches_shown: 13386,
- all_sports: 13824,
and: 17878,
available_matches_shown: 13385,
basketball: 6960,
diff --git a/src/config/queries.tsx b/src/config/queries.tsx
index c90d0f0f..79580931 100644
--- a/src/config/queries.tsx
+++ b/src/config/queries.tsx
@@ -1,4 +1,5 @@
export const querieKeys = {
liveMatchScores: 'liveMatchScores',
matchScore: 'matchScore',
+ sportsList: 'sportsList',
}
diff --git a/src/config/sportTypes.tsx b/src/config/sportTypes.tsx
deleted file mode 100644
index 45e5fa0b..00000000
--- a/src/config/sportTypes.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-export enum SportTypes {
- FOOTBALL = 1,
- HOCKEY = 2,
- BASKETBALL = 3,
- TENNIS = 4,
- VOLLEYBALL = 6,
- HANDBALL = 7,
- STREETBALL = 9,
- BOXING = 12,
- FIELD_HOCKEY = 14,
- FIGURE_SKATING = 15,
- AMERICAN_FOOTBALL = 16,
- FUTSAL = 17,
- FLOORBALL = 18,
- CRICKET = 19,
- BASEBALL = 20,
- SOFTBALL = 21
-}
-
-export const SPORT_NAMES = {
- [SportTypes.BASKETBALL]: 'basketball',
- [SportTypes.FOOTBALL]: 'football',
- [SportTypes.TENNIS]: 'tennis',
- [SportTypes.HANDBALL]: 'handball',
- [SportTypes.HOCKEY]: 'hockey',
- [SportTypes.VOLLEYBALL]: 'volleyball',
- [SportTypes.STREETBALL]: 'streetball',
- [SportTypes.BOXING]: 'boxing',
- [SportTypes.BASEBALL]: 'baseball',
- [SportTypes.FIELD_HOCKEY]: 'field_hockey',
- [SportTypes.FIGURE_SKATING]: 'figure_skating',
- [SportTypes.AMERICAN_FOOTBALL]: 'american_football',
- [SportTypes.FUTSAL]: 'futsal',
- [SportTypes.FLOORBALL]: 'floorball',
- [SportTypes.CRICKET]: 'cricket',
- [SportTypes.SOFTBALL]: 'softball',
-} as const
diff --git a/src/features/App/AuthenticatedApp.tsx b/src/features/App/AuthenticatedApp.tsx
index b4d9dda1..c77d84ca 100644
--- a/src/features/App/AuthenticatedApp.tsx
+++ b/src/features/App/AuthenticatedApp.tsx
@@ -14,9 +14,7 @@ import { PAGES } from 'config/pages'
import { client } from 'config/clients'
import { StripeElements } from 'features/StripeElements'
-
import { useLexicsConfig } from 'features/LexicsStore'
-
import { ExtendedSearchStore } from 'features/ExtendedSearchPage'
import { MatchSwitchesStore } from 'features/MatchSwitches'
import { UserFavoritesStore } from 'features/UserFavorites/store'
@@ -28,6 +26,7 @@ import { TournamentPopupStore } from 'features/TournamentsPopup/store'
import { CardsStore } from 'features/CardsStore'
import { NoNetworkPopup, NoNetworkPopupStore } from 'features/NoNetworkPopup'
import { NewDevicePopup } from 'features/NewDevicePopup'
+import { useSportList } from 'features/App/hooks'
const HomePage = lazy(() => import('features/HomePage'))
const UserAccount = lazy(() => import('features/UserAccount'))
@@ -45,6 +44,7 @@ const FailedPaymeePage = lazy(() => import('pages/FailedPaymeePage'))
export const AuthenticatedApp = () => {
useLexicsConfig(indexLexics)
+ useSportList()
return (
diff --git a/src/features/App/hooks.tsx b/src/features/App/hooks.tsx
new file mode 100644
index 00000000..872eeba0
--- /dev/null
+++ b/src/features/App/hooks.tsx
@@ -0,0 +1,41 @@
+import { useQuery } from 'react-query'
+
+import { getSportList } from 'requests/getSportList'
+import type { Sport } from 'requests/getSportList'
+
+import { useLocalStore } from 'hooks'
+
+import { querieKeys } from 'config'
+
+export type SportsType = {
+ [key: number]: Sport,
+}
+
+export const useSportList = () => {
+ const [sportsList, setSportsList] = useLocalStore({
+ defaultValue: {} as Sport,
+ key: querieKeys.sportsList,
+ validator: (val) => !!val,
+ })
+
+ useQuery({
+ queryFn: async () => {
+ const sports = await getSportList()
+
+ if (sports?.length && sports?.length !== Object.keys(sportsList)?.length) {
+ const sportsObject = sports.reduce((prev: Sport, newSport: Sport) => ({
+ ...prev,
+ [newSport.id]: {
+ ...newSport,
+ name_eng: newSport.name_eng.toLowerCase(),
+ name_rus: newSport.name_rus.toLowerCase(),
+ },
+ }), {} as Sport)
+
+ setSportsList(sportsObject)
+ }
+ },
+ queryKey: querieKeys.sportsList,
+ })
+ return { sportsList }
+}
diff --git a/src/features/Common/SportName/index.tsx b/src/features/Common/SportName/index.tsx
index 44107cb3..497656ee 100644
--- a/src/features/Common/SportName/index.tsx
+++ b/src/features/Common/SportName/index.tsx
@@ -1,12 +1,10 @@
-import { SportTypes } from 'config'
-
import { getSportLexic } from 'helpers'
import { Text } from './styled'
type SportNameProps = {
className?: string,
- sport: SportTypes,
+ sport: number,
}
export const SportName = ({ className, sport }: SportNameProps) => (
diff --git a/src/features/Common/SportName/styled.tsx b/src/features/Common/SportName/styled.tsx
index 50d2e835..9dab57f1 100644
--- a/src/features/Common/SportName/styled.tsx
+++ b/src/features/Common/SportName/styled.tsx
@@ -1,11 +1,11 @@
import styled from 'styled-components/macro'
-import { devices, SportTypes } from 'config'
+import { devices } from 'config'
import { T9n } from 'features/T9n'
type Props = {
- sport: SportTypes,
+ sport: number,
}
export const Text = styled(T9n)`
diff --git a/src/features/FavoritesMobilePopup/components/GroupBlock/index.tsx b/src/features/FavoritesMobilePopup/components/GroupBlock/index.tsx
index da50381a..944e459a 100644
--- a/src/features/FavoritesMobilePopup/components/GroupBlock/index.tsx
+++ b/src/features/FavoritesMobilePopup/components/GroupBlock/index.tsx
@@ -70,7 +70,7 @@ export const GroupBlock = ({ groupBlock }: Props) => {
{name}
-
+
{countryOrTeam}
diff --git a/src/features/HeaderFilters/store/hooks/index.tsx b/src/features/HeaderFilters/store/hooks/index.tsx
index f2089981..8e2d5b54 100644
--- a/src/features/HeaderFilters/store/hooks/index.tsx
+++ b/src/features/HeaderFilters/store/hooks/index.tsx
@@ -14,7 +14,7 @@ import { useQueryParamStore } from 'hooks'
import { getSportLexic } from 'helpers'
-import { SPORT_NAMES, SportTypes } from 'config'
+import { querieKeys } from 'config'
import { filterKeys } from '../config'
import { isValidDate } from '../helpers/isValidDate'
@@ -28,6 +28,7 @@ export const useFilters = () => {
key: filterKeys.DATE,
validator: isValidDate,
})
+ const sportList = JSON.parse(localStorage.getItem(querieKeys.sportsList)!)
const [selectedSport, setSelectedSport] = useState(['all_sports'])
const [selectedLeague, setSelectedLeague] = useState>(['all_competitions'])
@@ -52,11 +53,13 @@ export const useFilters = () => {
})
setSportIds(Array.from(sportTypeIds))
- if (!Array.from(sportTypeIds)?.some((id: SportTypes) => SPORT_NAMES[id] === selectedSport[0])
+ if (!Array
+ .from(sportTypeIds)
+ ?.some((id: number) => sportList && (sportList[id]?.name_eng === selectedSport[0]))
) {
setSelectedSport(['all_sports'])
}
- }, [selectedSport])
+ }, [selectedSport, sportList])
const resetFilters = useCallback(() => {
setIsShowTournament(true)
diff --git a/src/features/ItemsList/index.tsx b/src/features/ItemsList/index.tsx
index b13ed09c..7b4a5664 100644
--- a/src/features/ItemsList/index.tsx
+++ b/src/features/ItemsList/index.tsx
@@ -3,11 +3,10 @@ import { Fragment } from 'react'
import map from 'lodash/map'
import {
- SportTypes,
+
ProfileTypes,
URL_AWS,
} from 'config'
-import { isMobileDevice } from 'config/userAgent'
import { Gender } from 'requests'
@@ -36,7 +35,7 @@ type SearchItemsListProps = {
name_eng: string,
name_rus: string,
profileType: ProfileTypes,
- sport: SportTypes,
+ sport: number,
}>,
}
@@ -56,7 +55,7 @@ export const ItemsList = ({
>
-
+
{item.additionalInfo && (
diff --git a/src/features/JoinMatchPage/styled.tsx b/src/features/JoinMatchPage/styled.tsx
index 16e16ab8..8115258f 100644
--- a/src/features/JoinMatchPage/styled.tsx
+++ b/src/features/JoinMatchPage/styled.tsx
@@ -1,13 +1,13 @@
import styled, { css } from 'styled-components/macro'
-import { devices, SportTypes } from 'config'
+import { devices } from 'config'
import { isMobileDevice } from 'config/userAgent'
import { ButtonSolid } from 'features/Common'
import { Logo } from 'features/Logo'
type Props = {
- sportType: SportTypes,
+ sportType: number,
}
export const Wrapper = styled.div`
diff --git a/src/features/MatchPage/components/FavouriteTeam/index.tsx b/src/features/MatchPage/components/FavouriteTeam/index.tsx
index a32cf367..4741b6b8 100644
--- a/src/features/MatchPage/components/FavouriteTeam/index.tsx
+++ b/src/features/MatchPage/components/FavouriteTeam/index.tsx
@@ -5,8 +5,6 @@ import { ItemInfo } from 'components/ItemInfo/ItemInfo'
import type { FavouriteTeams } from 'requests/getFavouriteTeam'
-import { SportTypes } from 'config'
-
import { useFavouriteTeam } from './hooks'
import {
@@ -50,7 +48,7 @@ export const FavouriteTeamPopup = () => {
key={team.id}
id={team.id}
name={team.name_en}
- sportId={SportTypes.FOOTBALL}
+ sportId={1} // football
type={2}
onClick={() => changeActive(team)}
/>
@@ -68,7 +66,7 @@ export const FavouriteTeamPopup = () => {
key={team.id}
id={team.id}
name={team.name_en}
- sportId={SportTypes.FOOTBALL}
+ sportId={1} // football
type={2}
onClick={() => changeActive(team)}
/>
diff --git a/src/features/MatchPage/helpers/prepareMatchProfile.tsx b/src/features/MatchPage/helpers/prepareMatchProfile.tsx
index 02171df7..97f15258 100644
--- a/src/features/MatchPage/helpers/prepareMatchProfile.tsx
+++ b/src/features/MatchPage/helpers/prepareMatchProfile.tsx
@@ -1,13 +1,11 @@
import type { MatchInfo } from 'requests'
-import type { SportTypes } from 'config'
-
import type { Match } from 'features/BuyMatchPopup/types'
type Args = {
matchId: number,
profile: NonNullable,
- sportType: SportTypes,
+ sportType: number,
}
export const prepareMatchProfile = ({
diff --git a/src/features/MatchPage/store/hooks/useMatchPlaylists.tsx b/src/features/MatchPage/store/hooks/useMatchPlaylists.tsx
index 5083f593..2144ae4d 100644
--- a/src/features/MatchPage/store/hooks/useMatchPlaylists.tsx
+++ b/src/features/MatchPage/store/hooks/useMatchPlaylists.tsx
@@ -6,8 +6,6 @@ import {
import isEmpty from 'lodash/isEmpty'
-import type { SportTypes } from 'config/sportTypes'
-
import { MatchInfo } from 'requests/getMatchInfo'
import { getMatchPlaylists } from 'requests/getMatchPlaylists'
@@ -22,7 +20,7 @@ import { initialPlaylist, useSelectedPlaylist } from './useSelectedPlaylist'
type ArgsFetchMatchPlaylists = {
fullMatchDuration: number,
id: number,
- sportType: SportTypes,
+ sportType: number,
}
const initialPlaylists = buildPlaylists(null)
diff --git a/src/features/MatchPopup/store/hooks/index.tsx b/src/features/MatchPopup/store/hooks/index.tsx
index b5ac41e7..ec8107a2 100644
--- a/src/features/MatchPopup/store/hooks/index.tsx
+++ b/src/features/MatchPopup/store/hooks/index.tsx
@@ -7,8 +7,6 @@ import { useLocation } from 'react-router-dom'
import isEmpty from 'lodash/isEmpty'
-import type { SportTypes } from 'config'
-
import { getMatchPlaylists } from 'requests'
import { useToggle } from 'hooks'
@@ -28,7 +26,7 @@ import { usePlaylistLexics } from './usePlaylistLexics'
type ArgsFetchMatchPlaylists = {
id: number,
- sportType: SportTypes,
+ sportType: number,
withFullMatchDuration?: boolean,
}
diff --git a/src/features/MatchPopup/store/hooks/useSettingsState.tsx b/src/features/MatchPopup/store/hooks/useSettingsState.tsx
index 95008191..e12a0ec9 100644
--- a/src/features/MatchPopup/store/hooks/useSettingsState.tsx
+++ b/src/features/MatchPopup/store/hooks/useSettingsState.tsx
@@ -2,8 +2,6 @@ import { useCallback, useMemo } from 'react'
import isObject from 'lodash/isObject'
-import { SportTypes } from 'config'
-
import { useLocalStore } from 'hooks'
import type {
@@ -17,7 +15,7 @@ import { PlayerPlaylistFormats, defaultSettings } from '../../types'
const selectedActionsKey = 'playlist_settings'
const validator = (value: unknown) => Boolean(value) && isObject(value)
-export const useSettingsState = (sportType?: SportTypes) => {
+export const useSettingsState = (sportType?: number) => {
const [settingsObj, setSettingsObj] = useLocalStore({
defaultValue: {},
key: selectedActionsKey,
diff --git a/src/features/MatchPopup/store/hooks/useSportActions.tsx b/src/features/MatchPopup/store/hooks/useSportActions.tsx
index f58aef97..81cba608 100644
--- a/src/features/MatchPopup/store/hooks/useSportActions.tsx
+++ b/src/features/MatchPopup/store/hooks/useSportActions.tsx
@@ -2,14 +2,12 @@ import { useCallback, useState } from 'react'
import map from 'lodash/map'
-import { SportTypes } from 'config'
-
import type { Actions } from 'requests'
import { getSportActions } from 'requests'
import { useLexicsStore } from 'features/LexicsStore'
-export const useSportActions = (sportType?: SportTypes) => {
+export const useSportActions = (sportType?: number) => {
const [actions, setActions] = useState([])
const { addLexicsConfig } = useLexicsStore()
diff --git a/src/features/MatchPopup/types.tsx b/src/features/MatchPopup/types.tsx
index c611b094..00e05f3a 100644
--- a/src/features/MatchPopup/types.tsx
+++ b/src/features/MatchPopup/types.tsx
@@ -1,4 +1,3 @@
-import { SportTypes } from 'config'
import type { Match } from 'features/Matches/hooks'
@@ -34,7 +33,7 @@ export type Settings = {
selectedFormat: PlayerPlaylistFormats,
}
-export type SettingsBySport = Partial>
+export type SettingsBySport = Partial>
export const defaultSettings: Settings = {
episodeDuration: {
diff --git a/src/features/Matches/helpers/addSportType.tsx b/src/features/Matches/helpers/addSportType.tsx
index 94d3c3d5..a50cd06a 100644
--- a/src/features/Matches/helpers/addSportType.tsx
+++ b/src/features/Matches/helpers/addSportType.tsx
@@ -1,13 +1,12 @@
import map from 'lodash/map'
import type { MatchesBySection, Matches } from 'requests'
-import { SportTypes } from 'config'
-const addSportTypeToMatches = (matches: Matches, sport: SportTypes) => (
+const addSportTypeToMatches = (matches: Matches, sport: number) => (
map(matches, (match) => ({ ...match, sport }))
)
-export const addSportType = (matches: MatchesBySection, sport: SportTypes) => ({
+export const addSportType = (matches: MatchesBySection, sport: number) => ({
...matches,
broadcast: addSportTypeToMatches(matches.broadcast, sport),
features: addSportTypeToMatches(matches.features, sport),
diff --git a/src/features/PreferencesPopup/components/TournamentInfo/index.tsx b/src/features/PreferencesPopup/components/TournamentInfo/index.tsx
index 95f4ea05..fe334e24 100644
--- a/src/features/PreferencesPopup/components/TournamentInfo/index.tsx
+++ b/src/features/PreferencesPopup/components/TournamentInfo/index.tsx
@@ -51,7 +51,7 @@ export const TournamentInfo = ({
- {isIcon && }
+ {isIcon && }
diff --git a/src/features/PreferencesPopup/store/helpers.tsx b/src/features/PreferencesPopup/store/helpers.tsx
index b6bedd39..b9190943 100644
--- a/src/features/PreferencesPopup/store/helpers.tsx
+++ b/src/features/PreferencesPopup/store/helpers.tsx
@@ -3,12 +3,11 @@ import toLower from 'lodash/toLower'
import reduce from 'lodash/reduce'
import filter from 'lodash/filter'
-import type { SportTypes } from 'config'
import type { TournamentsBySports, Tournaments } from 'requests/getSportTournaments'
const getFlatTournaments = (
tournamentsBySports: TournamentsBySports,
- selectedSports: Array,
+ selectedSports: Array,
) => (
reduce(
selectedSports,
@@ -27,7 +26,7 @@ type NameKey = 'name_eng' | 'name_rus'
type SearchProps = {
query: string,
- selectedSports: Array,
+ selectedSports: Array,
suffix: string,
tournamentsBySports: TournamentsBySports,
}
diff --git a/src/features/PreferencesPopup/store/hooks/useSearch.tsx b/src/features/PreferencesPopup/store/hooks/useSearch.tsx
index 0c41742c..a0ca0198 100644
--- a/src/features/PreferencesPopup/store/hooks/useSearch.tsx
+++ b/src/features/PreferencesPopup/store/hooks/useSearch.tsx
@@ -7,7 +7,6 @@ import {
import debounce from 'lodash/debounce'
-import type { SportTypes } from 'config'
import type { Tournaments, TournamentsBySports } from 'requests/getSportTournaments'
import { useLexicsStore } from 'features/LexicsStore'
@@ -18,7 +17,7 @@ type SearchArgs = Parameters[0]
export const useSearch = (
tournamentsBySports: TournamentsBySports,
- selectedSports: Array,
+ selectedSports: Array,
) => {
const { suffix } = useLexicsStore()
diff --git a/src/features/PreferencesPopup/store/hooks/useSports.tsx b/src/features/PreferencesPopup/store/hooks/useSports.tsx
index 274975be..627c7245 100644
--- a/src/features/PreferencesPopup/store/hooks/useSports.tsx
+++ b/src/features/PreferencesPopup/store/hooks/useSports.tsx
@@ -4,13 +4,12 @@ import includes from 'lodash/includes'
import without from 'lodash/without'
import isEmpty from 'lodash/isEmpty'
-import type { SportTypes } from 'config'
import type { SportList } from 'requests/getSportList'
import { getSportList } from 'requests/getSportList'
export const useSports = () => {
const [sports, setSports] = useState([])
- const [selectedSports, setSelectedSports] = useState>([])
+ const [selectedSports, setSelectedSports] = useState>([])
const fetchInitialSports = useCallback(() => {
if (isEmpty(sports)) {
@@ -18,7 +17,7 @@ export const useSports = () => {
}
}, [sports])
- const onSportSelect = (sport: SportTypes) => {
+ const onSportSelect = (sport: number) => {
const newSports = includes(selectedSports, sport)
? without(selectedSports, sport)
: [sport, ...selectedSports]
diff --git a/src/features/PreferencesPopup/store/hooks/useTournaments.tsx b/src/features/PreferencesPopup/store/hooks/useTournaments.tsx
index a36dd668..2dd6a973 100644
--- a/src/features/PreferencesPopup/store/hooks/useTournaments.tsx
+++ b/src/features/PreferencesPopup/store/hooks/useTournaments.tsx
@@ -13,13 +13,11 @@ import every from 'lodash/every'
import find from 'lodash/find'
import map from 'lodash/map'
-import type { SportTypes } from 'config'
-
import type { Tournament, Tournaments } from 'requests/getSportTournaments'
import type { UserPreferences } from 'requests/getUserPreferences'
export const useSelectedTournaments = (
- selectedSports: Array,
+ selectedSports: Array,
tournaments: Tournaments,
) => {
const [selectedTournaments, setSelectedTournaments] = useState([])
diff --git a/src/features/PreferencesPopup/store/hooks/useTournamentsBySports.tsx b/src/features/PreferencesPopup/store/hooks/useTournamentsBySports.tsx
index 85d2e765..88300151 100644
--- a/src/features/PreferencesPopup/store/hooks/useTournamentsBySports.tsx
+++ b/src/features/PreferencesPopup/store/hooks/useTournamentsBySports.tsx
@@ -3,14 +3,12 @@ import { useState, useEffect } from 'react'
import isEmpty from 'lodash/isEmpty'
import filter from 'lodash/filter'
-import type { SportTypes } from 'config'
-
import type { TournamentsBySports } from 'requests/getSportTournaments'
import { getTournamentsBySports } from 'requests/getSportTournaments'
import { useRequest } from 'hooks'
-export const useTournamentsBySports = (selectedSports: Array) => {
+export const useTournamentsBySports = (selectedSports: Array) => {
const [tournamentsBySports, setTournamentsBySports] = useState({})
const {
diff --git a/src/features/ProfileHeader/hooks.tsx b/src/features/ProfileHeader/hooks.tsx
index 4307813b..a5255e95 100644
--- a/src/features/ProfileHeader/hooks.tsx
+++ b/src/features/ProfileHeader/hooks.tsx
@@ -5,7 +5,6 @@ import { getProfileColor } from 'requests/getProfileColor'
import { usePageParams } from 'hooks/usePageParams'
import { getColor } from 'helpers/getColor'
-import { SportTypes } from 'config'
import { client } from 'config/clients'
import { DEFAULT_HEADER_COLOR } from './styled'
@@ -36,7 +35,7 @@ export const useProfileColor = (profileId?: number) => {
]
if (
client.name === 'facr'
- && sportType === SportTypes.FOOTBALL && profileId && prifileWithConfifColor.includes(profileId)
+ && sportType === 1 && profileId && prifileWithConfifColor.includes(profileId)
) {
return getColor(profileId)
}
diff --git a/src/features/ProfileHeader/index.tsx b/src/features/ProfileHeader/index.tsx
index 39cad9ec..52094e9c 100644
--- a/src/features/ProfileHeader/index.tsx
+++ b/src/features/ProfileHeader/index.tsx
@@ -4,7 +4,6 @@ import { Link } from 'react-router-dom'
import {
PAGES,
- SportTypes,
ProfileTypes,
} from 'config'
@@ -53,7 +52,7 @@ export const ProfileHeader = ({
const color = useProfileColor(profileId)
// @ts-ignore
const imageHeader = Boolean(profileWithImage[profileId])
- && sportType === SportTypes.FOOTBALL
+ && sportType === 1
&& profileType === ProfileTypes.TOURNAMENTS ? `/images/${profileId}` : headerImage
return (
diff --git a/src/features/ProfileLink/helpers/__tests__/index.tsx b/src/features/ProfileLink/helpers/__tests__/index.tsx
index 0cd8f303..73547771 100644
--- a/src/features/ProfileLink/helpers/__tests__/index.tsx
+++ b/src/features/ProfileLink/helpers/__tests__/index.tsx
@@ -1,28 +1,54 @@
-import { ProfileTypes, SportTypes } from 'config'
+import { ProfileTypes, querieKeys } from 'config'
import { getProfileUrl } from '..'
it('returns correct profile urls', () => {
+ localStorage.setItem(querieKeys.sportsList, JSON.stringify({
+ 1: {
+ id: 1,
+ lexic: 12980,
+ name_eng: 'football',
+ name_rus: 'футбол',
+ },
+ 2: {
+ id: 2,
+ lexic: 6959,
+ name_eng: 'hockey',
+ name_rus: 'хоккей',
+ },
+ 3: {
+ id: 3,
+ lexic: 3556,
+ name_eng: 'basketball',
+ name_rus: 'баскетбол',
+ },
+ 4: {
+ id: 4,
+ lexic: 20000,
+ name_eng: 'tennis',
+ name_rus: 'теннис',
+ },
+ }))
expect(getProfileUrl({
id: 1,
profileType: ProfileTypes.PLAYERS,
- sportType: SportTypes.FOOTBALL,
+ sportType: 1,
})).toBe('/football/players/1')
expect(getProfileUrl({
id: 2,
profileType: ProfileTypes.TEAMS,
- sportType: SportTypes.BASKETBALL,
- })).toBe('/basketball/teams/2')
+ sportType: 2,
+ })).toBe('/hockey/teams/2')
expect(getProfileUrl({
id: 3,
profileType: ProfileTypes.TOURNAMENTS,
- sportType: SportTypes.HOCKEY,
- })).toBe('/hockey/tournaments/3')
+ sportType: 3,
+ })).toBe('/basketball/tournaments/3')
expect(getProfileUrl({
id: 4,
profileType: ProfileTypes.TOURNAMENTS,
- sportType: SportTypes.HANDBALL,
- })).toBe('/handball/tournaments/4')
+ sportType: 4,
+ })).toBe('/tennis/tournaments/4')
})
diff --git a/src/features/ProfileLink/helpers/index.tsx b/src/features/ProfileLink/helpers/index.tsx
index 7b1a2209..387a2671 100644
--- a/src/features/ProfileLink/helpers/index.tsx
+++ b/src/features/ProfileLink/helpers/index.tsx
@@ -1,20 +1,24 @@
import {
- SportTypes,
+
ProfileTypes,
- SPORT_NAMES,
PROFILE_NAMES,
+ querieKeys,
} from 'config'
type Args = {
id: number,
profileType: ProfileTypes,
- sportType: SportTypes,
+ sportType: number,
}
export const getProfileUrl = ({
id,
profileType,
sportType,
-}: Args) => (
- `/${SPORT_NAMES[sportType]}/${PROFILE_NAMES[profileType]}/${id}`
-)
+}: Args) => {
+ const sportList = JSON.parse(localStorage.getItem(querieKeys.sportsList)!)
+
+ return (
+ sportList && `/${sportList[sportType]?.name_eng}/${PROFILE_NAMES[profileType]}/${id}`
+ )
+}
diff --git a/src/features/ProfileLink/index.tsx b/src/features/ProfileLink/index.tsx
index 7fe865a3..6d8b682f 100644
--- a/src/features/ProfileLink/index.tsx
+++ b/src/features/ProfileLink/index.tsx
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'
import styled, { css } from 'styled-components'
-import { ProfileTypes, SportTypes } from 'config'
+import { ProfileTypes } from 'config'
import { getProfileUrl } from './helpers'
@@ -14,7 +14,7 @@ type Props = {
id: number,
onClick?: (e: MouseEvent) => void,
profileType: ProfileTypes,
- sportType: SportTypes,
+ sportType: number,
target?: string,
}
diff --git a/src/features/ProfileLogo/index.tsx b/src/features/ProfileLogo/index.tsx
index 422bde7f..82b78498 100644
--- a/src/features/ProfileLogo/index.tsx
+++ b/src/features/ProfileLogo/index.tsx
@@ -4,7 +4,7 @@ import {
useState,
} from 'react'
-import { ProfileTypes, SportTypes } from 'config'
+import { ProfileTypes } from 'config'
import {
getProfileFallbackLogo,
@@ -25,7 +25,7 @@ type ProfileImageProps = {
onLoad?: () => void,
prefix?: string,
profileType: ProfileTypes,
- sportType: SportTypes,
+ sportType: number,
title?: string,
}
diff --git a/src/features/SportIcon/index.tsx b/src/features/SportIcon/index.tsx
deleted file mode 100644
index c89663db..00000000
--- a/src/features/SportIcon/index.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import styled from 'styled-components/macro'
-
-import { SportTypes } from 'config'
-import { getSportLexic } from 'helpers'
-
-type IconProps = {
- src: string,
-}
-
-const Icon = styled.span`
- display: inline-block;
- height: 10px;
- min-width: 10px;
-
- background-image: url(/images/${({ src }) => `${src}-icon`}.svg);
- background-repeat: no-repeat;
- background-position: center;
- background-size: 100% 100%;
-`
-
-type Props = {
- sport: SportTypes,
-}
-
-export const SportIcon = ({ sport }: Props) => (
-
-)
diff --git a/src/features/SportsFilter/components/SelectSport/index.tsx b/src/features/SportsFilter/components/SelectSport/index.tsx
index f12cb1f6..2cf7d1cc 100644
--- a/src/features/SportsFilter/components/SelectSport/index.tsx
+++ b/src/features/SportsFilter/components/SelectSport/index.tsx
@@ -1,6 +1,6 @@
import { T9n } from 'features/T9n'
-import type { SportsType } from 'features/SportsFilter'
+import { getSport } from 'helpers'
import {
Arrows,
ScSportsFilter,
@@ -11,20 +11,23 @@ type SportsFilterProps = {
onModalOpen: () => void,
open: boolean,
sport: Array,
- sports: SportsType,
}
export const SelectSport = ({
onModalOpen,
open,
sport,
- sports,
}: SportsFilterProps) => (
-
+
-
+
{sport.length > 1 ? `+ ${sport.length - 1}` : ''}
diff --git a/src/features/SportsFilter/components/SelectSportPopup/index.tsx b/src/features/SportsFilter/components/SelectSportPopup/index.tsx
index a57fea77..831d4375 100644
--- a/src/features/SportsFilter/components/SelectSportPopup/index.tsx
+++ b/src/features/SportsFilter/components/SelectSportPopup/index.tsx
@@ -1,9 +1,8 @@
import { T9n } from 'features/T9n'
-import type { SportsType } from 'features/SportsFilter'
import { isMobileDevice } from 'config/userAgent'
-import { getSportLexic } from 'helpers/getSportLexic'
+import { getSport, getSportLexic } from 'helpers/getSportLexic'
import {
ScBody,
@@ -20,19 +19,18 @@ type Props = {
onSportClick: (sport: string) => void,
selectedSport: Array,
sportIds: Array,
- sports: SportsType,
}
+
export const SelectSportPopup = ({
isOpen,
onModalClose,
onSportClick,
selectedSport,
sportIds,
- sports,
}: Props) => {
const sportNames = sportIds?.map((id) => String(getSportLexic(Number(id))))
sportNames?.unshift('all_sports')
-
+ // TODO: переделать на вариант без указания all_sports
return (
<>
= 0}
>
-
+
))}
diff --git a/src/features/SportsFilter/index.tsx b/src/features/SportsFilter/index.tsx
index 4ba13992..920556dc 100644
--- a/src/features/SportsFilter/index.tsx
+++ b/src/features/SportsFilter/index.tsx
@@ -5,17 +5,6 @@ import { useHeaderFiltersStore } from 'features/HeaderFilters'
import { SelectSport } from './components/SelectSport'
import { SelectSportPopup } from './components/SelectSportPopup'
-const sports = {
- all_sports: 'all_sports',
- basketball: 'basketball',
- football: 'football_popup',
- handball: 'handball',
- hockey: 'hockey_popup',
- volleyball: 'volleyball',
-}
-
-export type SportsType = typeof sports
-
export const SportsFilter = () => {
const {
isShowTournament,
@@ -25,6 +14,7 @@ export const SportsFilter = () => {
setSelectedSport,
sportIds,
} = useHeaderFiltersStore()
+
const [isOpen, setIsOpen] = useState(false)
const onSportClick = (sport: string) => {
@@ -54,7 +44,6 @@ export const SportsFilter = () => {
onModalOpen={onModalOpen}
open={isOpen}
sport={selectedSport}
- sports={sports}
/>
{
onModalClose={onModalClose}
selectedSport={selectedSport}
sportIds={sportIds}
- sports={sports}
/>
>
)
diff --git a/src/features/StreamPlayer/components/ProgressBar/helpers/calculateChapterStyles/__tests__/index.tsx b/src/features/StreamPlayer/components/ProgressBar/helpers/calculateChapterStyles/__tests__/index.tsx
index 30c3c457..b715aeea 100644
--- a/src/features/StreamPlayer/components/ProgressBar/helpers/calculateChapterStyles/__tests__/index.tsx
+++ b/src/features/StreamPlayer/components/ProgressBar/helpers/calculateChapterStyles/__tests__/index.tsx
@@ -13,7 +13,7 @@ it('return correct progress and width lengthes', () => {
let expected = {
...chapter,
loaded: 100,
- played: 100,
+ played: 50,
width: 25,
}
expect(calculateChapterStyles({
@@ -34,7 +34,7 @@ it('return correct progress and width lengthes', () => {
expected = {
...chapter,
loaded: 50,
- played: 50,
+ played: 25,
width: 50,
}
expect(calculateChapterStyles({
diff --git a/src/features/TournamentList/components/CollapseTournament/index.tsx b/src/features/TournamentList/components/CollapseTournament/index.tsx
index 31bc9dfe..ada238aa 100644
--- a/src/features/TournamentList/components/CollapseTournament/index.tsx
+++ b/src/features/TournamentList/components/CollapseTournament/index.tsx
@@ -81,9 +81,7 @@ export const CollapseTournament = ({
{sportInfo && (
diff --git a/src/features/TournamentList/components/TournamentMobile/index.tsx b/src/features/TournamentList/components/TournamentMobile/index.tsx
index ef131655..233eed92 100644
--- a/src/features/TournamentList/components/TournamentMobile/index.tsx
+++ b/src/features/TournamentList/components/TournamentMobile/index.tsx
@@ -50,9 +50,7 @@ export const TournamentMobile = ({
{!isLffClient && (
) => {
diff --git a/src/features/TournamentSubtitle/index.tsx b/src/features/TournamentSubtitle/index.tsx
index 579b42d4..d54eb6a4 100644
--- a/src/features/TournamentSubtitle/index.tsx
+++ b/src/features/TournamentSubtitle/index.tsx
@@ -1,18 +1,14 @@
import { Fragment } from 'react'
-import { SportIcon } from 'components/SportIcon/SportIcon'
-
import { Name } from 'features/Name'
import { T9n } from 'features/T9n'
import { useUserFavoritesStore } from 'features/UserFavorites/store'
import {
ProfileTypes,
- SportTypes,
URL_AWS,
} from 'config'
import { isLffClient } from 'config/clients'
-import { isMobileDevice } from 'config/userAgent'
import { usePageParams } from 'hooks/usePageParams'
@@ -20,6 +16,8 @@ import { TournamentType, SportInfo } from 'requests'
import { isMatchPage } from 'helpers/isMatchPage'
+import { SportIcon } from 'components/SportIcon/SportIcon'
+
import {
CountryFlag,
CountryWrapper,
@@ -30,6 +28,7 @@ import {
Tooltip,
Wrapper,
} from './styled'
+
import {
Time,
MatchDate,
@@ -41,7 +40,7 @@ type Props = {
countryInfo?: TournamentType,
date?: string | null,
sportInfo?: SportInfo,
- sportType?: SportTypes,
+ sportType?: number,
time?: string | null,
tournament: TournamentType,
}
@@ -65,10 +64,7 @@ export const TournamentSubtitle = ({
{!isLffClient && (
-
+
{sportInfo && (
diff --git a/src/features/TournamentSubtitle/styled.tsx b/src/features/TournamentSubtitle/styled.tsx
index 39574d1d..acf718c0 100644
--- a/src/features/TournamentSubtitle/styled.tsx
+++ b/src/features/TournamentSubtitle/styled.tsx
@@ -71,12 +71,6 @@ export const CountryFlag = styled.img`
: ''}
`
-export const NameSignWrapper = styled.div`
- display: flex;
- max-width: 90%;
- align-items: center;
-`
-
type StyledLinkProps = {
isLeftSide?: boolean,
isMatchPage?: boolean,
diff --git a/src/features/TournamentsPopup/index.tsx b/src/features/TournamentsPopup/index.tsx
index fd99f52b..27f47a58 100644
--- a/src/features/TournamentsPopup/index.tsx
+++ b/src/features/TournamentsPopup/index.tsx
@@ -1,5 +1,5 @@
import { T9n } from 'features/T9n'
-import { ProfileTypes, SportTypes } from 'config'
+import { ProfileTypes } from 'config'
import { Wrapper } from 'features/PreferencesPopup/styled'
@@ -45,7 +45,7 @@ export const TournamentsPopup = () => {
@@ -63,7 +63,7 @@ export const TournamentsPopup = () => {
diff --git a/src/features/UserAccount/components/UserSubscriptionsList/index.tsx b/src/features/UserAccount/components/UserSubscriptionsList/index.tsx
index 59160cb8..3a13cc44 100644
--- a/src/features/UserAccount/components/UserSubscriptionsList/index.tsx
+++ b/src/features/UserAccount/components/UserSubscriptionsList/index.tsx
@@ -1,8 +1,6 @@
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
-import { SportTypes } from 'config'
-
import type { MatchSubscriptions } from '../PageSubscriptions'
import { InlineButton } from '../../styled'
import {
@@ -20,7 +18,7 @@ import {
type Props = {
list: MatchSubscriptions,
- sport: SportTypes,
+ sport: number,
}
export const UserSubscriptionsList = ({ list, sport }: Props) => {
diff --git a/src/features/UserFavorites/hooks/index.tsx b/src/features/UserFavorites/hooks/index.tsx
index 42554489..78fc3c25 100644
--- a/src/features/UserFavorites/hooks/index.tsx
+++ b/src/features/UserFavorites/hooks/index.tsx
@@ -20,7 +20,7 @@ import {
import { useToggle } from 'hooks/useToggle'
-import { ProfileTypes, SportTypes } from 'config'
+import { ProfileTypes } from 'config'
import { useAuthStore } from '../../AuthStore'
@@ -36,7 +36,7 @@ type ProfileType = {
}
export type SuperTournament = ObjectWithName & {
- sport: SportTypes,
+ sport: number,
type: ProfileTypes,
}
diff --git a/src/helpers/getLocalStorage/index.tsx b/src/helpers/getLocalStorage/index.tsx
new file mode 100644
index 00000000..ef92a1c6
--- /dev/null
+++ b/src/helpers/getLocalStorage/index.tsx
@@ -0,0 +1,10 @@
+export const getLocalStorageItem = (key: string) => {
+ const item = localStorage.getItem(key)!
+ return JSON.parse(item)
+}
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export const setLocalStorageItem = (key: string, value: any) => {
+ localStorage.setItem(key, JSON.stringify(value))
+}
+
diff --git a/src/helpers/getProfileLogo/__tests__/index.tsx b/src/helpers/getProfileLogo/__tests__/index.tsx
index f847b03d..0d36c43f 100644
--- a/src/helpers/getProfileLogo/__tests__/index.tsx
+++ b/src/helpers/getProfileLogo/__tests__/index.tsx
@@ -1,4 +1,4 @@
-import { SportTypes, ProfileTypes } from 'config'
+import { ProfileTypes } from 'config'
import { getProfileLogo } from '..'
@@ -7,19 +7,19 @@ describe('getLogo helper', () => {
expect(getProfileLogo({
id: 1,
profileType: ProfileTypes.PLAYERS,
- sportType: SportTypes.FOOTBALL,
+ sportType: 1,
})).toBe('https://cf-aws.insports.tv/media/players/1/1/photo.png')
expect(getProfileLogo({
id: 1,
profileType: ProfileTypes.TEAMS,
- sportType: SportTypes.BASKETBALL,
+ sportType: 3,
})).toBe('https://cf-aws.insports.tv/media/teams/3/1/logo.jpg')
expect(getProfileLogo({
id: 1,
profileType: ProfileTypes.TOURNAMENTS,
- sportType: SportTypes.HOCKEY,
+ sportType: 2,
})).toBe('https://cf-aws.insports.tv/media/tournaments/2/1/logo.jpg')
})
})
diff --git a/src/helpers/getProfileLogo/index.tsx b/src/helpers/getProfileLogo/index.tsx
index 448c8d06..c2df139d 100644
--- a/src/helpers/getProfileLogo/index.tsx
+++ b/src/helpers/getProfileLogo/index.tsx
@@ -1,14 +1,14 @@
import {
PROFILE_NAMES,
ProfileTypes,
- SportTypes,
+
URL_AWS,
} from 'config'
type GetLogoArgs = {
id: number,
profileType: ProfileTypes,
- sportType: SportTypes,
+ sportType: number,
}
export const getProfileLogo = ({
diff --git a/src/helpers/getSportLexic/index.tsx b/src/helpers/getSportLexic/index.tsx
index 7e051783..67ce7259 100644
--- a/src/helpers/getSportLexic/index.tsx
+++ b/src/helpers/getSportLexic/index.tsx
@@ -1,3 +1,37 @@
-import { SportTypes, SPORT_NAMES } from 'config'
+import { querieKeys } from 'config'
-export const getSportLexic = (sport: SportTypes) => SPORT_NAMES[sport]
+import type { Sport } from 'requests/getSportList'
+
+import type { SportsType } from 'features/App/hooks'
+
+import { getLocalStorageItem } from 'helpers/getLocalStorage'
+
+ type SportNameType = {
+ id?: number,
+ sportName: string,
+ }
+
+ type SportIdType = {
+ id: number,
+ sportName?: string,
+ }
+
+export type SportProps = SportNameType | SportIdType
+
+export const getSportLexic = (sport: number) => {
+ const sportList = getLocalStorageItem(querieKeys.sportsList)
+
+ return sportList && sportList[sport]?.name_eng.toLowerCase()
+}
+export const getSport = ({ id, sportName }: SportProps) => {
+ const sportList = getLocalStorageItem(querieKeys.sportsList)
+
+ if (sportName) {
+ const sport = sportList && Object.values(sportList as SportsType)
+ ?.find(
+ (currentSport: Sport) => currentSport.name_eng.toLowerCase() === sportName.toLowerCase(),
+ )
+ return sport
+ }
+ return id && sportList[id]
+}
diff --git a/src/helpers/isPermittedTournament/index.tsx b/src/helpers/isPermittedTournament/index.tsx
index 9d65501b..bfe3728d 100644
--- a/src/helpers/isPermittedTournament/index.tsx
+++ b/src/helpers/isPermittedTournament/index.tsx
@@ -1,12 +1,11 @@
import includes from 'lodash/includes'
import { client } from 'config/clients'
-import { SportTypes } from 'config/sportTypes'
import { lffTournamentsList } from 'config/lffTournaments'
export const isPermittedTournament = (
tournamentId: number,
- sportType: SportTypes,
+ sportType: number,
) => {
if (client.name !== 'lff') {
return true
diff --git a/src/hooks/usePageParams.tsx b/src/hooks/usePageParams.tsx
index 4d1df1c7..8058dd37 100644
--- a/src/hooks/usePageParams.tsx
+++ b/src/hooks/usePageParams.tsx
@@ -2,7 +2,8 @@ import { useRouteMatch } from 'react-router'
import toUpper from 'lodash/toUpper'
-import { ProfileTypes, SportTypes } from 'config'
+import { ProfileTypes } from 'config'
+import { getSport } from '../helpers'
type RouteParams = {
pageId: string,
@@ -18,11 +19,12 @@ export const usePageParams = () => {
sportName,
},
} = useRouteMatch('/:sportName/:profileName/:pageId') || { params: {} }
+ const sportType = sportName && getSport({ sportName })?.id
return {
profileId: Number(pageId),
profileType: ProfileTypes[toUpper(profileName) as keyof typeof ProfileTypes],
sportName,
- sportType: SportTypes[toUpper(sportName) as keyof typeof SportTypes],
+ sportType,
}
}
diff --git a/src/libs/index.ts b/src/libs/index.ts
index f3795343..a215587a 100644
--- a/src/libs/index.ts
+++ b/src/libs/index.ts
@@ -1,16 +1,10 @@
export { Arrow } from './objects/Arrow'
-export { Boxing } from './objects/Boxing'
export { Date } from './objects/Date'
export { Edit } from './objects/Edit'
export { ExclamationPoint } from './objects/ExclamationPoint'
export { Calendar } from './objects/Calendar'
export { Check } from './objects/Check'
export { CheckCircle } from './objects/CheckCircle'
-export { Basketball } from './objects/Basketball'
-export { Football } from './objects/Football'
-export { Hockey } from './objects/Hockey'
-export { Handball } from './objects/Handball'
-export { Volleyball } from './objects/Volleyball'
export { Search } from './objects/Search'
export { Sound } from './objects/Sound'
export { Star } from './objects/Star'
@@ -20,6 +14,3 @@ export { PiP } from './objects/PiP'
export { PoweredByInstat } from './objects/PoweredByInstat'
export { PoweredByInsports } from './objects/PoweredByInsports'
export { Info } from './objects/Info'
-export { Streetball } from './objects/Streetball'
-export { Baseball } from './objects/Baseball'
-export { Softball } from './objects/Softball'
diff --git a/src/libs/objects/Baseball.tsx b/src/libs/objects/Baseball.tsx
deleted file mode 100644
index 73dd9b6b..00000000
--- a/src/libs/objects/Baseball.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-export const Baseball = () => (
-
-
-)
diff --git a/src/libs/objects/Basketball.tsx b/src/libs/objects/Basketball.tsx
deleted file mode 100644
index cbcac85c..00000000
--- a/src/libs/objects/Basketball.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-export const Basketball = () => (
-
-
-)
diff --git a/src/libs/objects/Boxing.tsx b/src/libs/objects/Boxing.tsx
deleted file mode 100644
index 2422d671..00000000
--- a/src/libs/objects/Boxing.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-export const Boxing = () => (
-
-
-)
diff --git a/src/libs/objects/Football.tsx b/src/libs/objects/Football.tsx
deleted file mode 100644
index 3d4dfebd..00000000
--- a/src/libs/objects/Football.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-export const Football = () => (
-
-
-)
diff --git a/src/libs/objects/Handball.tsx b/src/libs/objects/Handball.tsx
deleted file mode 100644
index 4736b558..00000000
--- a/src/libs/objects/Handball.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-export const Handball = () => (
-
-
-)
diff --git a/src/libs/objects/Hockey.tsx b/src/libs/objects/Hockey.tsx
deleted file mode 100644
index 73455368..00000000
--- a/src/libs/objects/Hockey.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-export const Hockey = () => (
-
-
-)
diff --git a/src/libs/objects/Softball.tsx b/src/libs/objects/Softball.tsx
deleted file mode 100644
index 6f44de7f..00000000
--- a/src/libs/objects/Softball.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-export const Softball = () => (
-
-
-)
diff --git a/src/libs/objects/Streetball.tsx b/src/libs/objects/Streetball.tsx
deleted file mode 100644
index ee828a8d..00000000
--- a/src/libs/objects/Streetball.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-export const Streetball = () => (
-
-
-)
diff --git a/src/libs/objects/Volleyball.tsx b/src/libs/objects/Volleyball.tsx
deleted file mode 100644
index 19470747..00000000
--- a/src/libs/objects/Volleyball.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-export const Volleyball = () => (
-
-
-)
diff --git a/src/pages/HighlightsPage/components/MatchesHighlights/index.tsx b/src/pages/HighlightsPage/components/MatchesHighlights/index.tsx
index b001c68a..fe6c9b65 100644
--- a/src/pages/HighlightsPage/components/MatchesHighlights/index.tsx
+++ b/src/pages/HighlightsPage/components/MatchesHighlights/index.tsx
@@ -4,9 +4,10 @@ import { format } from 'date-fns'
import { T9n } from 'features/T9n'
import { Checkbox } from 'features/Common/Checkbox'
-import { SportIcon } from 'features/SportIcon'
import { ArrowLoader } from 'features/ArrowLoader'
+import { SportIcon } from 'components/SportIcon/SportIcon'
+
import { isMobileDevice } from 'config/userAgent'
import { URL_AWS } from 'config'
@@ -74,7 +75,7 @@ export const MatchesHighlights = () => {
{team1.name_eng} - {team2.name_eng}
-
+
diff --git a/src/requests/getLandingStatus.tsx b/src/requests/getLandingStatus.tsx
index 9391b557..d4ef5879 100644
--- a/src/requests/getLandingStatus.tsx
+++ b/src/requests/getLandingStatus.tsx
@@ -1,9 +1,9 @@
-import { API_ROOT, SportTypes } from 'config'
+import { API_ROOT } from 'config'
import { callApi } from 'helpers'
type Args = {
matchId: number,
- sportType: SportTypes,
+ sportType: number,
}
export const getLandingStatus = async ({
diff --git a/src/requests/getMatchEvents.tsx b/src/requests/getMatchEvents.tsx
index f5ffea5b..22f2068c 100644
--- a/src/requests/getMatchEvents.tsx
+++ b/src/requests/getMatchEvents.tsx
@@ -1,7 +1,7 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { Episode, Episodes } from 'requests'
@@ -12,7 +12,7 @@ const proc = PROCEDURES.ott_match_events
type Args = {
matchId: number,
- sportType: SportTypes,
+ sportType: number,
}
type PlayerNames = {
diff --git a/src/requests/getMatchInfo.tsx b/src/requests/getMatchInfo.tsx
index 8ce9b456..230b3f2d 100644
--- a/src/requests/getMatchInfo.tsx
+++ b/src/requests/getMatchInfo.tsx
@@ -1,7 +1,7 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi } from 'helpers'
@@ -24,7 +24,7 @@ export type MatchTournament = {
id: number,
name_eng: string,
name_rus: string,
- sportType: SportTypes,
+ sportType: number,
}
export type VideoBound = {
diff --git a/src/requests/getMatchLastWatchSeconds.tsx b/src/requests/getMatchLastWatchSeconds.tsx
index c1f5d6c1..6f976130 100644
--- a/src/requests/getMatchLastWatchSeconds.tsx
+++ b/src/requests/getMatchLastWatchSeconds.tsx
@@ -1,7 +1,7 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi } from 'helpers'
@@ -18,7 +18,7 @@ export type LastPlayPosition = {
}
export const getMatchLastWatchSeconds = async (
- sportType: SportTypes,
+ sportType: number,
matchId: number,
) => {
const config = {
diff --git a/src/requests/getMatchParticipants.tsx b/src/requests/getMatchParticipants.tsx
index 41848848..edd0e7d1 100644
--- a/src/requests/getMatchParticipants.tsx
+++ b/src/requests/getMatchParticipants.tsx
@@ -1,6 +1,6 @@
import isUndefined from 'lodash/isUndefined'
-import { SportTypes, STATS_API_URL } from 'config'
+import { STATS_API_URL } from 'config'
import { callApi } from 'helpers'
@@ -45,7 +45,7 @@ type GetMatchParticipantsArgs = {
matchId: number,
period?: number,
second?: number,
- sportType: SportTypes,
+ sportType: number,
}
export const getMatchParticipants = async ({
diff --git a/src/requests/getMatchPlaylists.tsx b/src/requests/getMatchPlaylists.tsx
index 2c13bd00..cfe69192 100644
--- a/src/requests/getMatchPlaylists.tsx
+++ b/src/requests/getMatchPlaylists.tsx
@@ -3,7 +3,7 @@ import isEmpty from 'lodash/isEmpty'
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi, getSportLexic } from 'helpers'
@@ -13,7 +13,7 @@ type Args = {
fullMatchDuration?: number,
matchId: number,
selectedActions: Array,
- sportType: SportTypes,
+ sportType: number,
withFullMatchDuration?: boolean,
}
diff --git a/src/requests/getMatches/getPlayerMatches.tsx b/src/requests/getMatches/getPlayerMatches.tsx
index 5209179b..5e181474 100644
--- a/src/requests/getMatches/getPlayerMatches.tsx
+++ b/src/requests/getMatches/getPlayerMatches.tsx
@@ -1,7 +1,7 @@
import {
API_ROOT,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { client } from 'config/clients'
@@ -19,7 +19,7 @@ type Args = {
offset: number,
p_match_completed?: boolean,
playerId: number,
- sportType: SportTypes,
+ sportType: number,
sub_only?: boolean,
}
diff --git a/src/requests/getMatches/getTeamMatches.tsx b/src/requests/getMatches/getTeamMatches.tsx
index f199b430..2501e9aa 100644
--- a/src/requests/getMatches/getTeamMatches.tsx
+++ b/src/requests/getMatches/getTeamMatches.tsx
@@ -1,7 +1,7 @@
import {
API_ROOT,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { client } from 'config/clients'
@@ -17,7 +17,7 @@ const proc = PROCEDURES.get_team_matches
type Args = {
limit: number,
offset: number,
- sportType: SportTypes,
+ sportType: number,
teamId: number,
}
diff --git a/src/requests/getMatches/getTournamentMatches.tsx b/src/requests/getMatches/getTournamentMatches.tsx
index f5ab8770..2e09f143 100644
--- a/src/requests/getMatches/getTournamentMatches.tsx
+++ b/src/requests/getMatches/getTournamentMatches.tsx
@@ -1,7 +1,7 @@
import {
API_ROOT,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { client } from 'config/clients'
@@ -17,7 +17,7 @@ const proc = PROCEDURES.get_tournament_matches
type Args = {
limit: number,
offset: number,
- sportType: SportTypes,
+ sportType: number,
tournamentId: number,
}
diff --git a/src/requests/getMatches/types.tsx b/src/requests/getMatches/types.tsx
index 4bf9265e..e6afa9f6 100644
--- a/src/requests/getMatches/types.tsx
+++ b/src/requests/getMatches/types.tsx
@@ -1,5 +1,3 @@
-import { SportTypes } from 'config'
-
type AwsTeamMedia = {
cover_url: string | null,
logo_url: string | null,
@@ -16,7 +14,7 @@ export type TournamentType = {
media?: AwsTournamentMedia,
name_eng: string,
name_rus: string,
- sportType: SportTypes,
+ sportType: number,
}
type Team = {
@@ -51,7 +49,7 @@ export type Match = {
live: boolean,
preview?: string,
previewURL?: string,
- sport: SportTypes,
+ sport: number,
sport_info: SportInfo,
/** наличие завершенного hls стрима */
storage: boolean,
diff --git a/src/requests/getMatchesPreviewImages.tsx b/src/requests/getMatchesPreviewImages.tsx
index 702f3b3c..6842495d 100644
--- a/src/requests/getMatchesPreviewImages.tsx
+++ b/src/requests/getMatchesPreviewImages.tsx
@@ -1,9 +1,9 @@
-import { API_ROOT, SportTypes } from 'config'
+import { API_ROOT } from 'config'
import { callApi } from 'helpers'
type Match = {
match_id: number,
- sport_id: SportTypes,
+ sport_id: number,
}
export type PreviewsData = Array
@@ -11,7 +11,7 @@ export type PreviewsData = Array
type Preview = {
match_id: number,
preview: string,
- sport_id: SportTypes,
+ sport_id: number,
}
export type Previews = Array
diff --git a/src/requests/getPlayerInfo.tsx b/src/requests/getPlayerInfo.tsx
index 376add1d..1ce69eca 100644
--- a/src/requests/getPlayerInfo.tsx
+++ b/src/requests/getPlayerInfo.tsx
@@ -1,7 +1,7 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi } from 'helpers'
@@ -34,7 +34,7 @@ export type PlayerProfile = {
export const getPlayerInfo = (
playerId: number,
- sportType: SportTypes,
+ sportType: number,
): Promise => {
const config = {
body: {
diff --git a/src/requests/getPlayerPlaylists.tsx b/src/requests/getPlayerPlaylists.tsx
index 7ac2814a..6216f1ba 100644
--- a/src/requests/getPlayerPlaylists.tsx
+++ b/src/requests/getPlayerPlaylists.tsx
@@ -3,7 +3,7 @@ import isEmpty from 'lodash/isEmpty'
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi, getSportLexic } from 'helpers'
@@ -19,7 +19,7 @@ type Args = {
matchId: number,
playerId: number,
settings?: Settings,
- sportType: SportTypes,
+ sportType: number,
}
type Response = {
diff --git a/src/requests/getProfileColor.tsx b/src/requests/getProfileColor.tsx
index a92792e2..2bdb016a 100644
--- a/src/requests/getProfileColor.tsx
+++ b/src/requests/getProfileColor.tsx
@@ -1,7 +1,7 @@
import {
API_ROOT,
ProfileTypes,
- SportTypes,
+
} from 'config'
import { callApi } from 'helpers'
@@ -23,7 +23,7 @@ type Response = {
type Args = {
profileId: number,
profileType: ProfileTypes,
- sportType: SportTypes,
+ sportType: number,
}
export const getProfileColor = async ({
diff --git a/src/requests/getSearchItems.tsx b/src/requests/getSearchItems.tsx
index 2507a36f..e4853167 100644
--- a/src/requests/getSearchItems.tsx
+++ b/src/requests/getSearchItems.tsx
@@ -1,7 +1,7 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi } from 'helpers'
@@ -26,7 +26,7 @@ export type PlayerTypeFromSearch = {
id: number,
lastname_eng: string,
lastname_rus: string,
- sport: SportTypes,
+ sport: number,
team?: NamedObject,
}
@@ -38,7 +38,7 @@ type Team = {
id: number,
name_eng: string,
name_rus: string,
- sport: SportTypes,
+ sport: number,
}
type Tournament = {
@@ -47,7 +47,7 @@ type Tournament = {
id: number,
name_eng: string,
name_rus: string,
- sport: SportTypes,
+ sport: number,
}
export type SearchItems = {
diff --git a/src/requests/getSportActions.tsx b/src/requests/getSportActions.tsx
index ade5ac3b..2975734d 100644
--- a/src/requests/getSportActions.tsx
+++ b/src/requests/getSportActions.tsx
@@ -1,7 +1,7 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi, getSportLexic } from 'helpers'
@@ -18,7 +18,7 @@ type Response = {
data: Actions,
}
-export const getSportActions = async (sportType: SportTypes) => {
+export const getSportActions = async (sportType: number) => {
const config = {
body: {
params: {},
diff --git a/src/requests/getSportList.tsx b/src/requests/getSportList.tsx
index edb7f7fd..5d0d4709 100644
--- a/src/requests/getSportList.tsx
+++ b/src/requests/getSportList.tsx
@@ -1,18 +1,19 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
} from 'config'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_sport_list
-export type SportList = Array<{
- id: SportTypes,
+export type Sport = {
+ id: number,
lexic: number,
name_eng: string,
name_rus: string,
-}>
+}
+
+export type SportList = Array
export const getSportList = (): Promise => {
const config = {
diff --git a/src/requests/getSportTournaments.tsx b/src/requests/getSportTournaments.tsx
index 73c40882..9d7f0400 100644
--- a/src/requests/getSportTournaments.tsx
+++ b/src/requests/getSportTournaments.tsx
@@ -4,7 +4,7 @@ import map from 'lodash/map'
import {
DATA_URL,
PROCEDURES,
- SportTypes,
+
} from 'config'
import { callApi } from 'helpers'
@@ -24,13 +24,13 @@ export type Tournament = {
name_rus: string,
short_name_eng: string | null,
short_name_rus: string | null,
- sport: SportTypes,
+ sport: number,
tournament_type: number,
}
export type Tournaments = Array
-const getSportTournaments = (sportId: SportTypes): Promise => {
+const getSportTournaments = (sportId: number): Promise => {
const config = {
body: {
params: {
@@ -46,9 +46,9 @@ const getSportTournaments = (sportId: SportTypes): Promise => {
})
}
-export type TournamentsBySports = Partial>
+export type TournamentsBySports = Partial>
-export const getTournamentsBySports = async (sportIds: Array) => {
+export const getTournamentsBySports = async (sportIds: Array) => {
const responses = await Promise.all(map(sportIds, getSportTournaments))
const tournamentsBySports = reduce(
responses,
diff --git a/src/requests/getStatsEvents.tsx b/src/requests/getStatsEvents.tsx
index f6a40344..09b90cea 100644
--- a/src/requests/getStatsEvents.tsx
+++ b/src/requests/getStatsEvents.tsx
@@ -1,4 +1,4 @@
-import { SportTypes, STATS_API_URL } from 'config'
+import { STATS_API_URL } from 'config'
import { callApi } from 'helpers'
@@ -18,7 +18,7 @@ type GetStatsEventsArgs = {
period?: number,
playerId?: number,
second?: number,
- sportType: SportTypes,
+ sportType: number,
teamId: number,
}
diff --git a/src/requests/getSubscriptions.tsx b/src/requests/getSubscriptions.tsx
index e6f86a07..c4b1edbf 100644
--- a/src/requests/getSubscriptions.tsx
+++ b/src/requests/getSubscriptions.tsx
@@ -2,7 +2,6 @@ import {
currencySymbols,
DATA_URL,
PROCEDURES,
- SportTypes,
} from 'config'
import { callApi } from 'helpers'
@@ -64,7 +63,7 @@ export type Season = {
}
export const getSubscriptions = async (
- sport: SportTypes,
+ sport: number,
matchId: number,
): Promise => {
const config = {
diff --git a/src/requests/getUnauthenticatedMatch.tsx b/src/requests/getUnauthenticatedMatch.tsx
index 06264fc6..d10d4eb5 100644
--- a/src/requests/getUnauthenticatedMatch.tsx
+++ b/src/requests/getUnauthenticatedMatch.tsx
@@ -2,7 +2,6 @@ import {
DATA_URL,
PROCEDURES,
ProfileTypes,
- SportTypes,
} from 'config'
import { callApi } from 'helpers'
@@ -26,7 +25,7 @@ export type UnauthenticatedMatch = {
} | null
export const getUnauthenticatedMatch = (
- sportId: SportTypes,
+ sportId: number,
matchId: number,
profileType?: ProfileTypes,
)
diff --git a/src/requests/getUserPreferences.tsx b/src/requests/getUserPreferences.tsx
index d4940e78..b5662009 100644
--- a/src/requests/getUserPreferences.tsx
+++ b/src/requests/getUserPreferences.tsx
@@ -1,14 +1,13 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
} from 'config'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_user_preferences
export type UserPreferences = Array<{
- sport: SportTypes,
+ sport: number,
tournament_id: number,
}>
diff --git a/src/requests/getUserSportFavs.tsx b/src/requests/getUserSportFavs.tsx
index 008019d6..55d772e0 100644
--- a/src/requests/getUserSportFavs.tsx
+++ b/src/requests/getUserSportFavs.tsx
@@ -1,7 +1,6 @@
import {
DATA_URL,
PROCEDURES,
- SportTypes,
ProfileTypes,
} from 'config'
import { callApi } from 'helpers'
@@ -37,7 +36,7 @@ export type Info = {
export type UserFavorite = {
id: number,
info: Info,
- sport: SportTypes,
+ sport: number,
type: ProfileTypes,
}
diff --git a/src/requests/getVideos.tsx b/src/requests/getVideos.tsx
index 4364de67..151e2b01 100644
--- a/src/requests/getVideos.tsx
+++ b/src/requests/getVideos.tsx
@@ -1,7 +1,7 @@
import isEmpty from 'lodash/isEmpty'
import filter from 'lodash/filter'
-import { API_ROOT, SportTypes } from 'config'
+import { API_ROOT } from 'config'
import { callApi } from 'helpers'
const filterByIds = (videos: Videos) => {
@@ -22,7 +22,7 @@ export type Video = {
export type Videos = Array