From 10646b1fe23b89a139e9e013ddf047b5fc11b99f Mon Sep 17 00:00:00 2001 From: jbion Date: Sat, 23 Feb 2019 05:03:31 +0100 Subject: Improve GameScene by showing the hand --- frontend/src/components/game/GameScene.css | 13 ++++++++++ frontend/src/components/game/GameScene.jsx | 38 ++++++++++++++++++++---------- frontend/src/components/game/Hand.css | 26 ++++++++++++++++++++ frontend/src/components/game/Hand.jsx | 34 ++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 frontend/src/components/game/GameScene.css create mode 100644 frontend/src/components/game/Hand.css create mode 100644 frontend/src/components/game/Hand.jsx (limited to 'frontend/src/components/game') diff --git a/frontend/src/components/game/GameScene.css b/frontend/src/components/game/GameScene.css new file mode 100644 index 00000000..525e68fa --- /dev/null +++ b/frontend/src/components/game/GameScene.css @@ -0,0 +1,13 @@ +.gameSceneRoot { + background: url('background-papyrus.jpg') center no-repeat; + background-size: cover; +} + +.fullscreen { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + overflow: auto; +} diff --git a/frontend/src/components/game/GameScene.jsx b/frontend/src/components/game/GameScene.jsx index fb5763db..cf3c91f8 100644 --- a/frontend/src/components/game/GameScene.jsx +++ b/frontend/src/components/game/GameScene.jsx @@ -2,7 +2,7 @@ import { Button, Classes, Intent } from '@blueprintjs/core'; import { List } from 'immutable'; import React, { Component } from 'react'; import { connect } from 'react-redux'; -import type { ApiPlayerTurnInfo } from '../../api/model'; +import type { ApiHandCard, ApiPlayerTurnInfo } from '../../api/model'; import { Game } from '../../models/games'; import { Player } from '../../models/players'; import { actions } from '../../redux/actions/game'; @@ -10,7 +10,9 @@ import { getCurrentTurnInfo } from '../../redux/currentGame'; import { getCurrentGame } from '../../redux/games'; import { getCurrentPlayer, getPlayers } from '../../redux/players'; -import { PlayerList } from '../lobby/PlayerList'; +import { Hand } from './Hand'; + +import './GameScene.css' type GameSceneProps = { game: Game, @@ -20,21 +22,31 @@ type GameSceneProps = { sayReady: () => void } -class GameScenePresenter extends Component { - getTitle() { - if (this.props.game) { - return this.props.game.name + ' — Game'; - } else { - return 'What are you doing here? You haven\'t joined a game yet!'; - } +type GameSceneState = { + selectedCard: ApiHandCard | void +} + +class GameScenePresenter extends Component { + + state = { + selectedCard: null + }; + + selectCard(c: ApiHandCard) { + this.setState({selectedCard: c}) } render() { return ( -
-

{this.getTitle()}

- -