Skip to content

feat: add recipe timings (activeTime & passiveTime)#87

Open
m-lyon wants to merge 11 commits intomainfrom
feat/76-recipe-timings
Open

feat: add recipe timings (activeTime & passiveTime)#87
m-lyon wants to merge 11 commits intomainfrom
feat/76-recipe-timings

Conversation

@m-lyon
Copy link
Copy Markdown
Owner

@m-lyon m-lyon commented Apr 1, 2026

Summary

Adds two optional timing fields (activeTime and passiveTime) to recipes, stored as integer minutes. Closes #76.

Changes

Backend

  • Added activeTime and passiveTime (optional integer) to Recipe model schema and TypeScript interface
  • Created MongoDB migration script (updateSchema_2026-03-30.js) to add null defaults
  • Added 4 API tests for creating/updating recipes with timing fields

GraphQL

  • Added activeTime and passiveTime to RECIPE_FIELDS_FULL fragment

Client — State & Utils

  • Created formatTime utility (converts minutes to "X hr Y min" format) with 5 unit tests
  • Created Zustand createTimingsSlice with activeTime/passiveTime state, setters, and reset
  • Integrated timings slice into useRecipeStore

Client — Components

  • EditableTimings: Dual time pickers (hours 0–24, minutes in 5-min increments) using Mantine Select, with useShallow to prevent re-render loops
  • Timings: View component displaying formatted active/passive times

Client — Page Integration

  • EditableRecipe: Added EditableTimings alongside tags in a Flex layout
  • ViewRecipe: Moved TagList out of tab panels into a dedicated grid row with Timings component
  • SubmitButton: Conditionally includes timing fields in mutation payload
  • EditRecipe: Populates timing state from loaded recipe data

Testing

  • 5 integration tests covering add, remove, and update workflows for timings
  • Mock data for recipe-with-timings and 5 timing mutation mocks

m-lyon added 11 commits March 30, 2026 22:25
Add two optional Number fields (activeTime, passiveTime) to the Recipe
interface and Mongoose schema. Include a migration script to set both
fields to null on existing documents that lack them.

Refs #76
Add create and update tests to verify activeTime and passiveTime fields
work correctly through the GraphQL API layer.

Refs #76
Include timing fields in the full recipe GraphQL fragment so they are
fetched on recipe detail/edit pages.

Refs #76
Remove inline TagList from IngredientsTab and InstructionsTab, add a new
'tags' grid area in ViewRecipe that renders TagList and Timings side by
side on desktop and stacked on mobile. Simplify InstructionsTab boxHeight
by removing tagsHeight dependency.
Add activeTime/passiveTime to SubmitButton store selector and mutation
payload (conditionally included when non-null). Add setActiveTime/
setPassiveTime to EditRecipe store selector and populate them in
onCompleted when loading an existing recipe.
Add mockRecipeOneWithTimings and 5 timing mutation mocks to support
integration testing. Create 5 integration tests covering add, remove,
and update workflows for activeTime and passiveTime fields. Fix
EditableTimings infinite re-render by wrapping store selector with
useShallow.
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.

Add recipe timings

1 participant