|
|
|
|
@ -23,6 +23,8 @@ import type { MatchData } from '../../types' |
|
|
|
|
import { PlayerPlaylistFormats } from '../../types' |
|
|
|
|
import { usePlayerClickHandler } from './usePlayerClickHandler' |
|
|
|
|
import { usePlaylistLexics } from './usePlaylistLexics' |
|
|
|
|
import { calculateDuration } from '../../../MatchPage/helpers/fullMatchDuration' |
|
|
|
|
import { useMatchPage } from '../../../MatchPage/store/hooks' |
|
|
|
|
|
|
|
|
|
type ArgsFetchMatchPlaylists = { |
|
|
|
|
id: number, |
|
|
|
|
@ -35,6 +37,7 @@ const initialPlaylists = buildPlaylists(null) |
|
|
|
|
export const useMatchPopup = () => { |
|
|
|
|
const { pathname } = useLocation() |
|
|
|
|
const [match, setMatch] = useState<MatchData>(null) |
|
|
|
|
const { profile } = useMatchPage() |
|
|
|
|
|
|
|
|
|
const [matchPlaylists, setMatchPlaylists] = useState<Playlists>(initialPlaylists) |
|
|
|
|
const { |
|
|
|
|
@ -93,6 +96,7 @@ export const useMatchPopup = () => { |
|
|
|
|
withFullMatchDuration = true, |
|
|
|
|
}: ArgsFetchMatchPlaylists) => { |
|
|
|
|
getMatchPlaylists({ |
|
|
|
|
fullMatchDuration: calculateDuration(profile), |
|
|
|
|
matchId: id, |
|
|
|
|
selectedActions: [], |
|
|
|
|
sportType, |
|
|
|
|
@ -100,7 +104,7 @@ export const useMatchPopup = () => { |
|
|
|
|
}).then(fetchLexics) |
|
|
|
|
.then(buildPlaylists) |
|
|
|
|
.then(setMatchPlaylists) |
|
|
|
|
}, [fetchLexics]) |
|
|
|
|
}, [fetchLexics, profile]) |
|
|
|
|
|
|
|
|
|
const openMatchPopup = (selectedMatch: MatchData) => { |
|
|
|
|
if (!selectedMatch) return |
|
|
|
|
|