Phase 8: player view (local/projector) + sync seam
- Player View (/play): read-only projector screen — party HP bars + conditions, active-encounter initiative with current turn; enemy HP hidden behind a Healthy/Bloodied/Down status band; Fullscreen button - SyncAdapter seam (src/lib/sync): local-first default via Dexie liveQuery; documents where a future networked (WebSocket/CRDT) backend plugs in - Dashboard + routes get a Player View entry - Robustness: encountersRepo.mutate() does transactional read-modify-write so rapid combat mutations can't overwrite each other (old C19 race); tracker uses it New player-view e2e. Networked multiplayer backend intentionally deferred. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,8 @@ export function EncounterTracker({ encounter, campaign }: { encounter: Encounter
|
||||
const mutate = (fn: (e: Encounter) => Encounter) => {
|
||||
undoStack.current.push(encounter);
|
||||
if (undoStack.current.length > 50) undoStack.current.shift();
|
||||
void encountersRepo.save(fn(encounter));
|
||||
// Transactional read-modify-write so rapid mutations can't clobber each other.
|
||||
void encountersRepo.mutate(encounter.id, fn);
|
||||
};
|
||||
const undo = () => {
|
||||
const prev = undoStack.current.pop();
|
||||
|
||||
Reference in New Issue
Block a user