summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/redux/games.js2
-rw-r--r--frontend/src/scenes/GameBrowser/index.js13
-rw-r--r--frontend/src/scenes/Lobby/index.js9
-rw-r--r--frontend/src/scenes/SplashScreen/components/HomeLayout.js8
-rw-r--r--frontend/src/scenes/SplashScreen/index.js6
5 files changed, 30 insertions, 8 deletions
diff --git a/frontend/src/redux/games.js b/frontend/src/redux/games.js
index c6c13504..ee8b13df 100644
--- a/frontend/src/redux/games.js
+++ b/frontend/src/redux/games.js
@@ -51,4 +51,4 @@ export const gamesReducer = (state: GamesState = new GamesState(), action: Games
export const getAllGamesById = (games: GamesState): Map<string, Game> => games.all;
export const getAllGames = (games: GamesState): List<Game> => getAllGamesById(games).toList();
export const getGame = (games: GamesState, id: string | number): Game => getAllGamesById(games).get(`${id}`);
-export const getCurrentGame = (games: GamesState) => getGame(games, games.current);
+export const getCurrentGame = (games: GamesState): Game => getGame(games, games.current);
diff --git a/frontend/src/scenes/GameBrowser/index.js b/frontend/src/scenes/GameBrowser/index.js
index 20a835d1..7bb8b59d 100644
--- a/frontend/src/scenes/GameBrowser/index.js
+++ b/frontend/src/scenes/GameBrowser/index.js
@@ -10,7 +10,14 @@ import type { Player } from '../../models/players';
import { actions, getAllGames } from '../../redux/games';
import { getCurrentPlayer } from '../../redux/players';
-class GameBrowserPresenter extends Component {
+export type GameBrowserProps = {
+ currentPlayer: Player,
+ games: List<Game>,
+ createGame: (gameName: string) => void,
+ joinGame: (gameId: string) => void
+}
+
+class GameBrowserPresenter extends Component<GameBrowserProps> {
props: {
currentPlayer: Player,
games: List<Game>,
@@ -20,7 +27,7 @@ class GameBrowserPresenter extends Component {
_gameName: string | void = undefined;
- createGame = (e: SyntheticEvent): void => {
+ createGame = (e: SyntheticEvent<*>): void => {
e.preventDefault();
if (this._gameName !== undefined) {
this.props.createGame(this._gameName);
@@ -35,7 +42,7 @@ class GameBrowserPresenter extends Component {
buttonLabel="Create Game"
label="Game name"
name="game_name"
- onChange={(e: SyntheticInputEvent) => (this._gameName = e.target.value)}
+ onChange={(e: SyntheticInputEvent<*>) => (this._gameName = e.target.value)}
onClick={this.createGame}
/>
<Space auto />
diff --git a/frontend/src/scenes/Lobby/index.js b/frontend/src/scenes/Lobby/index.js
index 57ad5c7f..88021fbe 100644
--- a/frontend/src/scenes/Lobby/index.js
+++ b/frontend/src/scenes/Lobby/index.js
@@ -3,10 +3,17 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Button } from 'rebass';
import { PlayerList } from '../../components/playerList';
+import type { Game } from '../../models/games';
+import type { Player } from '../../models/players';
import { actions, getCurrentGame } from '../../redux/games';
import { getPlayers } from '../../redux/players';
-class LobbyPresenter extends Component {
+export type LobbyProps = {
+ currentGame: Game,
+ players: List<Player>,
+}
+
+class LobbyPresenter extends Component<LobbyProps> {
getTitle() {
if (this.props.currentGame) {
return this.props.currentGame.name + ' — Lobby';
diff --git a/frontend/src/scenes/SplashScreen/components/HomeLayout.js b/frontend/src/scenes/SplashScreen/components/HomeLayout.js
index 2a3fd856..08029d45 100644
--- a/frontend/src/scenes/SplashScreen/components/HomeLayout.js
+++ b/frontend/src/scenes/SplashScreen/components/HomeLayout.js
@@ -1,12 +1,16 @@
// @flow
-import type { Children } from 'react';
+import type { Node } from 'react';
import React from 'react';
import { Banner } from 'rebass';
import { ErrorToastContainer } from '../../../components/errors/errorToastContainer';
import background from './background-zeus-temple.jpg';
import logo from './logo-7-wonders.png';
-export const HomeLayout = ({ children }: { children: Children }) => (
+export type HomeLayoutProps = {
+ children?: Node,
+}
+
+export const HomeLayout = ({ children }: HomeLayoutProps) => (
<div>
<Banner align="center" backgroundImage={background}>
<img src={logo} alt="Seven Wonders" />
diff --git a/frontend/src/scenes/SplashScreen/index.js b/frontend/src/scenes/SplashScreen/index.js
index 022caf45..745d8ee7 100644
--- a/frontend/src/scenes/SplashScreen/index.js
+++ b/frontend/src/scenes/SplashScreen/index.js
@@ -6,7 +6,11 @@ import { Container } from 'rebass';
import { actions } from '../../redux/players';
import { HomeLayout } from './components/HomeLayout';
-class SplashScreenPresenter extends Component {
+export type SplashScreenProps = {
+ chooseUsername: (username: string) => void,
+}
+
+class SplashScreenPresenter extends Component<SplashScreenProps> {
_username = '';
play = e => {
bgstack15