50 lines
2.0 KiB
Markdown
50 lines
2.0 KiB
Markdown
# TASKS.md
|
|
|
|
Implementation progress tracker for the P2P Poll App.
|
|
|
|
## Setup
|
|
- [ ] Scaffold Waku project with `bunx create-waku@latest`
|
|
- [ ] Install Automerge dependencies
|
|
- [ ] Install Tailwind CSS v4 and `@tailwindcss/vite`
|
|
- [ ] Create `waku.config.ts` with Tailwind Vite plugin
|
|
- [ ] Create `src/styles/global.css` with Tailwind import
|
|
- [ ] Verify `bun run dev` starts without errors
|
|
|
|
## Core Logic
|
|
- [ ] Create `src/lib/types.ts` with Poll and PollOption interfaces
|
|
- [ ] Create `src/lib/peer.ts` with localStorage-backed peer ID generation
|
|
- [ ] Implement `createPoll` in `src/lib/poll.ts`
|
|
- [ ] Implement `addOption` in `src/lib/poll.ts`
|
|
- [ ] Implement `vote` and `unvote` in `src/lib/poll.ts`
|
|
- [ ] Implement `hasVoted` in `src/lib/poll.ts`
|
|
|
|
## Automerge Integration
|
|
- [ ] Create `src/lib/repo.ts` with Repo singleton (WebSocket, BroadcastChannel, IndexedDB)
|
|
- [ ] Create `src/components/Providers.tsx` with RepoContext.Provider
|
|
|
|
## Pages & Routing
|
|
- [ ] Create `src/pages/_layout.tsx` (server component with Providers and global CSS)
|
|
- [ ] Create `src/pages/index.tsx` with create-poll and join-poll UI
|
|
- [ ] Create `src/pages/poll/[id].tsx` with useDocument and Suspense
|
|
|
|
## UI Components
|
|
- [ ] Build `src/components/PollView.tsx` (title, options list, vote/unvote buttons)
|
|
- [ ] Add "Add Option" form to PollView
|
|
- [ ] Add shareable link / copy button to PollView
|
|
- [ ] Build `src/components/ConnectionStatus.tsx`
|
|
|
|
## Tests
|
|
- [ ] Test: getPeerId generates and persists a UUID
|
|
- [ ] Test: createPoll returns poll with title and empty options
|
|
- [ ] Test: addOption appends option with text, id, and empty votes
|
|
- [ ] Test: vote adds peer ID to option's votes array
|
|
- [ ] Test: double-vote prevention (no duplicate entries)
|
|
- [ ] Test: unvote removes peer ID from votes array
|
|
|
|
## Polish
|
|
- [ ] Tailwind styling (centered layout, card-style poll, vote bars)
|
|
- [ ] Loading states for document sync
|
|
- [ ] Error handling for invalid/missing document IDs
|
|
- [ ] Cross-tab sync testing (BroadcastChannel)
|
|
- [ ] Multi-device sync testing
|