diff --git a/src/screens/Prologue.jsx b/src/screens/Prologue.jsx new file mode 100644 index 0000000..a31864d --- /dev/null +++ b/src/screens/Prologue.jsx @@ -0,0 +1,71 @@ +import { useState } from 'react' +import { BACKGROUNDS } from '../constants.js' + +// Prologue screen — shown on the 'Prologue' tab. +// If background_id is null: shows background selection UI. +// If background_id is set: shows read-only summary of chosen background. +// Props: +// state — current game state +// onSelectBackground(id) — called when player confirms a background + +export default function Prologue({ state, onSelectBackground }) { + const [selected, setSelected] = useState(null) + const chosen = BACKGROUNDS.find(b => b.id === state.background_id) || null + + // Read-only view — background already chosen + if (chosen) { + return ( +
+
+ Your origin +

{chosen.name}

+ {chosen.latin} +
+

{chosen.summary}

+
+ Starting funds: {chosen.starting_den} denarii +
+
+ ) + } + + // Selection view — background_id is null + return ( +
+
+ Before the first dispatch +

Who were you?

+

+ Your background shapes your starting parameters. This choice is permanent. +

+
+ +
+ {BACKGROUNDS.map(bg => ( + + ))} +
+ +
+ +
+
+ ) +}