Skip to content

Conversation

leonbeon
Copy link
Contributor

This PR adds the ability to show ingredient quantites with their units next to the ingredients in the recipe text. It also adds a new "Preferences" route and navigation element to toggle the display of this new setting. This is just quickly added by me to use the feature at all, this may need a seperate issue to handle how preferences are accessed. The new option is also saved to local storage and retrieved if found.

I think this change is very useful for recipes where you need the same ingredient multiple times. Consider a recipe of mine where I need 225g of butter in the beginning and then later at a different step I need 115g again. In the recipe listing, these are two different entries:

Two ingredients with the same name

But in the recipe itself, I have no way of differentiating which quantity of "butter" is supposed to be used without writing it manually (which would clash with serving size scaling). With the PR, the text now shows the unit size with the ingredient itself:

Quantities next to ingredients

And for completeness, this is the preferences pane:
Preferences

leonbeon and others added 6 commits December 31, 2023 15:26
Add clause to Step.svelte to check if ingredient quantity should be shown next to the ingredient name
Add checkbox to toggle showUnitsNextToIngredients in preferences
This change uses the @html tag to inject html into the card text instead of plain text. May need to be changed for security considerations?
Because what is actually shown are quantities, not only units
@dubadub dubadub merged commit f30ee37 into cooklang:main Jan 2, 2024
@dubadub
Copy link
Member

dubadub commented Jan 2, 2024

Nice! Thank you @leonbeon!

@leonbeon leonbeon deleted the pr-ingredient-units branch January 2, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants