This is just going to be a quick post where I cover some of the changes I made to the List Page in preparation for first release.
Creating a Recipe Panel
I wanted to provide additional information about the recipes that were in a given grocery list, as well as provide links to the editing pages and the original source of the recipe. I wanted this to function similarly to the panel as it worked in my first version of this project.
The RecipePanel component uses an Axios call to get all recipes in the list, filters out the “Additional Ingredients” recipe, and then maps them to another new component, the RecipeButton component. I also added a check to see if there were any recipes in the list. If not, then the panel does not display at all.
The RecipeButton component displays the name of the recipe as well as a small panel that appears when hovered over the line. This panel provides the option to edit the recipe, gives a link to the source of the recipe, and gives the option to delete the recipe. While I wrote these as different components, I stored them all in the same file, since there wasn’t going to be any reusing of the components.
Modifying the Recipe Side Panel
Next, I created a few modifications to the Recipe Side Panel. Because the new RecipePanel component allows for deleting recipes, I decided to forgo that option, only show recipes that weren’t added to the list, and turn the whole card into a button.
Also note here that I’ve begun experimenting with async and await commands. I still feel a bit hesitant about them (I’m used to my good old fashioned promise chains), but I do like the increased cleanliness of the syntax and making a full transition to these is something I would consider in the future.
Note also that I used a classic “insert everything into a set and then check if the item is in the set” solution to countless programming problems for determining if any given recipe was already in the list. This was faster than my previous method and significantly more elegant.
Changes to the Ingredient Panel
Finally, I made some changes to the ingredient panel that hopefully create a much cleaner interface.
For the IngredientButton, I removed the old and needlessly complicated system of “superimposing a button on top of text” in favor of simply keeping it a button the whole time, and changing the text when highlighted.
I also brought in a new component, RecipeLineDisplay, that showed the lines that the ingredient came from. This component again had more than one component in its file: one to hold all of the lines, and a separate component to actually make the calls and display each individual line.
In order to find Recipe Lines this way, I needed to adjust my backend with some new paramaters. You can now search for a recipe line by ingredient or grocery list.
Each time I work with SQLAlchemy, I understand it a bit better. This is probably my best querying attempt yet, and another thing that I am planning to do “at some point” is go back and rewrite all of my queries to be this modular.
Finally, in the actual IngredientPanel component (formerly known as ListPanel), I removed the chunking code, displaying all ingredients as a single list instead.
This just seemed a bit cleaner and more elegant, and to be honest I didn’t want to spend a lot of time calibrating the chunk settings to look good on a variety of different screen sizes.
Conclusions
This is most of what will be on the List Page for the first release of this thing. Honestly, I could keep tweaking and tweaking forever (and that’s kind of what I’ve been doing), but to be honest I’m beginning to get sick of looking at this code. I want to work on something else for a while, so I’d like to release what I’ve got (with a bit more polish) and turn my attention elsewhere.
Still not quite done here, though. I still need to add some better landing pages and more information about the app for people who aren’t signed in. Then I need documentation.