diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-04-06 18:55:25 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-04-06 18:55:58 +0200 |
commit | d4d20533556928f63c8759437f67e76336bab55e (patch) | |
tree | 34e7bb151b5d21497665131b6ab8d875254e7666 /sw-ui/src/components/lobby/Lobby.tsx | |
parent | Refactoring in GameScene.kt (diff) | |
download | seven-wonders-d4d20533556928f63c8759437f67e76336bab55e.tar.gz seven-wonders-d4d20533556928f63c8759437f67e76336bab55e.tar.bz2 seven-wonders-d4d20533556928f63c8759437f67e76336bab55e.zip |
Delete old React/TypeScript UI
Diffstat (limited to 'sw-ui/src/components/lobby/Lobby.tsx')
-rw-r--r-- | sw-ui/src/components/lobby/Lobby.tsx | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/sw-ui/src/components/lobby/Lobby.tsx b/sw-ui/src/components/lobby/Lobby.tsx deleted file mode 100644 index 3594af65..00000000 --- a/sw-ui/src/components/lobby/Lobby.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Button, Classes, Intent } from '@blueprintjs/core'; -import { List } from 'immutable'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { ApiLobby, ApiPlayer } from '../../api/model'; -import { GlobalState } from '../../reducers'; -import { actions } from '../../redux/actions/lobby'; -import { getCurrentGame } from '../../redux/games'; -import { getCurrentPlayer } from '../../redux/user'; -import { RadialPlayerList } from './RadialPlayerList'; - -export type LobbyStateProps = { - currentGame: ApiLobby | null, - currentPlayer: ApiPlayer | null, - players: List<ApiPlayer>, -} - -export type LobbyDispatchProps = { - startGame: () => void, -} - -export type LobbyProps = LobbyStateProps & LobbyDispatchProps - -class LobbyPresenter extends Component<LobbyProps> { - - render() { - const {currentGame, currentPlayer, players, startGame} = this.props; - if (!currentGame || !currentPlayer) { - return <div>Error: no current game.</div> - } - return ( - <div> - <h2>{currentGame.name + ' — Lobby'}</h2> - <RadialPlayerList players={players}/> - {currentPlayer.gameOwner && <Button text="START" className={Classes.LARGE} intent={Intent.PRIMARY} icon='play' - onClick={startGame} disabled={players.size < 3}/>} - </div> - ); - } -} - -function mapStateToProps(state: GlobalState): LobbyStateProps { - const game = getCurrentGame(state); - console.info(game); - return { - currentGame: game, - currentPlayer: getCurrentPlayer(state), - players: game ? List(game.players) : List(), - }; -} - -const mapDispatchToProps = { - startGame: actions.requestStartGame, -}; - -export const Lobby = connect(mapStateToProps, mapDispatchToProps)(LobbyPresenter); |