From d605156a5f61a1fe9d18bac8407cdec4ec0aa9a3 Mon Sep 17 00:00:00 2001 From: Victor Chabbert Date: Mon, 31 Jul 2017 18:48:19 +0200 Subject: Remove containers folder --- frontend/src/containers/gameBrowser.js | 65 ---------------------------------- frontend/src/containers/home.js | 38 -------------------- frontend/src/containers/lobby.js | 42 ---------------------- 3 files changed, 145 deletions(-) delete mode 100644 frontend/src/containers/gameBrowser.js delete mode 100644 frontend/src/containers/home.js delete mode 100644 frontend/src/containers/lobby.js 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, - 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 ( -
- - (this._gameName = e.target.value)} - onClick={this.createGame} - /> - - - Username: - {' '} - {this.props.currentPlayer && this.props.currentPlayer.displayName} - - - - -
- ); - } -} - -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 ( - - (this._username = e.target.value)} - /> - - - ); - } -} - -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 ( -
-

{this.getTitle()}

- - -
- ); - } -} - -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); -- cgit