Skip to content

feat(web): recipe list and detail (PLAN §4.4 & §4.6)#18

Merged
mcalthrop merged 9 commits into
mainfrom
feat/web-recipe-list-4.4
Apr 3, 2026
Merged

feat(web): recipe list and detail (PLAN §4.4 & §4.6)#18
mcalthrop merged 9 commits into
mainfrom
feat/web-recipe-list-4.4

Conversation

@mcalthrop
Copy link
Copy Markdown
Owner

@mcalthrop mcalthrop commented Apr 3, 2026

Summary

Delivers PLAN §4.4 (home recipe list) and §4.6 (recipe detail), with supporting tooling and refactors on the SolidJS app and monorepo.

Features

  • Home — Fetches recipes via the generated client (listRecipes with throwOnError) and createResource; shows loading, error, and empty states; grid of linked cards (RecipeCard) to /recipes/:id.
  • Recipe detailGET /recipes/{id} via getRecipeById with throwOnError; full content composed from RecipeDetailBody (header, hero image, ingredients, steps).
  • APICORSMiddleware for local Vite origins so the browser can call the API in dev.

Developer experience

  • @/ path alias (Vite + TS); Biome noRestrictedImports for ../** (same-folder ./ imports encouraged where possible).
  • Exact dependency pinsyaml@2.8.3 in @solid-pact/openapi so Redocly/redocly lint resolves the yaml module under pnpm.
  • Linting — Biome (useArrowFunction, useExplicitType, noDefaultExport, …); scripts/assert-no-function-declarations.mjs after Biome (Biome does not flag top-level function declarations). Cursor rules for path alias and const-arrow style.
  • TestsHome.test.tsx mocks @/api listRecipes; MemoryRouter for <A>; error case uses thrown Error to match throwOnError behaviour.

Refactors (high level)

  • Call listRecipes / getRecipeById from pages (no separate lib loaders); shared apiClient wiring stays in src/api/index.ts.
  • RecipeCard and components/recipe-detail/* extracted from page files; props destructured where useful.

Checklist

  • pnpm --filter web lint
  • pnpm --filter web test
  • pnpm --filter web build

PLAN

  • §4.4 and §4.6 ticked in PLAN.md.

Made with Cursor

- Fetch GET /recipes via listRecipes + createResource; loading, error, and empty states.
- Recipe cards with thumbnail, title, summary; navigate to /recipes/:id with router Link.
- Vitest mock for ./api listRecipes so tests run without a live API.
- Tick PLAN §4.4.

Made-with: Cursor
Copilot AI review requested due to automatic review settings April 3, 2026 12:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements PLAN §4.4 by wiring the SolidJS home page to the typed GET /recipes client and rendering a navigable recipe list with loading/error/empty states.

Changes:

  • Fetch recipes on the home page via listRecipes + createResource and render linked recipe cards.
  • Add page styles for recipe list states and card layout.
  • Update web tests to mock ./api so tests don’t require a running backend.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
PLAN.md Marks PLAN §4.4 as completed.
apps/web/src/pages/Page.css Adds styles for home lede, list states, and recipe card layout.
apps/web/src/pages/Home.tsx Implements recipe fetching, UI states, and navigation to /recipes/:id.
apps/web/src/App.test.tsx Mocks listRecipes to keep tests backend-independent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/web/src/pages/Home.tsx Outdated
Comment thread apps/web/src/pages/Home.tsx Outdated
- Add recipe detail page data loading and styles (PLAN §4.6); shared loaders
- Enable API CORS for local Vite origins
- Use @/ alias; Biome rules (arrows, explicit types, no default export)
- Add Home.test.tsx with MemoryRouter; fix img dimensions for 4:3 cards
- Update PLAN (§4.5 component library note); Cursor rule for path aliases

Made-with: Cursor
@mcalthrop mcalthrop changed the title feat(web): home recipe list and navigation (PLAN §4.4) feat(web): recipe list and detail (PLAN §4.4 & §4.6) Apr 3, 2026
Redoc requires the yaml package at runtime; pnpm does not hoist it.
Aligns with REQUIREMENTS (no ^ or ~).

Made-with: Cursor
Prefer relative same-folder imports for api barrel, entrypoint, layout,
and pages; keep @/ for imports that would require ../ (Biome rule).

Made-with: Cursor
- Replace async function exports and resolveBaseUrl with const arrows
- Run assert-no-function-declarations.mjs after Biome (useArrowFunction
  does not cover top-level function declarations)
- Add Cursor rule documenting the convention

Made-with: Cursor
- Home: createResource uses listRecipes({ throwOnError: true })
- RecipePage: getRecipeById inline; guard with !id
- Remove loadRecipes/loadRecipeDetail; adjust Home error test for throws

Made-with: Cursor
- RecipeCard for home list items; RecipeDetailBody composes header, hero,
  ingredients, and steps
- RecipePage renders RecipeDetailBody from loaded RecipeDetail

Made-with: Cursor
@mcalthrop mcalthrop merged commit 92dace0 into main Apr 3, 2026
5 checks passed
@mcalthrop mcalthrop deleted the feat/web-recipe-list-4.4 branch April 3, 2026 16:38
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.

2 participants