addyosmani / addyosmani/factory-demo

Add a local favorites watchlist

Aberta
#1 4 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement factory:awaiting-review
Linguagem predominante
TypeScript
Estrelas
2
Forks
3
Merge médio
3min
PRs com merge (30d)
1

Descrição

## Why

Let people keep a small personal watchlist while browsing the demo. This is intentionally local to one browser: no TMDB account, authentication, or write API is involved.

## Scope

- Store the minimum movie summary needed for a watchlist in `localStorage` under one versioned key.
- Add an accessible favorite/unfavorite control to each discovery card and the movie detail view.
- Add `/favorites` and link it from the primary navigation.
- The favorites view handles both populated and empty states and links back to each movie detail page.
- Hydration and unavailable/corrupt storage must fail safely without breaking browsing.

## Acceptance criteria

- Favoriting from a discovery card updates that control and makes the movie appear at `/favorites` without a reload.
- The same saved state is reflected on the matching detail page; removing it from either surface removes it from `/favorites`.
- Refreshing the page preserves the watchlist in the same browser.
- With no saved items, `/favorites` shows an intentional empty state with a route back to Discover.
- Controls expose an accurate accessible name and pressed state and work by keyboard.
- A new pure unit test exercises add, remove, deduplication, corrupt-data fallback, and storage round-tripping. No existing test file is changed.
- `npm run typecheck`, `npm run lint`, `npm test`, and `TMDB_USE_MOCKS=true npm run build` pass.
- TMDB attribution remains visible and `TMDB_API_KEY` remains server-only.

## Guardrails

Keep this under 400 changed lines and within at most eight files. Do not touch `.env*`, `lib/tmdb.ts`, `next.config.ts`, package files, GitHub workflows, or factory policy/adapters. Do not add a dependency.

## Expected files

`lib/favorites.ts`, `lib/favorites.test.ts` (new), `components/favorite-button.tsx`, `components/movie-card.tsx`, `app/movies/[id]/page.tsx`, `app/favorites/page.tsx`, `app/layout.tsx`, `app/globals.css`

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.