feat(battleship): add complete Battleship game UI with placement & battle phases

- Implement BattleshipBoard with phase-based rendering (placement/battle)
- Add PlacementGrid for ship placement interaction
- Add ShotGrid for firing UI with turn validation
- Integrate match metadata (pX_placed, pX_ready, phase)
- Connect UI to Nakama sendMatchData (place + shoot actions)
- Add real-time board rendering for ships and shots
- Add status line, turn handling, and winner display
- Ensure compatibility with new backend ApplyMove/ApplyPlacement logic
This commit is contained in:
2025-12-03 19:27:47 +05:30
parent 2b0af9fd1f
commit fe1cacb5ed
8 changed files with 882 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import React from "react";
import { motion } from "framer-motion";
interface StatusBarProps {
text: string;
}
export default function StatusBar({ text }: StatusBarProps) {
return (
<motion.div
key={text}
initial={{ opacity: 0, y: -6 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25 }}
style={{
marginBottom: 8,
fontSize: "18px",
textAlign: "center",
}}
>
{text}
</motion.div>
);
}