ed3d967526
- New entities (note/npc/quest/calendar): schemas, Dexie v4 tables, repos, hooks; campaign cascade-delete now covers them all - Dashboard hub: campaign stats, navigation cards, party overview, recent rolls; opening a campaign lands here - Notes/Wiki: tags, [[wiki-links]] with click-to-open/create, backlinks panel, full-text search, autosave - NPC manager (role/location/faction/status) and Quest tracker (status + objectives checklist + reward) - In-world Calendar: integer day counter + events (no real Date -> no timezone bug) - Fix: calendarRepo.get is read-only (creating-on-read crashed inside liveQuery) 8 new unit tests (wikilinks + extended cascade), worldbuilding e2e. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 lines
787 B
TypeScript
17 lines
787 B
TypeScript
import { useLiveQuery } from 'dexie-react-hooks';
|
|
import { notesRepo, npcsRepo, questsRepo, calendarRepo } from '@/lib/db/repositories';
|
|
import type { Note, Npc, Quest, Calendar } from '@/lib/schemas';
|
|
|
|
export function useNotes(campaignId: string): Note[] {
|
|
return useLiveQuery(() => notesRepo.listByCampaign(campaignId), [campaignId], []);
|
|
}
|
|
export function useNpcs(campaignId: string): Npc[] {
|
|
return useLiveQuery(() => npcsRepo.listByCampaign(campaignId), [campaignId], []);
|
|
}
|
|
export function useQuests(campaignId: string): Quest[] {
|
|
return useLiveQuery(() => questsRepo.listByCampaign(campaignId), [campaignId], []);
|
|
}
|
|
export function useCalendar(campaignId: string): Calendar | undefined {
|
|
return useLiveQuery(() => calendarRepo.get(campaignId), [campaignId], undefined);
|
|
}
|