renamed BattleShipGame.tsx to BattleshipGame.tsx to match props name. using props interface for both instead of using commonProps

This commit is contained in:
2025-12-04 19:22:07 +05:30
parent 06bdc92190
commit fc7cb8efb6
3 changed files with 15 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import { useNakama } from "./providers/NakamaProvider";
import Player from "./Player";
import TicTacToeGame from "./games/tictactoe/TicTacToeGame";
import { TicTacToeGameProps } from "./games/tictactoe/props";
import BattleShipGame from "./games/battleship/BattleShipGame";
import BattleshipGame from "./games/battleship/BattleshipGame"
import { BattleshipGameProps } from "./games/battleship/props";
import { GameState } from "./interfaces/states";
@@ -33,6 +33,14 @@ export default function App() {
players: game.players,
myUserId: session?.user_id ?? null,
};
const ticTacToeProps: TicTacToeGameProps = {
...commonProps,
onCellClick: handleCellClick,
};
const battleshipProps: BattleshipGameProps = {
...commonProps,
metadata: game.metadata,
};
// ---------------------------------------------------
// RENDER GAME BOARD
@@ -44,16 +52,14 @@ export default function App() {
case "tictactoe":
return (
<TicTacToeGame
{...commonProps}
onCellClick={handleCellClick}
{...ticTacToeProps}
/>
);
case "battleship":
return (
<BattleShipGame
{...commonProps}
metadata={game.metadata}
<BattleshipGame
{...battleshipProps}
/>
);

View File

@@ -1,7 +1,7 @@
import React, { useMemo } from "react";
import { motion } from "framer-motion";
import { useNakama } from "../../providers/NakamaProvider";
import { PlayerModel } from "../../models/player";
import { PlayerModel } from "../../interfaces/models";
import PlacementGrid from "./placement/PlacementGrid";
import ShotGrid from "./battle/ShotGrid";
@@ -25,7 +25,7 @@ const Fleet: Record<string, number> = {
};
const FLEET_ORDER = ["carrier", "battleship", "cruiser", "submarine", "destroyer"];
export default function BattleShipGame({
export default function BattleshipGame({
boards,
players,
myUserId,

View File

@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { useNakama } from "../../providers/NakamaProvider";
import getHaiku from "../../utils/haikus";
import { PlayerModel } from "../../models/player";
import { PlayerModel } from "../../interfaces/models";
interface BoardProps {
boards: Record<string, { grid: string[][] }>;