|
|
|
|
@ -22,27 +22,6 @@ import { useMatchData } from './useMatchData' |
|
|
|
|
import { useFiltersPopup } from './useFitersPopup' |
|
|
|
|
import { useTabEvents } from './useTabEvents' |
|
|
|
|
|
|
|
|
|
import type { Playlists } from '../../types' |
|
|
|
|
|
|
|
|
|
const addScoresFromPlaylists = ( |
|
|
|
|
profile: MatchInfo, |
|
|
|
|
playlists: Playlists, |
|
|
|
|
): MatchInfo => ( |
|
|
|
|
profile |
|
|
|
|
? { |
|
|
|
|
...profile, |
|
|
|
|
team1: { |
|
|
|
|
...profile?.team1, |
|
|
|
|
score: playlists.score1, |
|
|
|
|
}, |
|
|
|
|
team2: { |
|
|
|
|
...profile?.team2, |
|
|
|
|
score: playlists.score2, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
: null |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
export const useMatchPage = () => { |
|
|
|
|
const [matchProfile, setMatchProfile] = useState<MatchInfo>(null) |
|
|
|
|
const { profileId: matchId, sportType } = usePageParams() |
|
|
|
|
@ -91,10 +70,8 @@ export const useMatchPage = () => { |
|
|
|
|
setFullMatchPlaylistDuration, |
|
|
|
|
} = useMatchData(matchProfile) |
|
|
|
|
|
|
|
|
|
const profile = useMemo( |
|
|
|
|
() => addScoresFromPlaylists(matchProfile, matchPlaylists), |
|
|
|
|
[matchProfile, matchPlaylists], |
|
|
|
|
) |
|
|
|
|
const profile = matchProfile |
|
|
|
|
|
|
|
|
|
const isStarted = useMemo(() => ( |
|
|
|
|
profile?.date |
|
|
|
|
? parseDate(profile.date) < new Date() |
|
|
|
|
|