diff options
author | jbion <joffrey.bion@amadeus.com> | 2019-02-26 18:27:08 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-02-26 18:27:30 +0100 |
commit | d80dc8c4cbe24f14f6c57463fb6aba11d2b5cad2 (patch) | |
tree | a8d6aba65573d72aaae968a7f341ab8a14b0a2e4 | |
parent | Move wonder images to frontend (diff) | |
download | seven-wonders-d80dc8c4cbe24f14f6c57463fb6aba11d2b5cad2.tar.gz seven-wonders-d80dc8c4cbe24f14f6c57463fb6aba11d2b5cad2.tar.bz2 seven-wonders-d80dc8c4cbe24f14f6c57463fb6aba11d2b5cad2.zip |
Hide start button for non-game owners and disable while we can't start
-rw-r--r-- | frontend/src/components/lobby/Lobby.jsx | 5 | ||||
-rw-r--r-- | frontend/src/models/players.js | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/frontend/src/components/lobby/Lobby.jsx b/frontend/src/components/lobby/Lobby.jsx index df6557af..f352ab83 100644 --- a/frontend/src/components/lobby/Lobby.jsx +++ b/frontend/src/components/lobby/Lobby.jsx @@ -1,5 +1,5 @@ //@flow -import { Button } from '@blueprintjs/core'; +import { Button, Classes, Intent } from '@blueprintjs/core'; import { List } from 'immutable'; import React, { Component } from 'react'; import { connect } from 'react-redux'; @@ -25,7 +25,8 @@ class LobbyPresenter extends Component<LobbyProps> { <div> <h2>{currentGame.name + ' — Lobby'}</h2> <RadialPlayerList players={players} owner={currentGame.owner} currentPlayer={currentPlayer}/> - <Button onClick={startGame}>Start Game</Button> + {currentPlayer.gameOwner && <Button text="START" className={Classes.LARGE} intent={Intent.PRIMARY} icon='play' + onClick={startGame} disabled={players.size < 3}/>} </div> ); } diff --git a/frontend/src/models/players.js b/frontend/src/models/players.js index 2af6b0f7..587300f5 100644 --- a/frontend/src/models/players.js +++ b/frontend/src/models/players.js @@ -5,7 +5,9 @@ export type PlayerShape = { username: string, displayName: string, index: number, - ready: boolean + ready: boolean, + gameOwner: boolean, + user: boolean, }; export type PlayerType = Record<PlayerShape>; @@ -14,6 +16,8 @@ const PlayerRecord: PlayerType = Record({ displayName: null, index: 0, ready: false, + gameOwner: false, + user: false, }); // $FlowFixMe export class Player extends PlayerRecord {} |