Skip to content

feat(web): choose optional ingredients for the shopping list - #593

Merged
dubadub merged 1 commit into
mainfrom
feat/optional-shopping-web
Oct 15, 2026
Merged

dubadub merged 1 commit into
mainfrom
feat/optional-shopping-web

Conversation

@dubadub

@dubadub dubadub commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Part 2 of the CookCLI side of spec proposal 0018. Follows #592 (merged).

Recipe page

  • Optional ingredients and cookware are labelled (optional) (localised, all 9 locales), also in cooking mode's mise en place.
  • Required and optional amounts of one ingredient are two rows (parmesan 100 g, parmesan 50 g (optional)), not merged.
  • Each optional ingredient gets an unticked checkbox — the same pattern as the existing sub-recipe checkboxes — deciding whether it goes on the list. Duplicate checkboxes across sections stay in sync. Optional recipe references get no checkbox (they are left off; choosing them is not supported yet).

Stored list

  • POST /api/shopping_list/add takes optional_ingredients: [names]. The server computes the amounts from the recipe at the entry's scale (summing occurrences, one line per non-convertible unit) and stores selection lines:
    ./Eggs on toast.cook{2}
      ? chilli flakes{2%pinch}
    
  • GET /api/shopping_list/items returns them as optional_ingredients: [{name, quantity}]; a ? ./path line written by another app is not mistaken for an included reference.
  • add_menu leaves out optional recipes in a menu (@?./Cake{}), using the optional flag added to MenuItem::RecipeReference in cooklang-find 0.12.0 (feat(menu)!: mark optional recipe references cooklang-find#38); CookCLI moves to cooklang-find 0.12.

Generated list

Core

StoredEntry::optional_ingredients, OptionalSelection, optional_selections(), add_optional_selections(); subtract_pantry_from_optional made public for the server.

Tests

Store round-trips (selection lines written before references, menus, foreign ? ./path lines), core selection computation (scaling, summing, unit split, required/unknown names ignored), and a new shopping_list_optional_api_test driving the real server: choose → stored line → listed as optional at the stored amount; unchosen stays off; menus skip optional recipes. docs/api.md regenerated.

Not yet

Choosing optional recipe references in the UI; pantry-based recipe matching (part 3).

Base automatically changed from feat/optional-shopping-list to main October 3, 2026 14:37
@dubadub

dubadub commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@claude lets fix conflicts

@claude

claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Claude finished @dubadub's task in 28s —— View job


I couldn't fix the conflicts. The sandbox denied git fetch origin and git merge origin/main, so I haven't changed or pushed anything.

The local origin/main is at e5b6272 (Merge pull request #594, feat/pantry-optional). Conflicts are likely in the shopping list files, src/web/ and the locale files. If you add git fetch and git merge (or git rebase) to the allowed tools, mention me again and I'll resolve them.

You can also resolve them locally with git fetch origin && git merge origin/main. This PR is stacked on #592, so merging or rebasing onto main after #592 lands may be cleaner.

Following spec proposal 0018 on the web:

- Recipe page: optional ingredients and cookware are labelled
  (optional), in cooking mode too, and optional ingredients get an
  unticked checkbox that decides whether they go on the shopping list.
  Required and optional amounts of one ingredient are listed apart.
- POST /api/shopping_list/add takes optional_ingredients (names); the
  server works out the amounts at the entry's scale and stores them as
  `? name{quantity}` selection lines in .shopping-list.
- The shopping list page sends the stored selections back, and
  POST /api/shopping_list lists only required ingredients plus those,
  each item carrying "optional".
- add_menu leaves out optional recipes in a menu (`@?./Cake{}`).

Core: StoredEntry::optional_ingredients / OptionalSelection,
optional_selections() and add_optional_selections().
@dubadub
dubadub force-pushed the feat/optional-shopping-web branch from e627b2b to d61c42f Compare October 15, 2026 16:18
@dubadub
dubadub merged commit d3e96bd into main Oct 15, 2026
6 checks passed
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.

1 participant