diff options
author | jbion <joffrey.bion@amadeus.com> | 2019-02-27 03:12:55 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-02-27 03:12:55 +0100 |
commit | 8d73d21108738754efd07b63ecc7368fd49502fa (patch) | |
tree | 8755dd1aa9c61e9f473fd6787ba8f3595006f0fa /frontend/src/components/game-browser/GameList.jsx | |
parent | Remove unnecessary Jackson annotation on non-DTOs (diff) | |
download | seven-wonders-8d73d21108738754efd07b63ecc7368fd49502fa.tar.gz seven-wonders-8d73d21108738754efd07b63ecc7368fd49502fa.tar.bz2 seven-wonders-8d73d21108738754efd07b63ecc7368fd49502fa.zip |
Simplify state and reducers
Diffstat (limited to 'frontend/src/components/game-browser/GameList.jsx')
-rw-r--r-- | frontend/src/components/game-browser/GameList.jsx | 11 |
1 files changed, 6 insertions, 5 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 = { |