import { Button, Classes } from '@blueprintjs/core' import { List } from 'immutable'; import React from 'react'; import { connect } from 'react-redux'; import { ApiLobby } from '../../api/model'; import { GlobalState } from '../../reducers'; import { actions } from '../../redux/actions/lobby'; import { getAllGames } from '../../redux/games'; import './GameList.css'; import { GameStatus } from './GameStatus'; import { PlayerCount } from './PlayerCount'; type GameListStateProps = { games: List, }; type GameListDispatchProps = { joinGame: (gameId: number) => void, }; type GameListProps = GameListStateProps & GameListDispatchProps const GameListPresenter = ({ games, joinGame }: GameListProps) => ( {games.map((game: ApiLobby) => )}
); const GameListHeaderRow = () => ( Name Status Nb Players Join ); type GameListItemRowProps = { game: ApiLobby, joinGame: (gameId: number) => void, }; const GameListItemRow = ({game, joinGame}: GameListItemRowProps) => ( {game.name} ); type JoinButtonProps = { game: ApiLobby, joinGame: (gameId: number) => void, }; const JoinButton = ({game, joinGame}: JoinButtonProps) => { const disabled = game.state !== 'LOBBY'; const onClick = () => joinGame(game.id); return