|
|
|
|
@ -34,6 +34,7 @@ export type SportType = { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type SportTypeName = SportType & { |
|
|
|
|
disabled?: boolean, |
|
|
|
|
name: string, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -63,7 +64,7 @@ type FormType = { |
|
|
|
|
selectedPlayer: PlayerType | null, |
|
|
|
|
selectedSound: Sound | null, |
|
|
|
|
selectedTeam: Team | null, |
|
|
|
|
sport: SportTypeName, |
|
|
|
|
sport: SportTypeName | null, |
|
|
|
|
stats: StatsType, |
|
|
|
|
teamValue: string, |
|
|
|
|
} |
|
|
|
|
@ -74,12 +75,75 @@ const sounds = [ |
|
|
|
|
name: 'No', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: 'Sound 1', |
|
|
|
|
id: 19469, |
|
|
|
|
lexic: 19469, |
|
|
|
|
name: 'Main theme', |
|
|
|
|
src: '/sounds/background_track.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19470, |
|
|
|
|
lexic: 19470, |
|
|
|
|
name: 'First music', |
|
|
|
|
src: 'sounds/1.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19471, |
|
|
|
|
lexic: 19471, |
|
|
|
|
name: 'Basement by Monako', |
|
|
|
|
src: '/sounds/basement by monako Artlist.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19472, |
|
|
|
|
lexic: 19472, |
|
|
|
|
name: 'Buss-it by Yarin Primak', |
|
|
|
|
src: '/sounds/buss-it---instrumental-version by yarin-primak Artlist.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19473, |
|
|
|
|
lexic: 19473, |
|
|
|
|
name: "Can't stop me now by Brightout", |
|
|
|
|
src: |
|
|
|
|
'/sounds/cant-stop-me-now-instrumental-brightout-musicbed-licensed.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19474, |
|
|
|
|
lexic: 19474, |
|
|
|
|
name: 'Follow me by ShyGhy', |
|
|
|
|
src: '/sounds/follow-me-shyghy-musicbed-licensed.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19475, |
|
|
|
|
lexic: 19475, |
|
|
|
|
name: 'Gravity by Stanley Gurvich', |
|
|
|
|
src: '/sounds/gravity by stanley-gurvich Artlist.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19476, |
|
|
|
|
lexic: 19476, |
|
|
|
|
name: 'Light it up by Bloom & the Bliss', |
|
|
|
|
src: |
|
|
|
|
'/sounds/light-it-up-instrumental-bloom-the-bliss-musicbed-licensed.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19477, |
|
|
|
|
lexic: 19477, |
|
|
|
|
name: 'Living future memories by Generdyn', |
|
|
|
|
src: '/sounds/living-future-memories-generdyn-musicbed-licensed.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19478, |
|
|
|
|
lexic: 19478, |
|
|
|
|
name: 'Look at me now by Paper kings', |
|
|
|
|
src: |
|
|
|
|
'/sounds/look-at-me-now-instrumental-paper-kings-musicbed-licensed.mp3', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 19479, |
|
|
|
|
lexic: 19479, |
|
|
|
|
name: 'Unbroken by Roary', |
|
|
|
|
src: '/sounds/unbroken-roary-musicbed-licensed.mp3', |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
const summaryStats = [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
@ -91,6 +155,18 @@ const summaryStats = [ |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
const defaultValues = { |
|
|
|
|
duration: '2', |
|
|
|
|
playerValue: '', |
|
|
|
|
players: [], |
|
|
|
|
selectedPlayer: null, |
|
|
|
|
selectedSound: null, |
|
|
|
|
selectedTeam: null, |
|
|
|
|
sport: null, |
|
|
|
|
stats: summaryStats[1], |
|
|
|
|
teamValue: '', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const useHighlightsForm = () => { |
|
|
|
|
const { playerHighlight } = useUserFavoritesStore() |
|
|
|
|
|
|
|
|
|
@ -98,7 +174,7 @@ export const useHighlightsForm = () => { |
|
|
|
|
const [teams, setTeams] = useState<Array<TeamType>>([]) |
|
|
|
|
const [playersData, setPlayersData] = useState<Array<PlayerType>>([]) |
|
|
|
|
const [players, setPlayers] = useState<Array<PlayerType>>([]) |
|
|
|
|
const [formState, setFormState] = useState<FormType>({} as FormType) |
|
|
|
|
const [formState, setFormState] = useState<FormType>(defaultValues) |
|
|
|
|
const [playerMatches, setPlayerMatches] = useRecoilState(playerMatchesState) |
|
|
|
|
const setDatahighlights = useSetRecoilState(dataForPayHighlights) |
|
|
|
|
|
|
|
|
|
@ -193,13 +269,20 @@ export const useHighlightsForm = () => { |
|
|
|
|
useEffect(() => { |
|
|
|
|
getSportList() |
|
|
|
|
.then((res) => setSports( |
|
|
|
|
res?.map((sport: SportType) => ({ |
|
|
|
|
...sport, |
|
|
|
|
name: sport?.name_eng, |
|
|
|
|
})), |
|
|
|
|
res |
|
|
|
|
?.filter((sport: SportType) => sport.id === 3) |
|
|
|
|
.map((sport: SportType) => ({ |
|
|
|
|
...sport, |
|
|
|
|
name: sport?.name_eng, |
|
|
|
|
})), |
|
|
|
|
)) |
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
onSportSelect(sports[0]) |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [sports]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (playerHighlight?.sportType && playerHighlight?.profile) { |
|
|
|
|
setFormState((state: any) => ({ |
|
|
|
|
@ -215,7 +298,7 @@ export const useHighlightsForm = () => { |
|
|
|
|
}, [sports, playerHighlight, teams]) |
|
|
|
|
|
|
|
|
|
const fetchTeams = useMemo( |
|
|
|
|
() => debounce(() => getSportTeams( |
|
|
|
|
() => debounce(() => formState?.sport?.id && getSportTeams( |
|
|
|
|
formState?.sport?.id, |
|
|
|
|
-1, |
|
|
|
|
formState.teamValue, |
|
|
|
|
|