summaryrefslogtreecommitdiff
path: root/frontend/src/components/game-browser
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/game-browser')
-rw-r--r--frontend/src/components/game-browser/GameList.jsx11
-rw-r--r--frontend/src/components/game-browser/GameStatus.jsx4
-rw-r--r--frontend/src/components/game-browser/PlayerInfo.jsx15
3 files changed, 16 insertions, 14 deletions
diff --git a/frontend/src/components/game-browser/GameList.jsx b/frontend/src/components/game-browser/GameList.jsx
index 64ced9b0..b46cd14c 100644
--- a/frontend/src/components/game-browser/GameList.jsx
+++ b/frontend/src/components/game-browser/GameList.jsx
@@ -2,7 +2,8 @@
import type { List } from 'immutable';
import React from 'react';
import { connect } from 'react-redux';
-import type { Game } from '../../models/games';
+import type { ApiLobby } from '../../api/model';
+import type { GlobalState } from '../../reducers';
import { actions } from '../../redux/actions/lobby';
import { getAllGames } from '../../redux/games';
import { IconButton } from '../shared/IconButton';
@@ -11,7 +12,7 @@ import { GameStatus } from './GameStatus';
import { PlayerCount } from './PlayerCount';
type GameListProps = {
- games: List<Game>,
+ games: List<ApiLobby>,
joinGame: (gameId: string) => void,
};
@@ -21,7 +22,7 @@ const GameListPresenter = ({ games, joinGame }: GameListProps) => (
<GameListHeaderRow />
</thead>
<tbody>
- {games.map((game: Game) => <GameListItemRow key={game.id} game={game} joinGame={joinGame}/>)}
+ {games.map((game: ApiLobby) => <GameListItemRow key={game.id} game={game} joinGame={joinGame}/>)}
</tbody>
</table>
);
@@ -56,8 +57,8 @@ const JoinButton = ({game, joinGame}) => {
return <IconButton minimal disabled={disabled} icon='arrow-right' title='Join Game' onClick={onClick}/>;
};
-const mapStateToProps = state => ({
- games: getAllGames(state.get('games')),
+const mapStateToProps = (state: GlobalState) => ({
+ games: getAllGames(state),
});
const mapDispatchToProps = {
diff --git a/frontend/src/components/game-browser/GameStatus.jsx b/frontend/src/components/game-browser/GameStatus.jsx
index 749d3cfa..fc14bbf6 100644
--- a/frontend/src/components/game-browser/GameStatus.jsx
+++ b/frontend/src/components/game-browser/GameStatus.jsx
@@ -1,10 +1,10 @@
//@flow
import { Tag } from '@blueprintjs/core';
import * as React from 'react';
-import type { GameState } from '../../models/games';
+import type { ApiGameState } from '../../api/model';
type GameStatusProps = {
- state: GameState,
+ state: ApiGameState,
}
export const GameStatus = ({state}: GameStatusProps) => (
diff --git a/frontend/src/components/game-browser/PlayerInfo.jsx b/frontend/src/components/game-browser/PlayerInfo.jsx
index 2f29ea60..baee67c1 100644
--- a/frontend/src/components/game-browser/PlayerInfo.jsx
+++ b/frontend/src/components/game-browser/PlayerInfo.jsx
@@ -2,23 +2,24 @@
import { Text } from '@blueprintjs/core';
import React from 'react';
import { connect } from 'react-redux';
-import type { Player } from '../../models/players';
-import { getCurrentPlayer } from '../../redux/players';
+import type { GlobalState } from '../../reducers';
+import type { User } from '../../redux/user';
+import { getCurrentUser } from '../../redux/user';
type PlayerInfoProps = {
- player: ?Player,
+ user: ?User,
}
-const PlayerInfoPresenter = ({player}: PlayerInfoProps) => (
+const PlayerInfoPresenter = ({user}: PlayerInfoProps) => (
<Text>
<b>Username:</b>
{' '}
- {player && player.displayName}
+ {user && user.displayName}
</Text>
);
-const mapStateToProps = state => ({
- player: getCurrentPlayer(state),
+const mapStateToProps = (state: GlobalState): PlayerInfoProps => ({
+ user: getCurrentUser(state),
});
const mapDispatchToProps = {
bgstack15