diff options
-rw-r--r-- | frontend/src/containers/gameBrowser.js | 65 | ||||
-rw-r--r-- | frontend/src/containers/home.js | 38 | ||||
-rw-r--r-- | frontend/src/containers/lobby.js | 42 |
3 files changed, 0 insertions, 145 deletions
diff --git a/frontend/src/containers/gameBrowser.js b/frontend/src/containers/gameBrowser.js deleted file mode 100644 index a21d2e29..00000000 --- a/frontend/src/containers/gameBrowser.js +++ /dev/null @@ -1,65 +0,0 @@ -// @flow -import type { List } from 'immutable'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { InlineForm, Space, Text } from 'rebass'; -import { Flex } from 'reflexbox'; -import GameList from '../components/gameList'; -import type { Games } from '../models/games'; -import type { Player } from '../models/players'; -import { actions, getAllGames } from '../redux/games'; -import { getCurrentPlayer } from '../redux/players'; - -class GameBrowser extends Component { - props: { - currentPlayer: Player, - games: List<Games>, - createGame: (gameName: string) => void, - joinGame: (gameId: string) => void - }; - - _gameName: string | void = undefined; - - createGame = (e: SyntheticEvent): void => { - e.preventDefault(); - if (this._gameName !== undefined) { - this.props.createGame(this._gameName); - } - }; - - render() { - return ( - <div> - <Flex align="center" p={1}> - <InlineForm - buttonLabel="Create Game" - label="Game name" - name="game_name" - onChange={(e: SyntheticInputEvent) => (this._gameName = e.target.value)} - onClick={this.createGame} - /> - <Space auto /> - <Text> - <b>Username:</b> - {' '} - {this.props.currentPlayer && this.props.currentPlayer.displayName} - </Text> - <Space x={1} /> - </Flex> - <GameList games={this.props.games} joinGame={this.props.joinGame} /> - </div> - ); - } -} - -const mapStateToProps = state => ({ - currentPlayer: getCurrentPlayer(state.get('players')), - games: getAllGames(state.get('games')), -}); - -const mapDispatchToProps = { - createGame: actions.requestCreateGame, - joinGame: actions.requestJoinGame, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(GameBrowser); diff --git a/frontend/src/containers/home.js b/frontend/src/containers/home.js deleted file mode 100644 index f60c1c52..00000000 --- a/frontend/src/containers/home.js +++ /dev/null @@ -1,38 +0,0 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { Button, Container, Input } from 'rebass'; -import { actions } from '../redux/players'; - -class HomePage extends Component { - play = e => { - e.preventDefault(); - if (this._username !== undefined) { - this.props.chooseUsername(this._username); - } - }; - - render() { - return ( - <Container> - <Input - name="username" - label="Username" - placeholder="Username" - hideLabel - onChange={e => (this._username = e.target.value)} - /> - <Button backgroundColor="primary" color="white" big onClick={this.play}> - PLAY NOW! - </Button> - </Container> - ); - } -} - -const mapStateToProps = state => ({}); - -const mapDispatchToProps = { - chooseUsername: actions.chooseUsername, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(HomePage); diff --git a/frontend/src/containers/lobby.js b/frontend/src/containers/lobby.js deleted file mode 100644 index bf0cb031..00000000 --- a/frontend/src/containers/lobby.js +++ /dev/null @@ -1,42 +0,0 @@ -import { List } from 'immutable'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { Button } from 'rebass'; -import PlayerList from '../components/playerList'; -import { actions, getCurrentGame } from '../redux/games'; -import { getPlayers } from '../redux/players'; - -class Lobby extends Component { - getTitle() { - if (this.props.currentGame) { - return this.props.currentGame.name + ' — Lobby'; - } else { - return 'What are you doing here? You haven\'t joined a game yet!'; - } - } - - render() { - return ( - <div> - <h2>{this.getTitle()}</h2> - <PlayerList players={this.props.players} /> - <Button onClick={this.props.startGame}>Start Game</Button> - </div> - ); - } -} - -const mapStateToProps = state => { - const game = getCurrentGame(state.get('games')); - console.info(game); - return { - currentGame: game, - players: game ? getPlayers(state.get('players'), game.players) : new List(), - }; -}; - -const mapDispatchToProps = { - startGame: actions.requestStartGame, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(Lobby); |