summaryrefslogtreecommitdiff
path: root/frontend/src/containers/lobby.js
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-05-14 18:43:58 +0200
committerJoffrey BION <joffrey.bion@gmail.com>2017-05-14 18:43:58 +0200
commitb6f54ed56121aa5435dd813c952b292b25b56bfb (patch)
treeb4c88476393b031f00e9a1398f4f2a352f530341 /frontend/src/containers/lobby.js
parentFix typo in error subscription path (diff)
downloadseven-wonders-b6f54ed56121aa5435dd813c952b292b25b56bfb.tar.gz
seven-wonders-b6f54ed56121aa5435dd813c952b292b25b56bfb.tar.bz2
seven-wonders-b6f54ed56121aa5435dd813c952b292b25b56bfb.zip
Add lobby saga
- Fix lobby's player list updates - Fix lobby's player list order - Add 'start game' button (not restricted to owner yet) Resolves: https://github.com/luxons/seven-wonders/issues/7
Diffstat (limited to 'frontend/src/containers/lobby.js')
-rw-r--r--frontend/src/containers/lobby.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/frontend/src/containers/lobby.js b/frontend/src/containers/lobby.js
index f0df0c44..e326698f 100644
--- a/frontend/src/containers/lobby.js
+++ b/frontend/src/containers/lobby.js
@@ -1,14 +1,14 @@
import React, { Component } from 'react'
import { connect } from 'react-redux'
import Immutable from 'seamless-immutable'
-import { Text } from 'rebass'
+import { Button } from 'rebass'
import PlayerList from '../components/playerList'
class Lobby extends Component {
getTitle() {
if (this.props.currentGame) {
- return this.props.currentGame.name
+ return this.props.currentGame.name + ' — Lobby'
} else {
return 'What are you doing here? You haven\'t joined a game yet!'
}
@@ -17,15 +17,16 @@ class Lobby extends Component {
render() {
return (
<div>
- <Text>{this.getTitle()}</Text>
+ <h2>{this.getTitle()}</h2>
<PlayerList players={this.props.players}/>
+ <Button onClick={this.props.startGame}>Start Game</Button>
</div>
)
}
}
import { getPlayers } from '../redux/players'
-import { getCurrentGame } from '../redux/games'
+import { getCurrentGame, actions } from '../redux/games'
const mapStateToProps = (state) => {
const game = getCurrentGame(state)
@@ -35,6 +36,8 @@ const mapStateToProps = (state) => {
})
}
-const mapDispatchToProps = {}
+const mapDispatchToProps = {
+ startGame: actions.requestStartGame
+}
export default connect(mapStateToProps, mapDispatchToProps)(Lobby)
bgstack15