Skip to content

fix(library): cards fall back to computed OG, FG, ABV, IBU and color (#49) - #66

Merged
ndreno merged 1 commit into
mainfrom
fix/library-card-gravities
Nov 3, 2026
Merged

ndreno merged 1 commit into
mainfrom
fix/library-card-gravities

Conversation

@ndreno

@ndreno ndreno commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Closes #49 (reopen if the reporter meant another screen).

Why

Library cards only showed the figures stored in the recipe file. OG, FG and ABV read "—" when the file lacked them, IBU showed "—" with the estimate as a small subtitle, and the color swatch needed a stored color_estimate. The recipe screen already shows Werb's estimates in that case, so a recipe like the Punk IPA sample (OG/FG only) looked incomplete in the library: the "preview missing DI/DF/ABV" report.

What

  • data/recipe-targets.ts: claimed + computed OG, FG, ABV and SRM, same rules as the recipe screen (OG from the grain bill, FG from attenuation, ABV from the shown OG/FG). An empty grain bill gives no estimate rather than 1.000.
  • RecipeCard: file value, else the estimate. IBU keeps its "≈estimate" subtitle when the file states one. Exported for tests; stats carry data-testids.

Tests

  • Unit: recipe-targets (file first, estimates, empty grain bill).
  • Component: RecipeCard renders estimates for Punk IPA, file values for Cascade, dashes with nothing to estimate from.
  • e2e: Punk IPA card shows ABV, IBU and a color swatch. Full suite 33/33 locally, lint clean.

…49)

Recipe cards only showed the figures stored in the file: OG, FG and ABV read
"—" when the file lacked them, IBU showed "—" with the estimate as a small
subtitle, and the color swatch only appeared with a stored color_estimate.
The recipe screen already showed Werb's estimates in that case, so a recipe
like the Punk IPA sample (OG/FG only) looked incomplete in the library.

- data/recipe-targets.ts: claimed + computed OG, FG, ABV and SRM, same rules
  as the recipe screen (OG from the grain bill, FG from attenuation, ABV from
  the shown OG/FG). An empty grain bill gives no estimate rather than 1.000.
- RecipeCard: shows the file value, else the estimate; IBU keeps the
  "≈estimate" subtitle when the file states one. Exported for tests.

Tests: recipe-targets unit tests, RecipeCard component tests, e2e on the
Punk IPA sample card.
@ndreno
ndreno merged commit 9509a99 into main Nov 3, 2026
1 check passed
@ndreno
ndreno deleted the fix/library-card-gravities branch November 3, 2026 19:16
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.

Recipe preview missing OG/FG/ABV (DI/DF) — needs clarification on which view

1 participant