import React from 'react'; import {Accept, Reject, Cancel} from './GameProposalAction'; import './GameProposal.css'; const State = { WaitForOpponent: "GAME_PROPOSAL_WAIT_FOR_OPPONENT", WaitForYou: "GAME_PROPOSAL_WAIT_FOR_YOU", } const GameProposal = ({games}) => { if (games == null) return

Loading..

// for (const [key, value] of Object.entries(games)) // console.log(key, value); const waitForYou = games .filter(game => game.status === State.WaitForYou) .map(game => { return

from {game.opponentName}, opponentColor {game.opponentColor}
{game.message}

}); const WaitForOpponent = games .filter(game => game.status === State.WaitForOpponent) .map(game => { return

to {game.opponentName}, opponentColor ⛀ ⛂{game.opponentColor}
{game.message}

}); return
{waitForYou} {WaitForOpponent.length > 0 &&
waiting for opponent ({WaitForOpponent.length})
} {WaitForOpponent}
}; export default GameProposal;