diff --git a/src/features/MatchPage/store/hooks/useMatchData.tsx b/src/features/MatchPage/store/hooks/useMatchData.tsx index 4696407a..54df0d61 100644 --- a/src/features/MatchPage/store/hooks/useMatchData.tsx +++ b/src/features/MatchPage/store/hooks/useMatchData.tsx @@ -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({ diff --git a/src/features/MatchPopup/store/hooks/index.tsx b/src/features/MatchPopup/store/hooks/index.tsx index a563f377..b5ac41e7 100644 --- a/src/features/MatchPopup/store/hooks/index.tsx +++ b/src/features/MatchPopup/store/hooks/index.tsx @@ -115,6 +115,7 @@ export const useMatchPopup = () => { } return { actions, + chapters, closePopup, fetchMatchPlaylists, fetchSportActions,