develop #277

Merged
andrey.dekterev merged 5 commits from develop into master 2 years ago
  1. 19
      src/components/Ads/components/AdComponent/hooks.tsx
  2. 6
      src/components/Ads/components/MobileAd/styled.tsx
  3. 6
      src/features/AuthStore/helpers.tsx
  4. 11
      src/features/AuthStore/hooks/useAuth.tsx
  5. 15
      src/features/HeaderFilters/components/DateFilter/hooks/index.tsx
  6. 2
      src/features/HeaderFilters/components/DateFilter/index.tsx
  7. 2
      src/features/HeaderFilters/components/FacrDateFilter/index.tsx
  8. 4
      src/features/MatchPage/store/hooks/usePlayersStats.tsx
  9. 5
      src/features/MatchPage/store/hooks/useStatsTab.tsx
  10. 2
      src/features/MatchPage/store/hooks/useTeamsStats.tsx
  11. 6
      src/features/UserAccount/components/PagePersonalInfo/hooks/index.tsx

@ -27,8 +27,10 @@ import {
const countryCode = getLocalStorageItem(COUNTRY)
export const useAd = ({ ad }: AdComponentType) => {
const [isOpenAd, setIsOpenAd] = useState(true)
const [isNeedToShow, setIsNeedToShow] = useState(true)
const isMatch = isMatchPage()
const [isOpenAd, setIsOpenAd] = useState(isMatch)
const [isNeedToShow, setIsNeedToShow] = useState(isMatch)
const [shownTime, setShownTime] = useState(0)
const { isFullscreen } = useMatchPageStore()
@ -72,7 +74,7 @@ export const useAd = ({ ad }: AdComponentType) => {
const handleClose = () => {
setIsOpenAd(false)
isMatchPage() && setIsNeedToShow(false)
isMatch && setIsNeedToShow(false)
sendBannerClickEvent(EventGA.CLOSE)
}
@ -89,7 +91,7 @@ export const useAd = ({ ad }: AdComponentType) => {
useEffect(() => {
setShownTime(0)
if (isMatchPage()) {
if (isMatch) {
const interval = setInterval(() => {
setIsNeedToShow(true)
setIsOpenAd(true)
@ -105,6 +107,7 @@ export const useAd = ({ ad }: AdComponentType) => {
isNeedToShow,
views?.HOME,
isNeedBanner,
isMatch,
])
useEffect(() => {
@ -136,14 +139,18 @@ export const useAd = ({ ad }: AdComponentType) => {
])
useEffect(() => {
if (!isNeedToShow || (!isMatchPage() && !isNeedBanner)) return
if (!isNeedToShow || (!isMatch && !isNeedBanner)) return
(async () => {
await updateAdsView({ adv_id: id })
})()
sendBannerClickEvent(EventGA.DISPLAY)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, isNeedToShow])
}, [
id,
isNeedToShow,
isMatch,
])
return {
handleClose,

@ -9,6 +9,7 @@ import {
PLAYER_MOBILE_FULL_SCREEN,
PLAYER_MOBILE_ADS,
MATCH_PAGE_MOBILE_ADS,
VIEW_ADS,
} from '../../types'
type Props = {
@ -40,6 +41,9 @@ const chooseStyle = (type: number) => {
padding: 5px;
background-color: rgba(0, 0, 0, 0.7);
`
case VIEW_ADS.MOBILE_IN_COLLAPSE_FOOTER:
case VIEW_ADS.MOBILE_IN_COLLAPSE_HEADER:
return 'margin-top: 6px'
default:
return ''
}
@ -48,7 +52,7 @@ const chooseStyle = (type: number) => {
export const MobileAdWrapper = styled.div<Props>`
position: relative;
width: 100%;
z-index: ${({ position }) => (includes(PLAYER_MOBILE_FULL_SCREEN, position) ? '101' : '100')};
z-index: ${({ position }) => (includes(PLAYER_MOBILE_FULL_SCREEN, position) ? '101' : '4')};
${({ position }) => chooseStyle(position)};
`

@ -54,11 +54,11 @@ const redirectUrl = () => {
// @ts-ignore
|| Boolean(clientsForRedirect[client.name])
):
return `${window.origin}/redirect`
return `${window.origin}`
case (ENV === 'staging' || ENV === 'preproduction'):
return `https://${stageENV}.insports.tv/redirect`
return `https://${stageENV}.insports.tv`
default:
return `https://${clientName}.tv/redirect`
return `https://${clientName}.tv`
}
}

@ -158,6 +158,8 @@ export const useAuth = () => {
}
const signinRedirectCallback = useCallback(() => {
setPage(history.location.pathname)
userManager.signinRedirectCallback()
.then((loadedUser) => {
storeUser(loadedUser)
@ -171,7 +173,6 @@ export const useAuth = () => {
markUserLoaded()
setPage('')
setSearch('')
// }
}).catch(login)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
@ -181,7 +182,13 @@ export const useAuth = () => {
])
useEffect(() => {
const isRedirectedBackFromAuthProvider = history.location.pathname === '/redirect'
const urlSearch = new URLSearchParams(history.location.search)
const searchToken = urlSearch.get('access_token')
const searchRefToken = urlSearch.get('id_token')
const searchExp = urlSearch.get('expires_in')
const isRedirectedBackFromAuthProvider = Boolean(searchToken && searchRefToken && searchExp)
isRedirectedBackFromAuthProvider ? signinRedirectCallback() : checkUser()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [

@ -74,6 +74,13 @@ export const useDateFilter = () => {
validator,
})
const addAdsViews = () => {
setAdsViews({
...adsViews,
HOME: (adsViews.HOME ?? 0) + 1,
})
}
useEffect(() => {
if (lastDate === selectedDate.getDate()
&& parseFilters
@ -85,20 +92,18 @@ export const useDateFilter = () => {
setIsShowTournament(true)
setSelectedFilters([])
setSelectedLeague(['all_competitions'])
setAdsViews({
...adsViews,
HOME: (adsViews.HOME ?? 0) + 1,
})
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedDate])
const onPreviousClick = () => {
addAdsViews()
const numberAddDays = weekName === 'Mon' ? -1 : -7
setSelectedDate(addDays(selectedDate, numberAddDays))
}
const onNextClick = () => {
addAdsViews()
const numberAddDays = weekName === 'Sun' ? 1 : 7
setSelectedDate(addDays(selectedDate, numberAddDays))
}
@ -108,6 +113,7 @@ export const useDateFilter = () => {
const onDateChange = (newDate: Date | null) => {
if (newDate) {
addAdsViews()
setSelectedDate(newDate)
close()
}
@ -119,6 +125,7 @@ export const useDateFilter = () => {
}
return {
addAdsViews,
close,
date,
isMonthMode,

@ -26,6 +26,7 @@ import { useHeaderFiltersStore } from '../../store'
export const DateFilter = () => {
const {
addAdsViews,
close,
date,
isOpen,
@ -72,6 +73,7 @@ export const DateFilter = () => {
selected={day.date.getDate() === selectedDate.getDate()}
onClick={() => {
if (day.date.getDate() !== selectedDate.getDate()) {
addAdsViews()
onWeekDayClick(day.date)
} else {
resetFilters()

@ -38,6 +38,7 @@ import {
export const FacrDateFilter = () => {
const {
addAdsViews,
close,
date,
isMonthMode,
@ -151,6 +152,7 @@ export const FacrDateFilter = () => {
selected={day.date.getDate() === selectedDate.getDate()}
onClick={() => {
if (day.date.getDate() !== selectedDate.getDate()) {
addAdsViews()
onWeekDayClick(day.date)
} else {
resetFilters()

@ -147,9 +147,6 @@ export const usePlayersStats = ({
|| !includes([StatsTabs.TEAM1, StatsTabs.TEAM2], selectedStatsTable)
|| !matchProfile?.team1.id
|| !matchProfile?.team2.id
|| (!matchProfile?.live && !isCurrentStats && !isEmpty(playersStats[isTeam1Selected
? matchProfile.team1.id
: matchProfile.team2.id]))
) return
const [res1, res2] = await Promise.all([
@ -201,7 +198,6 @@ export const usePlayersStats = ({
fakeData,
selectedTab,
selectedStatsTable,
isCurrentStats,
])
const beforeCloseTourCallback = () => {

@ -63,8 +63,9 @@ export const useStatsTab = ({
const newStatsType = isFinalStatsType ? StatsType.CURRENT_STATS : StatsType.FINAL_STATS
setStatsType(newStatsType)
setIsTeamsStatsFetching(true)
setIsPlayersStatsFetching(true)
selectedStatsTable === StatsTabs.TEAMS
? setIsTeamsStatsFetching(true)
: setIsPlayersStatsFetching(true)
}
const getEpisodesToPlay = (episodes: Episodes) => map(episodes, (episode, i) => ({

@ -100,7 +100,6 @@ export const useTeamsStats = ({
|| !videoBounds
|| selectedTab !== Tabs.STATS
|| selectedStatsTable !== StatsTab.TEAMS
|| (!matchProfile?.live && !isCurrentStats && !isEmpty(teamsStats))
) return
try {
@ -131,7 +130,6 @@ export const useTeamsStats = ({
getFirstClickableParam,
selectedTab,
selectedStatsTable,
isCurrentStats,
])
const beforeCloseTourCallback = () => {

@ -78,13 +78,15 @@ export const useUserInfo = () => {
setLoader(true)
saveUserInfo(data).then(() => {
fetchUserInfo()
}).finally(() => {
const lang_iso = find(languageList, (language) => language.id === data.language_id)?.iso_639_1
if (lang_iso) {
changeLang(lang_iso)
}
}).finally(() => setLoader(false))
setLoader(false)
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fetchUserInfo])

Loading…
Cancel
Save