Implement the 012-turn-navigation feature that adds a RetreatTurn domain operation and relocates turn controls to a navigation bar at the top of the encounter tracker

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-05 23:11:11 +01:00
parent a0d85a07e3
commit 7d440677be
19 changed files with 946 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import {
advanceTurnUseCase,
editCombatantUseCase,
removeCombatantUseCase,
retreatTurnUseCase,
setHpUseCase,
setInitiativeUseCase,
} from "@initiative/application";
@@ -79,6 +80,16 @@ export function useEncounter() {
setEvents((prev) => [...prev, ...result]);
}, [makeStore]);
const retreatTurn = useCallback(() => {
const result = retreatTurnUseCase(makeStore());
if (isDomainError(result)) {
return;
}
setEvents((prev) => [...prev, ...result]);
}, [makeStore]);
const nextId = useRef(deriveNextId(encounter));
const addCombatant = useCallback(
@@ -164,6 +175,7 @@ export function useEncounter() {
encounter,
events,
advanceTurn,
retreatTurn,
addCombatant,
removeCombatant,
editCombatant,