|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import { useMemo } from 'react' |
|
|
|
|
import { useMemo, useCallback } from 'react' |
|
|
|
|
|
|
|
|
|
import isNumber from 'lodash/isNumber' |
|
|
|
|
import format from 'date-fns/format' |
|
|
|
|
@ -30,13 +30,24 @@ export const useFilters = () => { |
|
|
|
|
|
|
|
|
|
const [ |
|
|
|
|
selectedMatchStatus, |
|
|
|
|
setSelectedMatchStatus, |
|
|
|
|
] = useQueryParamStore({ |
|
|
|
|
defaultValue: MatchStatuses.Live, |
|
|
|
|
setMatchStatus, |
|
|
|
|
] = useQueryParamStore<MatchStatuses | null>({ |
|
|
|
|
defaultValue: null, |
|
|
|
|
key: filterKeys.MATCH_STATUS, |
|
|
|
|
validator: isValidMatchStatus, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const setSelectedMatchStatus = useCallback((status: MatchStatuses) => { |
|
|
|
|
if (status === selectedMatchStatus) { |
|
|
|
|
setMatchStatus(null) |
|
|
|
|
} else { |
|
|
|
|
setMatchStatus(status) |
|
|
|
|
} |
|
|
|
|
}, [ |
|
|
|
|
selectedMatchStatus, |
|
|
|
|
setMatchStatus, |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
const [ |
|
|
|
|
selectedSportTypeId, |
|
|
|
|
setSelectedSportTypeId, |
|
|
|
|
|