66 lines
2.2 KiB
Markdown
66 lines
2.2 KiB
Markdown
---
|
|
status: planned
|
|
created: '2026-03-16'
|
|
tags:
|
|
- sharing
|
|
- web
|
|
priority: medium
|
|
created_at: '2026-03-16T07:51:51.015Z'
|
|
depends_on:
|
|
- 005-poll-creation-management
|
|
- 008-voting-system
|
|
- 012-lightweight-server
|
|
updated_at: '2026-03-16T07:57:41.176Z'
|
|
related:
|
|
- 011-mobile-first-ui
|
|
---
|
|
|
|
# Public Sharing & Read-Only View
|
|
|
|
> **Status**: 🗓️ Planned · **Priority**: Medium · **Created**: 2026-03-16 · **Tags**: sharing, web
|
|
|
|
## Overview
|
|
|
|
Make polls shareable via URL to anyone on the web—even non-users. A public link shows poll results in a read-only view. If the poll owner is online, results update live via WebRTC. If offline, the page shows a cached snapshot.
|
|
|
|
## Design
|
|
|
|
### Shareable URL
|
|
|
|
- Format: `https://evocracy.app/p/[pollId]`
|
|
- Anyone with the link can view (no identity required)
|
|
- The page fetches the snapshot from the server (includes `ownerPeerId`), then attempts a PeerJS connection for live data
|
|
- Falls back to a static snapshot if owner is offline
|
|
|
|
### Snapshot Strategy
|
|
|
|
- When a poll is shared publicly, the owner's client pushes a JSON snapshot to the lightweight server (same server as spec 007 directory)
|
|
- Endpoint: `PUT /api/polls/:id/snapshot` (authenticated by owner's signature)
|
|
- Public fetch: `GET /api/polls/:id/snapshot` (no auth required)
|
|
- Snapshot is updated whenever poll state changes while owner is online
|
|
- Snapshot includes: title, description, options, vote counts, status (no voter identities even for non-anonymous)
|
|
|
|
### Public View Page
|
|
|
|
- Read-only: title, description, options with vote counts/percentages
|
|
- Visual bar chart of results
|
|
- "Owner offline" indicator if can't connect
|
|
- Open Graph meta tags for social media previews
|
|
- Optional: "Join to vote" CTA linking to app
|
|
|
|
## Plan
|
|
|
|
- [ ] Create `/p/[id]` public route (SvelteKit SSR or client-side)
|
|
- [ ] Implement PeerJS connection attempt for live data
|
|
- [ ] Build read-only results view
|
|
- [ ] Add Open Graph meta tags for link previews
|
|
- [ ] Implement snapshot fallback (based on decision above)
|
|
- [ ] Add "Share" button to poll management page (copy link)
|
|
|
|
## Test
|
|
|
|
- [ ] Public URL shows poll results without authentication
|
|
- [ ] Live updates work when owner is online
|
|
- [ ] Graceful fallback when owner is offline
|
|
- [ ] Social media link preview shows poll title/description
|