|
|
|
|
@ -36,9 +36,7 @@ import { getLocalStorageItem } from 'helpers/getLocalStorage' |
|
|
|
|
|
|
|
|
|
import { useObjectState, usePageParams } from 'hooks' |
|
|
|
|
|
|
|
|
|
import type{ PlaylistOption } from 'features/MatchPage/types' |
|
|
|
|
import { StatsType, Tabs as StatsTabs } from 'features/MatchSidePlaylists/components/TabStats/config' |
|
|
|
|
import { FULL_GAME_KEY } from 'features/MatchPage/helpers/buildPlaylists' |
|
|
|
|
import { getHalfTime } from 'features/MatchPage/helpers/getHalfTime' |
|
|
|
|
import { TOUR_COMPLETED_STORAGE_KEY } from 'features/MatchTour' |
|
|
|
|
import { Tabs } from 'features/MatchSidePlaylists/config' |
|
|
|
|
@ -52,7 +50,6 @@ const STATS_POLL_INTERVAL = 30000 |
|
|
|
|
type UsePlayersStatsArgs = { |
|
|
|
|
matchProfile: MatchInfo, |
|
|
|
|
playingProgress: number, |
|
|
|
|
selectedPlaylist?: PlaylistOption, |
|
|
|
|
selectedStatsTable: StatsTabs, |
|
|
|
|
selectedTab: Tabs, |
|
|
|
|
setIsPlayersStatsFetching: Dispatch<SetStateAction<boolean>>, |
|
|
|
|
@ -67,7 +64,6 @@ type PlayersData = { |
|
|
|
|
export const usePlayersStats = ({ |
|
|
|
|
matchProfile, |
|
|
|
|
playingProgress, |
|
|
|
|
selectedPlaylist, |
|
|
|
|
selectedStatsTable, |
|
|
|
|
selectedTab, |
|
|
|
|
setIsPlayersStatsFetching, |
|
|
|
|
@ -147,8 +143,7 @@ export const usePlayersStats = ({ |
|
|
|
|
const isTeam1Selected = selectedStatsTable === StatsTabs.TEAM1 |
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
selectedPlaylist?.id !== FULL_GAME_KEY |
|
|
|
|
|| selectedTab !== Tabs.STATS |
|
|
|
|
selectedTab !== Tabs.STATS |
|
|
|
|
|| !includes([StatsTabs.TEAM1, StatsTabs.TEAM2], selectedStatsTable) |
|
|
|
|
|| !matchProfile?.team1.id |
|
|
|
|
|| !matchProfile?.team2.id |
|
|
|
|
@ -195,7 +190,6 @@ export const usePlayersStats = ({ |
|
|
|
|
setIsPlayersStatsFetching(false) |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, REQUEST_DELAY), [ |
|
|
|
|
selectedPlaylist?.id, |
|
|
|
|
fetchPlayers, |
|
|
|
|
fetchPlayersStats, |
|
|
|
|
setPlayersStats, |
|
|
|
|
|