import { Redo2, StepBack, StepForward, Trash2, Undo2 } from "lucide-react"; import { useState } from "react"; import { useEncounterContext } from "../contexts/encounter-context.js"; import { useRulesEditionContext } from "../contexts/rules-edition-context.js"; import { useDifficulty } from "../hooks/use-difficulty.js"; import { DifficultyBreakdownPanel } from "./difficulty-breakdown-panel.js"; import { DifficultyIndicator, TIER_LABELS_5_5E, TIER_LABELS_2014, } from "./difficulty-indicator.js"; import { Button } from "./ui/button.js"; import { ConfirmButton } from "./ui/confirm-button.js"; export function TurnNavigation() { const { encounter, advanceTurn, retreatTurn, clearEncounter, undo, redo, canUndo, canRedo, } = useEncounterContext(); const difficulty = useDifficulty(); const { edition } = useRulesEditionContext(); const tierLabels = edition === "5e" ? TIER_LABELS_2014 : TIER_LABELS_5_5E; const [showBreakdown, setShowBreakdown] = useState(false); const hasCombatants = encounter.combatants.length > 0; const isAtStart = encounter.roundNumber === 1 && encounter.activeIndex === 0; const activeCombatant = encounter.combatants[encounter.activeIndex]; return (
{/* Left zone: navigation + history + round */}
R{encounter.roundNumber}
{/* Center zone: active combatant name */}
{activeCombatant ? ( {activeCombatant.name} ) : ( No combatants )}
{/* Right zone: difficulty + destructive + forward */}
{difficulty && (
setShowBreakdown((prev) => !prev)} /> {showBreakdown ? ( setShowBreakdown(false)} /> ) : null}
)} } label="Clear encounter" onConfirm={clearEncounter} disabled={!hasCombatants} className="text-muted-foreground" />
); }