Closed brunovegreville closed 4 years ago
To control the state of the controlled Algolia widgets, we can use their attribute defaultRefinement
.
See Algolia doc.
For example if you want to select those 3 facets:
The searchState
looks like:
{
"recruitment_status": [
"Recruiting"
],
"therapeutic_classes": [
"Antiviral",
"Traditional medicine"
]
}
What I propose is to store the suggestions as the following JSON:
{
"suggestions": [
{
"name": "toto",
"recruitment_status":[
"Recruiting"
],
"therapeutic_classes":[
"Antiviral",
"Traditional medicine"
]
},
{
"name": "tata",
"recruitment_status":[
"Not Recruiting"
]
}
]
}
To ease operations, I propose to store this JSON file in Firebase Cloud Firestore. It should be easily updatable by the product team. We could also use an easier to use service like LaunchDarkly
or even consider use Algolia, but it is an anti-pattern.
The UI would fetch this JSON at mount time and dynamically mount the suggestions buttons that when clicked on would update the search state.
When product would like to update them, they’ll just have to connect to the firebase console.
anticovid-staging
and anticovid
firebase db with the right suggestionsSuggestion
component in the inato-anticovid
project that fetches the JSON at mount timesuggestionButton
components derived from this JSON statedefaultRefinement
options of the facets component
A suggestion is
For instance, a suggestion could be
Using a suggestion replaces all filters of the search by the ones specified by the suggestion.
Suggestion is a way for us to indicate interesting search to the users, and educate him on how the search works. These suggestions will change over time based on the promising leads in clinical research. Ideally, product team can add/edit and remove suggestions without the intervention of the app team.
You can see in the Figma specs how they would be integrated in our platform ⚠️ The front-end specs might change a bit today, so please focus the analysis on the back-end and domain modeling vs. jumping directly in the UI 🙏