T012–T016: Phase 3 application + web shell (use case, ports, React hook, UI, README)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-03 13:11:33 +01:00
parent 42a07a07ff
commit 4c2e0a47e6
7 changed files with 150 additions and 7 deletions

View File

@@ -1,3 +1,43 @@
import { useEncounter } from "./hooks/use-encounter";
export function App() {
return <div>Initiative Tracker</div>;
const { encounter, events, advanceTurn } = useEncounter();
const activeCombatant = encounter.combatants[encounter.activeIndex];
return (
<div>
<h1>Initiative Tracker</h1>
<p>
Round {encounter.roundNumber} Current: {activeCombatant.name}
</p>
<ul>
{encounter.combatants.map((c, i) => (
<li key={c.id}>
{i === encounter.activeIndex ? `${c.name}` : c.name}
</li>
))}
</ul>
<button type="button" onClick={advanceTurn}>
Next Turn
</button>
{events.length > 0 && (
<div>
<h2>Events</h2>
<ul>
{events.map((e, i) => (
<li key={`${e.type}-${i}`}>
{e.type === "TurnAdvanced"
? `Turn: ${e.previousCombatantId}${e.newCombatantId} (round ${e.roundNumber})`
: `Round advanced to ${e.newRoundNumber}`}
</li>
))}
</ul>
</div>
)}
</div>
);
}