This PR focuses on implementing a way to search for clubs on the Browse tab. Originally, the user could only enter a search term and get a list of books matching that search term, but now the user can get a list of clubs based on the search term as well.
A new ClubSearchList was added to perform the search for Clubs by using a new ClubSearchServlet with prefix matching based on the name of the clubs.
Breakdown
Create ClubSearchServlet to perform prefix string matching on the club names
Gets a list of all clubs matching the search query which is called when the user types in a search term
Added menu to toggle between search for Books, Clubs, and Users
Users is currently just a stub
Made browse a stateful component
Added headers so the user knows what they are searching for: searching for Books with "searchTerm"
Moved retrieval of searchedBooks to the Browse component since it is being used by ClubSearchList and BookSearchList
Made BookSearchList a stateless functional component, it just takes in a list of Book items to display now
ClubSearchList has 2 different searches
Prefix matching of names of clubs
Takes in books from searchedBooks and checks if any clubs contain those books that were fetched
Minor fixes
Added loading spinners for the Browse page while it is waiting for the data to be returned
Added img-fluid on BookPage and BookSearchTile to prevent overlapping elements due to thumbnail size
Main Difficulties
I decided to create a new ClubSearchServlet instead of adding an if-check to the original ClubServlet because I did not want to make it too cluttered. This ClubSearch is not likely to be used extensively across the application, while the doGet inside the ClubServlet is used in many places.
I decided to make Browse a stateful component since it needed to fetch and store the books that would be required by the BookSearchList and ClubSearchList.
Screenshot of Feature
This is the new default search view when someone enters a new search term into the box.
This is the new club search view when the user clicks on the Clubs tab!
Description
This PR focuses on implementing a way to search for clubs on the Browse tab. Originally, the user could only enter a search term and get a list of books matching that search term, but now the user can get a list of clubs based on the search term as well.
A new ClubSearchList was added to perform the search for Clubs by using a new ClubSearchServlet with prefix matching based on the name of the clubs.
Breakdown
Main Difficulties
I decided to create a new ClubSearchServlet instead of adding an if-check to the original ClubServlet because I did not want to make it too cluttered. This ClubSearch is not likely to be used extensively across the application, while the doGet inside the ClubServlet is used in many places.
I decided to make Browse a stateful component since it needed to fetch and store the books that would be required by the BookSearchList and ClubSearchList.
Screenshot of Feature
This is the new default search view when someone enters a new search term into the box.
This is the new club search view when the user clicks on the Clubs tab!
Mobile view updated to work with the new tabs.