summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/js/src/containers/GameBrowser/index.js26
-rw-r--r--src/main/js/src/containers/GameBrowser/reducer.js6
-rw-r--r--src/main/js/src/containers/GameBrowser/saga.js1
3 files changed, 26 insertions, 7 deletions
diff --git a/src/main/js/src/containers/GameBrowser/index.js b/src/main/js/src/containers/GameBrowser/index.js
index 34a50d53..f9b3b29c 100644
--- a/src/main/js/src/containers/GameBrowser/index.js
+++ b/src/main/js/src/containers/GameBrowser/index.js
@@ -1,11 +1,33 @@
import React, { Component } from 'react'
+import { connect } from 'react-redux'
+import { Flex } from 'reflexbox'
+import { Text, Space } from 'rebass'
class GameBrowser extends Component {
+
+ listGames = (games) => {
+ return Object.keys(games).map(key => {
+ const game = games[key]
+ console.log('game', game, key)
+ return (<Flex key={key}>
+ <Text>{game.name}</Text>
+ <Space auto />
+ <a href="#">Join</a>
+ </Flex>)
+ })
+ }
+
render() {
return (
- <div>Game Browser</div>
+ <div>
+ {this.listGames(this.props.games)}
+ </div>
)
}
}
-export default GameBrowser \ No newline at end of file
+const mapStateToProps = (state) => ({
+ games: state.games
+})
+
+export default connect(mapStateToProps, {})(GameBrowser)
diff --git a/src/main/js/src/containers/GameBrowser/reducer.js b/src/main/js/src/containers/GameBrowser/reducer.js
index 533f6455..5f98bfad 100644
--- a/src/main/js/src/containers/GameBrowser/reducer.js
+++ b/src/main/js/src/containers/GameBrowser/reducer.js
@@ -1,7 +1,6 @@
import { NEW_GAME } from './constants'
const initialState = {
- games: {}
}
export default function reducer(state = initialState, action) {
@@ -9,10 +8,7 @@ export default function reducer(state = initialState, action) {
case NEW_GAME:
return {
...state,
- games: {
- ...state.games,
- [action.game.id]: action.game
- }
+ [action.game.id]: action.game
}
default:
return state
diff --git a/src/main/js/src/containers/GameBrowser/saga.js b/src/main/js/src/containers/GameBrowser/saga.js
index da45c3a3..f09b5932 100644
--- a/src/main/js/src/containers/GameBrowser/saga.js
+++ b/src/main/js/src/containers/GameBrowser/saga.js
@@ -45,6 +45,7 @@ export function* watchOnNewGames() {
while (true) {
const { type, response } = yield take(socketChannel)
+ console.info('RESPONSE', response)
switch (type) {
case NEW_GAME:
yield put(newGame(response))
bgstack15