diff --git a/src/features/MatchesGrid/index.tsx b/src/features/MatchesGrid/index.tsx index 0f1b16b6..415e4384 100644 --- a/src/features/MatchesGrid/index.tsx +++ b/src/features/MatchesGrid/index.tsx @@ -23,21 +23,28 @@ export const MatchesGrid = memo(({ matches }: MatchesGridProps) => { selectedLeague, } = useHeaderFiltersStore() - const filteredMatches = isHomePage && selectedFilters.length - ? matches.filter((match) => ( - ((match.live - && selectedFilters.indexOf('live') >= 0) - || (selectedFilters.indexOf('upcoming') >= 0 && match.date > new Date()) - || (selectedFilters.indexOf('completed') >= 0 && match.is_finished)))) - : matches + const filteredMatches = () => { + if (isHomePage && selectedFilters.length && isShowTournament) { + return matches.filter( + (match) => (match.live && selectedFilters.indexOf('live') >= 0) + || (selectedFilters.indexOf('upcoming') >= 0 + && match.date > new Date()) + || (selectedFilters.indexOf('completed') >= 0 && match.is_finished), + ) + } + if (isHomePage && selectedLeague.length && !isShowTournament) { + return matches.filter((match) => ((selectedLeague.indexOf(match.tournament.id) >= 0 + || selectedLeague[0] === 'all_competitions'))) + } + return matches + } return ( {isHomePage && isShowTournament ? ( - + ) : ( - filteredMatches.filter((match) => ((selectedLeague.indexOf(match.tournament.id) >= 0 - || selectedLeague[0] === 'all_competitions'))).map((match) => ) + filteredMatches().map((match) => ) )} )