-
Notifications
You must be signed in to change notification settings - Fork 101
Major overhaul (RecipeView update, sections support, recipes list view, ...)
#2115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2115 +/- ##
=======================================
Coverage 80.07% 80.07%
=======================================
Files 92 92
Lines 2650 2650
=======================================
Hits 2122 2122
Misses 528 528
Flags with carried forward coverage won't be shown. Click here to find out more. |
Test Results 12 files 572 suites 1m 31s ⏱️ Results for commit 54de35b. ♻️ This comment has been updated with latest results. |
4a16282 to
3005528
Compare
…nd `title-rename.js` to typescript Signed-off-by: Sebastian Fey <[email protected]>
…ema.org objects Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…string/string[] Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…ject. Signed-off-by: Sebastian Fey <[email protected]>
…ect. Signed-off-by: Sebastian Fey <[email protected]>
…oTool` object. Signed-off-by: Sebastian Fey <[email protected]>
…ToDirection` object. Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…nd `QuantitativeValue`. Signed-off-by: Sebastian Fey <[email protected]>
…Tool`. Signed-off-by: Sebastian Fey <[email protected]>
…wToSection`. Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…imple strings for `tool`, `recipeInstructions`, and `supply` properties Signed-off-by: Sebastian Fey <[email protected]>
…uctions`, and `supply` properties to `fromJSON` method of `Recipe`. Signed-off-by: Sebastian Fey <[email protected]>
…ud/axios usage. Fix wrong import order in `HowToTool` Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…uter . Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…issing route names. Fix 'All recipes' view. Signed-off-by: Sebastian Fey <[email protected]>
…s without requiring page reload. Signed-off-by: Sebastian Fey <[email protected]>
RecipeView update, sections support, recipes list view, ...)
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…ounts of `HowToSupply`s Signed-off-by: Sebastian Fey <[email protected]>
…d add tests Signed-off-by: Sebastian Fey <[email protected]>
…up. Closes #2114 Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…and list Signed-off-by: Sebastian Fey <[email protected]>
…d from list. Signed-off-by: Sebastian Fey <[email protected]>
Signed-off-by: Sebastian Fey <[email protected]>
…ries to recipe filters Signed-off-by: Sebastian Fey <[email protected]>
Topic and Scope
A lot of the UI is touched, with a focus on the
RecipeView.This PRs goal is manifold:
schema.orgentities should provide a cleaner way of dealing with recipe datasupply, which would allow structuring ingredients<router-view>s the need for a different structure of the URLSome minor changes/fixes that popped up during development include additional helper functions, file restructuring, improving the Jest config and reworking the
RecipeView:Related: #382 #428 #311 #135 #1875 #1244
Closes #1855 closes #2114
Currently supported in
RecipeViewHowToSectionsHowToSection's titleHowToSection's descriptionHowToSection's sub-stepsHowToTips inHowToSectionHowToSections,HowToSteps and stringsHowToSections (At some point this might even be confusing for the user) Note: In a meeting w/ the NC design team, we decided not to support nested sections (for now).HowToDirections in aHowToSectionHowToDirections in aHowToSectionHowToTips inHowToStepHowToToolobjects inRecipeHowToSupplyobjects inRecipeNutritionInformationobjects inRecipeConcerns/issues
Currently the UI does not support
We need to consider how to handle recipes where both
supplyandrecipeIngredientare defined.Supported properties are checked for their correctness, but additional properties, e.g., those allowed by the
schema.orgstandard that are not supported in our app are currently ignored.Recipes List
Restructured paths
With the introduction of the list view which required additional
<router-view>s the need for a different structure of the URLs appeared that allows defining the selected (filtered) list of recipes as well as a selected recipe. Currently the routes look like:category/:valuetags/:valuesearch/:valuefor filtering/searching the available recipes. These paths can remain the same. However if additional filters are applied, they are added as query parameters.
category/:value?q=tag%3A%2522spicy%2522(?q=tag:"spicy")When viewing a recipe the user was directed to
recipe/:idThis would loose the information that the recipe was, e.g., selected from a list of recipes within a specific category, maybe filtered down by certain parameters. This PR introduces new paths in the form of
category/:value/:id?q=tag%3A%2522spicy%2522(?q=tag:"spicy")`where
idis the recipe identifier. Navigating to the URL will show the same view as before when the list view is selected: A filtered list with the recipe open next to it. For editing the recipe the pathcategory/:value/:id/edit?q=tag%3A%2522spicy%2522is introduced.
Try out locally
Although the backend does not support the current structure it is possible to test this locally. You may start with copying the JSON code to a
recipe.jsonfile in a new subdirectory of theRecipes/folder. If you wish you can download some image and add it asfull.jpgto the same folder.Then you need to make two tweaks to the PHP code. In
FixInstructionsFilter.phpearly return the apply functionand in
FixToolsFilter.phpin theapplyfunction remove the else block and early returnPreview
Current state of the
RecipeView. The following JSON produces below imageRecipe JSON
{ "@context": "https://schema.org/", "@type": "Recipe", "name": "Chocolate Cake", "description": "A delicious and moist chocolate cake recipe.", "image": "cake.jpg", "recipeCategory": "Dessert", "cookTime": "PT40M", "prepTime": "PT20M", "totalTime": "PT1H", "recipeYield": 12, "url": "https://my-yummy-recipes.io/choc-cake/", "keywords": ["cake", "chocolate", "juicy", "dessert"], "recipeIngredient": [ "1/2 teaspoon salt", "2 large eggs", "1 cup milk", "1/2 cup vegetable oil", "2 teaspoons vanilla extract", "1 cup boiling water" ], "supply" : [ { "@type": "HowToSupply", "name": "all-purpose flour", "requiredQuantity": { "@type": "QuantitativeValue", "value": 2, "unitText": "cups" }, "description": "Main ingredient for the recipe" }, { "@type": "HowToSupply", "name": "granulated sugar", "requiredQuantity": { "@type": "QuantitativeValue", "value": 1, "unitText": "cup" }, "description": "Sweetens the recipe" }, { "@type": "HowToSupply", "name": "unsweetened cocoa powder", "requiredQuantity": { "@type": "QuantitativeValue", "value": 1, "unitText": "cup" } }, { "@type": "HowToSupply", "name": "baking powder", "requiredQuantity": { "@type": "QuantitativeValue", "value": 1, "unitText": "teaspoon" } }, { "@type": "HowToSupply", "name": "baking soda" } ], "tool": [ "mixing bowl", "whisk", "sifter", { "@type": "HowToTool", "name": "measuring cups", "requiredQuantity": 2, "description": "grandma's **nice** ones" }, "measuring spoons", "cake pans" ], "nutrition": { "@type": "NutritionInformation", "servingSize": "1 slice", "calories": "250 calories", "fatContent": "12 grams", "carbohydrateContent": "30 grams", "proteinContent": "8 grams", "sodiumContent": "500 milligrams", "fiberContent": "2 grams", "sugarContent": "5 grams" }, "recipeInstructions": [ { "@type": "HowToSection", "name": "Prepare Dry Ingredients", "description": "Prepare the dry Ingredients by mixing them together. Follow the steps closely to get a perfect result!", "itemListElement": [ { "@type": "HowToStep", "text": "Mix together the flour, sugar, cocoa, baking powder, baking soda, and salt in a large bowl.", "position": 1, "timeRequired": "PT5M" }, { "@type": "HowToStep", "text": "Sift the dry ingredients to remove any lumps.", "position": 2, "timeRequired": "PT2M", "itemListElement": [ { "@type": "HowToDirection", "text": "Pour dry ingredients in a sieve", "timeRequired": "PT1M", "tool": [ "mixing bowl", "sifter", { "@type": "HowToTool", "name": "measuring cups", "requiredQuantity": 2, "description": "grandma's **nice** ones" }, "measuring spoons" ] }, { "@type": "HowToDirection", "text": "Move a spoon clockwise in the sieve to apply some pressure on the ingredients.", "timeRequired": "PT1M", "supply" : [ { "@type": "HowToSupply", "name": "all-purpose flour", "requiredQuantity": { "@type": "QuantitativeValue", "value": 2, "unitText": "cups" }, "description": "Main ingredient for the recipe" }, { "@type": "HowToSupply", "name": "granulated sugar", "requiredQuantity": { "@type": "QuantitativeValue", "value": 1, "unitText": "cup" }, "description": "Sweetens the recipe" } ] }, { "@type": "HowToTip", "text": "Use a hair sieve" } ] }, { "@type": "HowToStep", "position": 3, "timeRequired": "PT1M", "itemListElement": [ { "@type": "HowToDirection", "text": "Set aside the dry ingredients for later use.", "timeRequired": "PT1M", "supply" : [ { "@type": "HowToSupply", "name": "baking powder", "requiredQuantity": { "@type": "QuantitativeValue", "value": 1, "unitText": "teaspoon" } }, { "@type": "HowToSupply", "name": "baking soda" } ] } ] } ] }, { "@type": "HowToSection", "name": "Wet ingredients", "description": "Prepare the Wet Ingredients", "itemListElement": [ { "@type": "HowToStep", "text": "In a separate bowl, whisk together the eggs, milk, oil, and vanilla extract.", "position": 1, "timeRequired": "PT5M" }, { "@type": "HowToStep", "text": "Gradually add the wet ingredients to the dry ingredients, stirring until well combined.", "position": 2, "timeRequired": "PT3M" }, { "@type": "HowToStep", "text": "Pour in the boiling water and mix until smooth.", "position": 3, "timeRequired": "PT2M" } ] } ] }RecipeView:Details sidebar opened:
Recipe sections
Clicking an image opens a modal with a slideshow of the full images:
Wide screen
The width of the recipe content is limited to maintain readability
Narrow screen
List view
Filtering:
Filter modal opened:
Filter selected (URL gets updated to
${HOST}/index.php/apps/cookbook/#/category/Dinner/412?q=tag%3A%2522spicy%2522):Formal requirements
There are some formal requirements that should be satisfied. Please mark those by checking the corresponding box.