Compare commits

..

No commits in common. "262fa0636d332b3b292337317a3191e0ee8827c4" and "93867c7d794dcbe515b6f32d356c1b6d666805c4" have entirely different histories.

5 changed files with 4 additions and 35 deletions

View File

@ -6,7 +6,6 @@ import GameAction from './Game/GameAction'
import GameBoard from './Game/GameBoard' import GameBoard from './Game/GameBoard'
import NewGame from './Game/NewGame' import NewGame from './Game/NewGame'
import GameMessage from './Game/GameMessage' import GameMessage from './Game/GameMessage'
import Message2Opponent from './Game/Message2Opponent'
export default function Game() { export default function Game() {
@ -21,7 +20,6 @@ export default function Game() {
<GameAction /> <GameAction />
<GameMessage /> <GameMessage />
<GameBoard /> <GameBoard />
<Message2Opponent />
</div> </div>
</div> </div>
) )

View File

@ -17,8 +17,7 @@ export default function Create() {
postData("/api/gameproposal", request) postData("/api/gameproposal", request)
.then((responce) => { .then((responce) => {
console.log("responce", responce) // JSON data parsed by `data.json()` call console.log("responce", responce); // JSON data parsed by `data.json()` call
ctx.clear_Message2Opponent()
}); });
} }
@ -33,7 +32,7 @@ export default function Create() {
} }
function Definitions() { function Definitions() {
const [ctx, dispatchCtx] = React.useContext(AppContext) const [ctx] = React.useContext(AppContext)
const [data] = React.useContext(AppData) const [data] = React.useContext(AppData)
const isCurrentUser = data.isCurrentUser const isCurrentUser = data.isCurrentUser
@ -55,7 +54,7 @@ function Definitions() {
opponentName, opponentName,
opponentColor, opponentColor,
board: null, board: null,
message: ctx.newGame.message message: "let's play a game"
} }
} }
@ -65,7 +64,6 @@ function Definitions() {
isEnabled, isEnabled,
get_GameProposalRequest, get_GameProposalRequest,
clear_Message2Opponent: () => { dispatchCtx({ update: "newGame", message: '' }) }
} }
} }

View File

@ -1,3 +0,0 @@
.message2opponent input{
width: 270px;
}

View File

@ -1,23 +0,0 @@
import './Message2Opponent.css'
import React from 'react'
import { AppContext } from '../../context/app'
export default function Message2Opponent() {
const [ctx, dispatchCtx] = React.useContext(AppContext)
const setMessage = (message) => {
dispatchCtx({ update: "newGame", message })
}
return (
<div className='message2opponent'>
<input
placeholder='Message to opponent'
value={ctx.newGame.message}
maxLength={150}
onChange={e => setMessage(e.target.value)}
/>
</div>
)
}

View File

@ -24,7 +24,6 @@ export const initialState = {
newGame: { newGame: {
whitePlayer: '', whitePlayer: '',
blackPlayer: '', blackPlayer: '',
message: '',
}, },
} }