feat(ott-193): players matches (#106)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Armen 5 years ago committed by GitHub
parent 234d186b34
commit d7d9266409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/features/Burger/styled.tsx
  2. 1
      src/features/HomePage/hooks.tsx
  3. 2
      src/features/Modal/index.tsx
  4. 33
      src/features/PlayerPage/hooks.tsx
  5. 3
      src/features/PlayerPage/index.tsx
  6. 1
      src/features/TeamPage/hooks.tsx
  7. 1
      src/features/TournamentPage/hooks.tsx
  8. 11
      src/requests/getMatches.tsx

@ -50,4 +50,4 @@ export const StyledBurger = styled.div<{open: boolean}>`
background-size: 100%;
background-image: url(/images/userAccount.svg);
}
`;
`

@ -25,7 +25,6 @@ export const useHomePage = () => {
date: selectedDateFormatted,
matchStatus: selectedMatchStatus,
sportType: selectedSportTypeId,
teamId: null,
tournamentId: selectedTournamentId,
}).then(setMatches)
}, [

@ -35,4 +35,4 @@ export const Modal = ({
modalRoot.current as Element,
)
: null
};
}

@ -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,
}
}

@ -3,12 +3,14 @@ import React, { Fragment } from 'react'
import { ProfileTypes } from 'config'
import { UserFavorites } from 'features/UserFavorites'
import { ProfileCard } from 'features/ProfileCard'
import { Matches } from 'features/Matches'
import { usePlayerPage } from './hooks'
export const PlayerPage = () => {
const {
infoItems,
matches,
name,
} = usePlayerPage()
@ -20,6 +22,7 @@ export const PlayerPage = () => {
name={name}
infoItems={infoItems}
/>
<Matches matches={matches} />
</Fragment>
)
}

@ -51,7 +51,6 @@ export const useTeamPage = () => {
matchStatus: selectedMatchStatus,
sportType,
teamId,
tournamentId: null,
}).then(setMatches)
}, [
selectedDateFormatted,

@ -50,7 +50,6 @@ export const useTournamentPage = () => {
date: selectedDateFormatted,
matchStatus: selectedMatchStatus,
sportType,
teamId: null,
tournamentId,
}).then(setMatches)
}, [

@ -52,9 +52,10 @@ export type Team = {
type Args = {
date: string,
matchStatus: MatchStatuses,
playerId?: number | null,
sportType: SportTypes | null,
teamId: number | null,
tournamentId: number | null,
teamId?: number | null,
tournamentId?: number | null,
}
export type Matches = {
@ -67,6 +68,7 @@ export type Matches = {
export const getMatches = async ({
date,
matchStatus,
playerId,
sportType,
teamId,
tournamentId,
@ -75,10 +77,11 @@ export const getMatches = async ({
body: {
params: {
_p_date: date,
_p_player_id: playerId || null,
_p_sport: sportType,
_p_stream_status: matchStatus,
_p_team_id: teamId,
_p_tournament_id: tournamentId,
_p_team_id: teamId || null,
_p_tournament_id: tournamentId || null,
},
proc,
},

Loading…
Cancel
Save