Skip to content
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

Recipe Variants/Variations #2631

Open
solonovamax opened this issue Jan 6, 2025 · 0 comments
Open

Recipe Variants/Variations #2631

solonovamax opened this issue Jan 6, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@solonovamax
Copy link

Is your feature request related to a problem? Please describe.
Currently, it is not possible to have recipe variants/variations unless you do one of the following:

  • Add it to the description
  • Create additional recipes

Describe the solution you'd like
It would be nice if you could add recipe variants, and then use a dropdown menu or a radio button group to select which variant of the recipe you wish to use.

A variation of a recipe is comprised of the standard recipe, however a couple of components have been modified.
For example

  • Replace an ingredient with another ingredient
  • Add a new ingredient and then add/modify a step
  • Modify a single step
  • etc.

imo the best UX for creating a recipe variant would be to have a button that allows you to create a new variant. When pressed, it would create a tab group with the "Primary" variant as well as the additional named variants.
The variant would inherit all the same fields (excluding name, description, url, image, keywords, and category, as those would belong to the root recipe and are always the same across all variants) as the primary variant, however they would be grayed out.
If the user were to select and modify that field, it would become un-grayed and be an addition for that variant.
The user should also be able to add new steps in between other steps as well as new ingredients and tools.

Essentially, the variants should be a diff that is applied to the original recipe.

Any unmodified fields are inherited from the original recipe.

  • If a user were to create a new recipe with
    • instructions 1-8
    • a variant that modifies instruction 6
    • If they then went back to the primary variant and modified instruction 3
      • In the variant, the modified instruction 3 would be present
  • If a user were to create a recipe with
    • instructions 1-8
    • a variant that inserts an instruction between 5 and 6
    • If they were to go back to the primary variant and insert a new instruction between 3 and 4
      • In the variant the instruction they previously added would move from 6 to 7.

I find it important to highlight this to show that the recipe is not copied, but rather inherited. Because if it were copied, then any changes to the original recipe would not be propagated to the recipe variant. However with it being inherited, any changes to the original recipe are then propagated down to its variants, ensuring that the user does not have to remember to go and individually modify each variant.

To put it another way, the recipe could be represented something like this

name: "recipe name"
description: "recipe description"
variants:
  # there always exists a variant with the `primary` id
  - id: primary
    name: "Primary"
    primary: true
    instructions:
      - id: random-unique-instruction-id-1 # all instruction ids should be random and unique
        instruction: "this is the first instruction"

      - id: random-unique-instruction-id-2
        instruction: "this is the second instruction"

      - id: random-unique-instruction-id-3
        instruction: "this is the third instruction"

      - id: random-unique-instruction-id-4
        instruction: "this is the fourth instruction"

      - id: random-unique-instruction-id-5
        instruction: "this is the fifth instruction"

  - id: random-unique-variant-id
    name: "Variant 1"
    inherits: primary # inherit from the primary instruction
    instructions:
      # this modifies instruction 1
      - id: random-unique-instruction-id-1
        instruction: "this instruction replaces the first instruction"

      # this causes instruction 2 to be removed from this variant
      - id: random-unique-instruction-id-2
        remove: true

      # this inserts a new instruction between 4 and 5
      - id: random-unique-instruction-id-4.5
        after: random-unique-instruction-id-4
        instruction: "this instruction is between 4 and 5"

Describe alternatives you've considered
Using one of the described-above workarounds

@solonovamax solonovamax added the enhancement New feature or request label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant