diff --git a/src/components/App.tsx b/src/components/App.tsx index 3c4573d..951569b 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,5 +1,41 @@ +import { useState, useRef } from "react"; +import { Difficulty } from "../types"; +import { GameStateManager } from "../game/state"; +import { Menu } from "./Menu"; +import { DifficultySelect } from "./DifficultySelect"; + +type Screen = "menu" | "difficulty" | "game" | "gameover"; + function App() { - return
Pikachu Onet Connect
; + const [screen, setScreen] = useState("menu"); + const [difficulty, setDifficulty] = useState("easy"); + const stateManager = useRef(new GameStateManager()).current; + + const handleSelectDifficulty = (d: Difficulty) => { + setDifficulty(d); + stateManager.startGame(d); + setScreen("game"); + }; + + return ( +
+ {screen === "menu" && ( + setScreen("difficulty")} /> + )} + {screen === "difficulty" && ( + setScreen("menu")} + /> + )} + {screen === "game" && ( +
Game placeholder — {difficulty}
+ )} + {screen === "gameover" && ( +
Game Over placeholder
+ )} +
+ ); } export default App; diff --git a/src/components/DifficultySelect.tsx b/src/components/DifficultySelect.tsx new file mode 100644 index 0000000..42f9108 --- /dev/null +++ b/src/components/DifficultySelect.tsx @@ -0,0 +1,63 @@ +import { Difficulty } from "../types"; + +interface DifficultySelectProps { + onSelect: (difficulty: Difficulty) => void; + onBack: () => void; +} + +const difficulties: { key: Difficulty; label: string; desc: string }[] = [ + { key: "easy", label: "Easy", desc: "6×4 grid • 5 min • 5 hints" }, + { key: "medium", label: "Medium", desc: "8×6 grid • 4 min • 3 hints" }, + { key: "hard", label: "Hard", desc: "10×8 grid • 3 min • 1 hint" }, +]; + +export function DifficultySelect({ onSelect, onBack }: DifficultySelectProps) { + return ( +
+

Select Difficulty

+
+ {difficulties.map((d) => ( + + ))} +
+ +
+ ); +} diff --git a/src/components/Menu.tsx b/src/components/Menu.tsx new file mode 100644 index 0000000..5a3a4aa --- /dev/null +++ b/src/components/Menu.tsx @@ -0,0 +1,33 @@ +interface MenuProps { + onPlay: () => void; +} + +export function Menu({ onPlay }: MenuProps) { + return ( +
+

⚡ Pikachu Onet Connect

+

+ Match pairs of tiles by connecting them with up to 3 lines +

+ +
+ ); +}