This PR adds persistent search history functionality, updates the logic of what tree cards to suggest as a search is being typed, and adds more user feedback during different stages of searching.
Search history:
Stores up to 5 tree cards using Async Storage
Tree cards added to "Recents" either when pressed on or when search is entered (first card of submitted search will be added)
If most recent search is searched again, does not get added to history (avoids unnecessary repetition)
Suggested search logic:
As search is typed, list of all tree cards is filtered to only those that contain the current search string
Tree cards in list are displayed in order depending on tree name or tree ID/location
If string entered is numerical: will order by tree ID/location, with values starting with the entered string first, and all other cards after (within each of the 2 groups, cards are ordered by ascending numerical value)
If string entered is non-numerical: will order by tree name, with values starting with the entered string first, and all other cards after (within each of the 2 groups, cards are ordered alphabetically)
Search stages:
When search bar is empty: up to 5 "Recents" search cards displayed with most recent first (if no recent searches, component isn't rendered), followed by search cards of all trees
As search is typed: label changes from "Recents" or "All trees" to "Suggestions", suggested tree cards appear (if none suggested, labeled "Oops, that's an invalid search. Try again!")
When search is entered: label displays number of results
Test Plan
Go to the search screen, try different search values entries of searches/pressing on search cards:
Are search cards ordered in an intuitive/meaningful way?
Are recent searches stored and displayed properly?
Summary
This PR adds persistent search history functionality, updates the logic of what tree cards to suggest as a search is being typed, and adds more user feedback during different stages of searching.
Test Plan
Go to the search screen, try different search values entries of searches/pressing on search cards:
Notes
Next Steps
Relevant Links
Online Sources
Related PRs
Screenshots and Tests
https://user-images.githubusercontent.com/78326649/163290810-6c7b3aef-44b1-4857-b62a-7918fac62c0d.mp4