Phase 7: maps & VTT

- BattleMap entity (image dataURL, grid, tokens, fog) — Dexie v5, repo, hook,
  cascade-deleted with campaign
- Maps page: upload image (8MB cap), per-campaign list
- Map editor canvas: grid overlay (toggle + cell size), fog of war (canvas) with
  reveal/hide painting + reveal-all/hide-all, draggable tokens that snap to the
  grid (pointer events, touch+mouse), add/remove tokens; debounced autosave
- Dashboard + routes get a Maps entry

New maps e2e (upload, add token, toggle fog).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-08 02:01:29 +02:00
parent 522ff8abce
commit 1632018ce9
9 changed files with 354 additions and 5 deletions
+5 -1
View File
@@ -3,7 +3,7 @@ import type { Campaign } from '@/lib/schemas/campaign';
import type { Character } from '@/lib/schemas/character';
import type { Encounter } from '@/lib/schemas/encounter';
import type { DiceRoll } from '@/lib/schemas/dice';
import type { Note, Npc, Quest, Calendar } from '@/lib/schemas/world';
import type { Note, Npc, Quest, Calendar, BattleMap } from '@/lib/schemas/world';
import { characterDefaults } from '@/lib/schemas/character';
/**
@@ -23,6 +23,7 @@ export class TtrpgDatabase extends Dexie {
npcs!: EntityTable<Npc, 'id'>;
quests!: EntityTable<Quest, 'id'>;
calendars!: EntityTable<Calendar, 'campaignId'>;
maps!: EntityTable<BattleMap, 'id'>;
constructor() {
super('ttrpg-manager');
@@ -62,6 +63,9 @@ export class TtrpgDatabase extends Dexie {
quests: 'id, campaignId, status',
calendars: 'campaignId',
});
// v5 — Phase 7 maps/VTT.
this.version(5).stores({ maps: 'id, campaignId' });
}
}