using correct props instead of internal props for TicTacToeGame.tsx and BattleshipGame.tsx
This commit is contained in:
@@ -1,20 +1,10 @@
|
||||
import React, { useMemo } from "react";
|
||||
import { motion } from "framer-motion";
|
||||
import { useNakama } from "../../providers/NakamaProvider";
|
||||
import { PlayerModel } from "../../interfaces/models";
|
||||
|
||||
import PlacementGrid from "./placement/PlacementGrid";
|
||||
import ShotGrid from "./battle/ShotGrid";
|
||||
|
||||
interface BattleBoardProps {
|
||||
boards: Record<string, { grid: string[][] }>;
|
||||
players: PlayerModel[];
|
||||
myUserId: string | null;
|
||||
turn: number;
|
||||
winner: string | null;
|
||||
gameOver: boolean | null;
|
||||
metadata: Record<string, any>;
|
||||
}
|
||||
import { BattleshipGameProps } from "./props";
|
||||
|
||||
const Fleet: Record<string, number> = {
|
||||
carrier: 5,
|
||||
@@ -33,7 +23,7 @@ export default function BattleshipGame({
|
||||
winner,
|
||||
gameOver,
|
||||
metadata,
|
||||
}: BattleBoardProps) {
|
||||
}: BattleshipGameProps) {
|
||||
const { sendMatchData, matchId } = useNakama();
|
||||
|
||||
const myIndex = players.findIndex((p) => p.user_id === myUserId);
|
||||
|
||||
@@ -2,17 +2,8 @@ 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 "../../interfaces/models";
|
||||
|
||||
interface BoardProps {
|
||||
boards: Record<string, { grid: string[][] }>;
|
||||
turn: number;
|
||||
winner: string | null;
|
||||
gameOver: boolean | null;
|
||||
players: PlayerModel[];
|
||||
myUserId: string | null;
|
||||
onCellClick: (row: number, col: number) => void;
|
||||
}
|
||||
import { TicTacToeGameProps } from "./props";
|
||||
|
||||
export default function TicTacToeGame({
|
||||
boards,
|
||||
@@ -22,7 +13,7 @@ export default function TicTacToeGame({
|
||||
players,
|
||||
myUserId,
|
||||
onCellClick,
|
||||
}: BoardProps) {
|
||||
}: TicTacToeGameProps) {
|
||||
const myIndex = players.findIndex(p => p.user_id === myUserId);
|
||||
const gameReady = players.length === 2;
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user