Document Status |
| ||||||
---|---|---|---|---|---|---|---|
Document Owner(s) | |||||||
Reviewers |
Table of Contents |
---|
🛠️ Potential Solutions
🧐 Assumptions
We will turn the offer search editable, allowing the user to type the offer name.
It cannot take much time to show the offer searched.
We have to warn the user when the offer does not appear on the list.
It needs to search in the list for every offer containing at least three characters of the name in any part (beginning, middle, ending) according to what was typed.
Space won’t count as a character to the three characters limitation
The searching will not be case-sensitive, therefore the user may type both uppercase and lowercase letters
It should always show Sanity offer in an increasing alphabetical order.
It should have a temporary feature flag to ensure everything is working fine, such as
enable-search-assigned-offers
.It is not assured if there are offers where the first word has only two characters, but it is not common, therefore for such cases, we will treat with the three-character limitation
✅ Proposed Solution
Solution #1
...
Search Scenario | Result |
---|---|
"ic e" | The space will break the word, and it will look for any offer that has its name in any part of it "ic" nd the next word starting with "e" => No results for "ic e" |
"ice" | It will look for any offer that has its name in any part of it "ice" => Ice Brioche And Drink |
"nd " | It won't look for any offer, because it didn't reach the 3 characters limitation => No results for "nd " |
"nd d" | The space will break the word, and it will look for any offer that has its name in any part of it "nd" and the next word starting with "d" => Ice Brioche And Drink |
"iceb" | It will look for any offer that has its name in any part of it "iceb" => No results for "iceb |
"iC e" | The space will break the word, and it will look for any offer that has its name in any part of it "ic" nd the next word starting with "e" => No results for "ic e" |
"ND d" | The space will break the word, and it will look for any offer that has its name in any part of it "nd" and the next word starting with "d" => Ice Brioche And Drink |
Tasks Breaking Down
Task 1 - Create a feature flag
Create
enable-search-assigned-offers
feature flagit is not the same way it is done in whitelabel: in this repository a mutation brings the value and GraphQL integrates with Launchdarkly
Task 2 - Integrate AutoComplete with feature flag
When
enable-search-assigned-offers
feature flag is enabled, replace inoffer-form.tsx
OfferTemplate Input Label and Select for an AutoComplete componentadd the flag to offers container
create tests from container
update test from offers-form
Task 3 - Add AutoComplete Material UI Component
Replace in
offer-form.tsx
OfferTemplate Input Label and Select for an AutoComplete componentget all offer names by whatever was typed considering the requirements
add a warning message for when there aren’t any offer names by whatever was typed
update tests
References: https://v4.mui.com/api/autocomplete/#autocomplete-api https://v4.mui.com/components/autocomplete/#autocomplete