Filter, Sort and Search Recipes + User Feed concurrent display of recipes #236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the user is not logged in, they will see only 9 recipes:
If they scroll to the bottom, they will see this message:
And each button redirects to the corresponding page. When the user logs in now, they see this:
They can now click their profile image to go to their profile or, alternatively, can use the contextual dropdown menu when clicking on their username:
Typing in the search bar will dynamically filter recipes by name, following the backend model, where not only recipe titles are factored in, but also usernames of the creators and recipe ingredients:
clicking the filter funnel will prompt an off canvas where the user can select different filters:
When apply is clicked the filters are saved in the local storage and applied to the search, using the magic endpoint in the backend. Then, these filters appear as pills before the recipes list:
The condition for these pills to appear or not is based on the default filters, if any match the default corresponding filter, it will not be displayed. This is an exception with the ascending/descending filter, which is tied to the sort_by filter, and thus its visibility will depend on it. You can change the ascending/descending order or outright remove a filter using the icon on the left. This will update the recipes list and the local storage.
The clear filters button is used to restore to default values.
Last but not least, now recipes are retrieved dynamically, when reaching the end of the list, more list will be loaded, except if there are no more recipes left to retrieve.
If the user logs out, the recipes list changes to the previously mentioned one, where only 9 recipes sorted by rating appear.