From 59f50fd793b8aa73d9fc4425b608e5f8036ee160 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Sun, 5 May 2019 13:43:03 +0200 Subject: Convert game components to TypeScript --- frontend/src/components/game/GameScene.tsx | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 frontend/src/components/game/GameScene.tsx (limited to 'frontend/src/components/game/GameScene.tsx') diff --git a/frontend/src/components/game/GameScene.tsx b/frontend/src/components/game/GameScene.tsx new file mode 100644 index 00000000..465d0840 --- /dev/null +++ b/frontend/src/components/game/GameScene.tsx @@ -0,0 +1,77 @@ +import { Button, Classes, Intent, NonIdealState } from '@blueprintjs/core'; +import { List } from 'immutable'; +import React, { Component } from 'react'; +import { connect } from 'react-redux'; +import { ApiPlayer, ApiPlayerMove, ApiPlayerTurnInfo } from '../../api/model'; +import { GlobalState } from '../../reducers'; +import { actions } from '../../redux/actions/game'; +import { getCurrentTurnInfo } from '../../redux/currentGame'; +import { getCurrentGame } from '../../redux/games'; +import { Board } from './Board'; +import './GameScene.css' +import { Hand } from './Hand'; +import { ProductionBar } from './ProductionBar'; + +type GameSceneStateProps = { + players: List, + turnInfo: ApiPlayerTurnInfo | null, +} + +type GameSceneDispatchProps = { + sayReady: () => void, + prepareMove: (move: ApiPlayerMove) => void, +} + +type GameSceneProps = GameSceneStateProps & GameSceneDispatchProps + +class GameScenePresenter extends Component { + + render() { + return ( +
+ {!this.props.turnInfo && } + {this.props.turnInfo && this.turnInfoScene(this.props.turnInfo)} +
+ ); + } + + turnInfoScene(turnInfo: ApiPlayerTurnInfo) { + let board = turnInfo.table.boards[turnInfo.playerIndex]; + return
+

{turnInfo.message}

+ + + +
+ } +} + +type GamePreStartProps = { + onReadyClicked: () => void +} +const GamePreStart = ({onReadyClicked}: GamePreStartProps) => Click "ready" when you are

} + action={