|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
import { |
|
|
|
|
useState, |
|
|
|
|
useCallback, |
|
|
|
|
useEffect, |
|
|
|
|
} from 'react' |
|
|
|
|
|
|
|
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
|
|
@ -10,6 +11,8 @@ import type { SportTypes } from 'config/sportTypes' |
|
|
|
|
import { MatchInfo } from 'requests/getMatchInfo' |
|
|
|
|
import { getMatchPlaylists } from 'requests/getMatchPlaylists' |
|
|
|
|
|
|
|
|
|
import { usePageParams } from 'hooks/usePageParams' |
|
|
|
|
|
|
|
|
|
import type { Playlists } from 'features/MatchPage/types' |
|
|
|
|
import { buildPlaylists } from 'features/MatchPage/helpers/buildPlaylists' |
|
|
|
|
|
|
|
|
|
@ -28,6 +31,7 @@ export const useMatchPlaylists = (profile: MatchInfo) => { |
|
|
|
|
const [matchPlaylists, setMatchPlaylists] = useState<Playlists>(initialPlaylists) |
|
|
|
|
|
|
|
|
|
const { fetchLexics } = usePlaylistLexics() |
|
|
|
|
const { profileId } = usePageParams() |
|
|
|
|
const { |
|
|
|
|
handlePlaylistClick, |
|
|
|
|
selectedPlaylist, |
|
|
|
|
@ -60,6 +64,14 @@ export const useMatchPlaylists = (profile: MatchInfo) => { |
|
|
|
|
.then(setMatchPlaylists) |
|
|
|
|
}, [fetchLexics, setInitialSeletedPlaylist]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
setSelectedPlaylist(matchPlaylists?.match[0]) |
|
|
|
|
}, [ |
|
|
|
|
matchPlaylists?.match, |
|
|
|
|
profileId, |
|
|
|
|
setSelectedPlaylist, |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* API не выдает длительность Полного матча |
|
|
|
|
* Здесь получаем его из самого видео |
|
|
|
|
|