47 lines
1.4 KiB
Markdown
47 lines
1.4 KiB
Markdown
---
|
|
id: TASK-118.2
|
|
title: Add multiplayer sync to rchoices (voting/ranking sessions)
|
|
status: To Do
|
|
assignee: []
|
|
created_date: '2026-03-16 00:05'
|
|
labels:
|
|
- multiplayer
|
|
- tier-2
|
|
milestone: Multiplayer Everything
|
|
dependencies: []
|
|
parent_task_id: TASK-118
|
|
priority: medium
|
|
---
|
|
|
|
## Description
|
|
|
|
<!-- SECTION:DESCRIPTION:BEGIN -->
|
|
rchoices is currently a stateless voting UI. Add Automerge-backed real-time sync for live collaborative voting sessions.
|
|
|
|
## New files:
|
|
- `modules/rchoices/schemas.ts` — ChoicesDoc with votingSessions, votes, rankings
|
|
- `modules/rchoices/local-first-client.ts` — CRUD: createSession, castVote, updateRanking
|
|
|
|
## Schema design:
|
|
```
|
|
ChoicesDoc {
|
|
meta: { module: 'choices', collection: 'sessions', version: 1 }
|
|
sessions: Record<string, { id, title, type: 'vote'|'rank'|'score', options: [], createdBy, createdAt }>
|
|
votes: Record<string, { sessionId, participantDid, choices: Record<optionId, number>, updatedAt }>
|
|
}
|
|
```
|
|
|
|
## Component updates (`folk-choices-*.ts`):
|
|
- Init local-first client, subscribe to doc changes
|
|
- Real-time vote tally updates as participants vote
|
|
- Show participant count and live results
|
|
<!-- SECTION:DESCRIPTION:END -->
|
|
|
|
## Acceptance Criteria
|
|
<!-- AC:BEGIN -->
|
|
- [ ] #1 Voting sessions sync in real-time between participants
|
|
- [ ] #2 Vote tallies update live as votes come in
|
|
- [ ] #3 Session creator can configure vote type (single/multi/ranked)
|
|
- [ ] #4 Demo mode works with local-only state
|
|
<!-- AC:END -->
|