From d213d4bb6574dc38aff9745b9ea0d49e30329fc9 Mon Sep 17 00:00:00 2001 From: ivamach Date: Thu, 2 May 2024 18:49:28 +0200 Subject: [PATCH] SMA-105: places are now search by input from the searchbar --- frontend/sportsmatch-app/src/pages/Index.tsx | 27 ++++++++------------ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/frontend/sportsmatch-app/src/pages/Index.tsx b/frontend/sportsmatch-app/src/pages/Index.tsx index 2103561..6849cbd 100644 --- a/frontend/sportsmatch-app/src/pages/Index.tsx +++ b/frontend/sportsmatch-app/src/pages/Index.tsx @@ -47,6 +47,7 @@ export default function MainPage() { selectedSports, 0, 0, + searchQuery, page, size, ) @@ -70,7 +71,7 @@ export default function MainPage() { } // call the method fetchData() - }, [selectedSports, page]) + }, [selectedSports, page, searchQuery]) // handle join event pop up after cliking on the event const handleEventSelection = (e: EventDTO) => { @@ -140,21 +141,15 @@ export default function MainPage() { {filteredEvent.length === 0 ? ( ) : ( - filteredEvent - .filter((e) => - e.placeDTO.name - .toLowerCase() - .includes(searchQuery.toLowerCase()), - ) - .map((event, index) => ( -
handleEventSelection(event)} - > - -
- )) + filteredEvent.map((event, index) => ( +
handleEventSelection(event)} + > + +
+ )) )}