feat: add recipe timings (activeTime & passiveTime)#87
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two optional timing fields (
activeTimeandpassiveTime) to recipes, stored as integer minutes. Closes #76.Changes
Backend
activeTimeandpassiveTime(optional integer) to Recipe model schema and TypeScript interfaceupdateSchema_2026-03-30.js) to add null defaultsGraphQL
activeTimeandpassiveTimetoRECIPE_FIELDS_FULLfragmentClient — State & Utils
formatTimeutility (converts minutes to "X hr Y min" format) with 5 unit testscreateTimingsSlicewithactiveTime/passiveTimestate, setters, and resetuseRecipeStoreClient — Components
useShallowto prevent re-render loopsClient — Page Integration
Testing