|
|
|
|
@ -7,7 +7,9 @@ import { MatchInfo } from 'requests/getMatchInfo' |
|
|
|
|
import { usePageParams } from 'hooks/usePageParams' |
|
|
|
|
import { useInterval } from 'hooks/useInterval' |
|
|
|
|
|
|
|
|
|
import { calculateDuration } from '../../helpers/fullMatchDuration' |
|
|
|
|
import { useDuration } from 'features/MultiSourcePlayer/hooks/useDuration' |
|
|
|
|
import { useMatchPopupStore } from 'features/MatchPopup' |
|
|
|
|
|
|
|
|
|
import { useMatchPlaylists } from './useMatchPlaylists' |
|
|
|
|
import { useEvents } from './useEvents' |
|
|
|
|
|
|
|
|
|
@ -16,6 +18,7 @@ const MATCH_PLAYLISTS_DELAY = 5000 |
|
|
|
|
|
|
|
|
|
export const useMatchData = (profile: MatchInfo) => { |
|
|
|
|
const { profileId: matchId, sportType } = usePageParams() |
|
|
|
|
const { chapters } = useMatchPopupStore() |
|
|
|
|
const { |
|
|
|
|
fetchMatchPlaylists, |
|
|
|
|
handlePlaylistClick, |
|
|
|
|
@ -29,9 +32,7 @@ export const useMatchData = (profile: MatchInfo) => { |
|
|
|
|
() => debounce(fetchMatchPlaylists, MATCH_PLAYLISTS_DELAY), |
|
|
|
|
[fetchMatchPlaylists], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const fullMatchDuration = useMemo(() => calculateDuration(profile), [profile]) |
|
|
|
|
|
|
|
|
|
const fullMatchDuration = useDuration(chapters) / 1000 |
|
|
|
|
useEffect(() => { |
|
|
|
|
if (!profile) return |
|
|
|
|
fetchMatchPlaylists({ |
|
|
|
|
|