fix(#274): fix matches for another languages

pull/72/head
Andrei Dekterev 3 years ago
parent 6d88197ac3
commit a47ccbbe3e
  1. 4
      src/features/HomePage/hooks.tsx
  2. 11
      src/features/UserFavorites/hooks/index.tsx
  3. 11
      src/features/UserFavorites/index.tsx

@ -34,7 +34,7 @@ const getTimezoneOffset = (date: Date) => {
const getDate = (date: Date) => format(date, 'yyyy-MM-dd')
export const useHomePage = () => {
const { userInfo } = useAuthStore()
const { user, userInfo } = useAuthStore()
const { selectedDate } = useHeaderFiltersStore()
const [isOpenDownload, setIsOpenDownload] = useState(false)
const [isShowConfirmPopup, setIsShowConfirmPopup] = useState(false)
@ -75,7 +75,7 @@ export const useHomePage = () => {
timezoneOffset: getTimezoneOffset(selectedDate),
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[selectedDate, userInfo?.email],
[selectedDate, user],
)
useEffect(() => {

@ -1,5 +1,6 @@
import {
useCallback,
useEffect,
useMemo,
useState,
} from 'react'
@ -42,7 +43,7 @@ export type SuperTournament = ObjectWithName & {
type Args = Parameters<typeof modifyUserFavorites>[0]
export const useUserFavorites = () => {
const { userInfo } = useAuthStore()
const { user, userInfo } = useAuthStore()
const [userFavorites, setUserFavorites] = useState<UserFavorites>([])
const [playerHighlight, setPlayerHighlight] = useState<ProfileType>({} as ProfileType)
@ -97,6 +98,14 @@ export const useUserFavorites = () => {
})
}
useEffect(() => {
if (!user) return
fetchFavorites()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fetchFavorites])
const addRemoveFavorite = (args: Args) => {
modifyUserFavorites(args).then(setUserFavorites, open)
}

@ -1,7 +1,6 @@
import {
MouseEvent,
FocusEvent,
useEffect,
useState,
} from 'react'
@ -29,8 +28,6 @@ import {
ScrollWrapper,
} from './styled'
import { useAuthStore } from '../AuthStore'
type Props = {
marginTop?: number,
}
@ -39,22 +36,14 @@ export const UserFavorites = ({ marginTop }: Props) => {
const {
addRemoveFavorite,
close,
fetchFavorites,
isOpen,
removeSuperTournament,
superTournaments,
userFavorites,
} = useUserFavoritesStore()
const { user } = useAuthStore()
const [position, setPosition] = useState(0)
useEffect(() => {
if (!user) return
fetchFavorites()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fetchFavorites])
const getPosition = (event: MouseEvent<HTMLDivElement> | FocusEvent<HTMLDivElement>) => {
if (event.currentTarget) {
setPosition(event.currentTarget.getBoundingClientRect().top)

Loading…
Cancel
Save