|
|
|
|
@ -1,9 +1,14 @@ |
|
|
|
|
import { useEffect, useState } from 'react' |
|
|
|
|
|
|
|
|
|
import { useSportNameParam, usePageId } from 'hooks' |
|
|
|
|
|
|
|
|
|
import type { Matches } from 'requests' |
|
|
|
|
import { getMatches } from 'requests' |
|
|
|
|
import type { PlayerProfile } from 'requests/getPlayerInfo' |
|
|
|
|
import { getPlayerInfo } from 'requests/getPlayerInfo' |
|
|
|
|
import { useSportNameParam, usePageId } from 'hooks' |
|
|
|
|
|
|
|
|
|
import { useLexicsStore } from 'features/LexicsStore' |
|
|
|
|
import { useHeaderFiltersStore } from 'features/HeaderFilters' |
|
|
|
|
|
|
|
|
|
type Firstname = 'firstname_eng' | 'firstname_rus' |
|
|
|
|
type Lastname = 'lastname_eng' | 'lastname_rus' |
|
|
|
|
@ -14,6 +19,10 @@ export const usePlayerPage = () => { |
|
|
|
|
const { sportType } = useSportNameParam() |
|
|
|
|
const pageId = usePageId() |
|
|
|
|
const { suffix, translate } = useLexicsStore() |
|
|
|
|
const { |
|
|
|
|
selectedDateFormatted, |
|
|
|
|
selectedMatchStatus, |
|
|
|
|
} = useHeaderFiltersStore() |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
club_team, |
|
|
|
|
@ -36,8 +45,30 @@ export const usePlayerPage = () => { |
|
|
|
|
getPlayerInfo(pageId, sportType).then(setPlayerProfile) |
|
|
|
|
}, [pageId, sportType]) |
|
|
|
|
|
|
|
|
|
const [matches, setMatches] = useState<Matches>({ |
|
|
|
|
broadcast: [], |
|
|
|
|
features: [], |
|
|
|
|
highlights: [], |
|
|
|
|
isVideoSections: false, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
getMatches({ |
|
|
|
|
date: selectedDateFormatted, |
|
|
|
|
matchStatus: selectedMatchStatus, |
|
|
|
|
playerId: pageId, |
|
|
|
|
sportType, |
|
|
|
|
}).then(setMatches) |
|
|
|
|
}, [ |
|
|
|
|
pageId, |
|
|
|
|
selectedDateFormatted, |
|
|
|
|
selectedMatchStatus, |
|
|
|
|
sportType, |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
infoItems, |
|
|
|
|
matches, |
|
|
|
|
name: fullName, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|