Skip to content

Conversation

robertky
Copy link
Member

@robertky robertky commented Sep 6, 2026

Summary

Closes #11.

  • src/components/BookCard.tsx: props-driven presentation component with no fetching or app state
  • src/components/BookCard.css: responsive plain CSS matching the existing app style
  • Shows a cover image with descriptive alt text, or a text placeholder when a cover is missing
  • Handles missing authors, publish year, and subjects without breaking
  • src/components/BookCard.test.tsx: snapshots for full and minimal book data; verifies title, authors, cover, and placeholder behavior

Validation

  • npm run format:check
  • npm run lint
  • npm test
  • npm run build

@robertky robertky requested a review from a team as a code owner September 6, 2026 12:35
@robertky robertky added type: feature New functionality or requirement area: ui React components, presentation, navigation priority: high Required for first delivery status: in-review PR is open and awaiting review ai-assisted Substantial AI-generated code (documented per spec) labels Sep 6, 2026
@robertky robertky added this to the M2 — Core app milestone Sep 6, 2026
@erikhfj
Copy link
Member

erikhfj commented Sep 7, 2026

Code review pass (automated, thorough): no bugs found. Verified BookCard against src/types.ts and coverUrl() in src/api/openLibrary.ts; lint / test (8) / format / build all verified locally.

Branch logic checked: firstPublishYear !== null matches number | null; coverUrl() → null correctly routes to the placeholder branch (no undefined src); empty authors → "Unknown author"; empty subjects → list omitted — all covered by tests.

Three minor, non-blocking notes:

  1. Unbounded subject chips (UX, low): some real books return ~66 subjects (checked live API, e.g. The Picture of Dorian Gray) — BookCard.tsx renders every chip, so the card can get very tall. Consider slicing to the first 5–8.
  2. Cover-file 404 edge case (low): OpenLibrary occasionally returns a cover_i whose cover file does not exist — coverUrl builds a URL for any non-null id, so the browser would show a broken image instead of the "No cover available" placeholder. An onError fallback on the img would cover this.
  3. key={subject} (caveat): assumes subject strings are unique per book. No duplicates seen in live API samples, so likely fine — just flagging the assumption.

Nice work overall — the a11y and fallback handling are solid.

@erikhfj erikhfj merged commit c883360 into main Sep 7, 2026
1 check failed
@erikhfj erikhfj deleted the feat/11-book-card branch September 7, 2026 00:45
Sign in to join this conversation on GitHub.
Labels
ai-assisted Substantial AI-generated code (documented per spec) area: ui React components, presentation, navigation priority: high Required for first delivery status: in-review PR is open and awaiting review type: feature New functionality or requirement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: BookCard component (cover, title, authors, year, subjects)
2 participants