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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user