From e4498c56048c44d1dae41d27c3213f94ccb027a8 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Wed, 21 Jul 2021 23:33:04 +0530 Subject: Implemented basic connection between client and server using websockets --- src/components/App.tsx | 42 ++++++++++++++++++++---- src/components/Grid.tsx | 2 +- src/components/MultiplayerGrid.tsx | 66 ++++++++++++++++++++++++++++++++++++++ src/server/index.js | 12 +++++-- 4 files changed, 113 insertions(+), 9 deletions(-) create mode 100644 src/components/MultiplayerGrid.tsx diff --git a/src/components/App.tsx b/src/components/App.tsx index 6a9c60e..1f646b3 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -9,8 +9,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . @@ -20,20 +19,51 @@ import React, { useState } from 'react'; import MessageBox from './MessageBox'; import ScoreBoard from './ScoreBoard'; import Grid from './Grid'; +import MultiplayerGrid from './MultiplayerGrid'; import Footer from './Footer'; import './style.css'; const App: React.FC = () => { const [scoreX, setScoreX] = useState(0); const [scoreO, setScoreO] = useState(0); - const [turn, setTurn] = useState(0); + const [turn, setTurn] = useState(1); const [showMessageBox, setShowMessageBox] = useState(false); const [message, setMessage] = useState(""); + const mp: boolean = true; return ( <> - {showMessageBox && } - - + {showMessageBox && + + } + + + + {mp ? : + } +