diff options
Diffstat (limited to 'frontend/src')
-rw-r--r-- | frontend/src/api/sevenWondersApi.js | 6 | ||||
-rw-r--r-- | frontend/src/api/websocket.js | 2 | ||||
-rw-r--r-- | frontend/src/components/gameList.js | 5 | ||||
-rw-r--r-- | frontend/src/components/modals/username.js | 2 | ||||
-rw-r--r-- | frontend/src/components/playerList.js | 2 | ||||
-rw-r--r-- | frontend/src/containers/gameBrowser.js | 13 | ||||
-rw-r--r-- | frontend/src/containers/lobby.js | 5 | ||||
-rw-r--r-- | frontend/src/index.js | 8 | ||||
-rw-r--r-- | frontend/src/layouts/HomeLayout.js | 6 | ||||
-rw-r--r-- | frontend/src/layouts/LobbyLayout.js | 4 | ||||
-rw-r--r-- | frontend/src/models/games.js | 2 | ||||
-rw-r--r-- | frontend/src/models/players.js | 2 | ||||
-rw-r--r-- | frontend/src/reducers.js | 5 | ||||
-rw-r--r-- | frontend/src/redux/games.js | 4 | ||||
-rw-r--r-- | frontend/src/routes.js | 15 | ||||
-rw-r--r-- | frontend/src/sagas.js | 6 | ||||
-rw-r--r-- | frontend/src/sagas/errors.js | 12 | ||||
-rw-r--r-- | frontend/src/sagas/gameBrowser.js | 17 | ||||
-rw-r--r-- | frontend/src/sagas/home.js | 12 | ||||
-rw-r--r-- | frontend/src/sagas/lobby.js | 19 | ||||
-rw-r--r-- | frontend/src/store.js | 11 |
21 files changed, 74 insertions, 84 deletions
diff --git a/frontend/src/api/sevenWondersApi.js b/frontend/src/api/sevenWondersApi.js index 9a68ec66..058408eb 100644 --- a/frontend/src/api/sevenWondersApi.js +++ b/frontend/src/api/sevenWondersApi.js @@ -1,7 +1,9 @@ // @flow +import type { + ApiError, ApiLobby, ApiPlayer, ApiPlayerMove, ApiPlayerTurnInfo, ApiPreparedCard, ApiTable, +} from './model'; +import type { JsonStompClient, SubscribeFn } from './websocket'; import { createJsonStompClient } from './websocket'; -import type { JsonStompClient, SubscribeFn } from './websocket' -import type { ApiError, ApiLobby, ApiPlayer, ApiPlayerMove, ApiPlayerTurnInfo, ApiPreparedCard, ApiTable } from './model'; const wsURL = '/seven-wonders-websocket'; diff --git a/frontend/src/api/websocket.js b/frontend/src/api/websocket.js index 8a893a87..0cf0689a 100644 --- a/frontend/src/api/websocket.js +++ b/frontend/src/api/websocket.js @@ -1,7 +1,7 @@ // @flow import SockJS from 'sockjs-client'; -import Stomp from 'webstomp-client'; import type { Client, Frame, Options, Subscription } from 'webstomp-client'; +import Stomp from 'webstomp-client'; const DEFAULT_DEBUG_OPTIONS = { debug: process.env.NODE_ENV !== 'production', diff --git a/frontend/src/components/gameList.js b/frontend/src/components/gameList.js index 22366c5c..0a478b96 100644 --- a/frontend/src/components/gameList.js +++ b/frontend/src/components/gameList.js @@ -1,9 +1,8 @@ // @flow +import type { List } from 'immutable'; import React from 'react'; +import { Button, Space, Text } from 'rebass'; import { Flex } from 'reflexbox'; -import { Text, Space, Button } from 'rebass'; - -import type { List } from 'immutable'; import type { Game } from '../models/games'; const GameList = ({ games, joinGame }: { games: List<Game>, joinGame: (gameId: string) => void }) => ( diff --git a/frontend/src/components/modals/username.js b/frontend/src/components/modals/username.js index c00262a7..19b7eeb0 100644 --- a/frontend/src/components/modals/username.js +++ b/frontend/src/components/modals/username.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Overlay, Panel, PanelHeader, PanelFooter, Button, Input, Close, Space } from 'rebass'; +import { Button, Close, Input, Overlay, Panel, PanelFooter, PanelHeader, Space } from 'rebass'; const Modal = ({ modalOpen, toggleModal }) => ( <Overlay open={modalOpen} onDismiss={toggleModal('usernameModal')}> diff --git a/frontend/src/components/playerList.js b/frontend/src/components/playerList.js index bc2c768e..4ddbe056 100644 --- a/frontend/src/components/playerList.js +++ b/frontend/src/components/playerList.js @@ -1,6 +1,6 @@ import React from 'react'; -import { Flex } from 'reflexbox'; import { Text } from 'rebass'; +import { Flex } from 'reflexbox'; const PlayerList = ({ players }) => ( <div> diff --git a/frontend/src/containers/gameBrowser.js b/frontend/src/containers/gameBrowser.js index b654e9d9..a21d2e29 100644 --- a/frontend/src/containers/gameBrowser.js +++ b/frontend/src/containers/gameBrowser.js @@ -1,17 +1,14 @@ // @flow -import React, { Component } from 'react'; - import type { List } from 'immutable'; -import type { Games } from '../models/games'; -import type { Player } from '../models/players'; - +import React, { Component } from 'react'; import { connect } from 'react-redux'; -import { Space, InlineForm, Text } from 'rebass'; +import { InlineForm, Space, Text } from 'rebass'; import { Flex } from 'reflexbox'; import GameList from '../components/gameList'; - +import type { Games } from '../models/games'; +import type { Player } from '../models/players'; +import { actions, getAllGames } from '../redux/games'; import { getCurrentPlayer } from '../redux/players'; -import { getAllGames, actions } from '../redux/games'; class GameBrowser extends Component { props: { diff --git a/frontend/src/containers/lobby.js b/frontend/src/containers/lobby.js index fc762056..bf0cb031 100644 --- a/frontend/src/containers/lobby.js +++ b/frontend/src/containers/lobby.js @@ -1,11 +1,10 @@ -import React, { Component } from 'react'; import { List } from 'immutable'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Button } from 'rebass'; import PlayerList from '../components/playerList'; - +import { actions, getCurrentGame } from '../redux/games'; import { getPlayers } from '../redux/players'; -import { getCurrentGame, actions } from '../redux/games'; class Lobby extends Component { getTitle() { diff --git a/frontend/src/index.js b/frontend/src/index.js index a3fbe7ce..17076de5 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -1,14 +1,14 @@ // @flow import 'babel-polyfill'; -import './global-styles.css'; - import React from 'react'; import ReactDOM from 'react-dom'; -import { Router } from 'react-router'; import { Provider } from 'react-redux'; +import { Router } from 'react-router'; +import './global-styles.css'; +import { routes } from './routes'; import configureStore from './store'; -import { routes } from './routes'; + const initialState = {}; const { store, history } = configureStore(initialState); diff --git a/frontend/src/layouts/HomeLayout.js b/frontend/src/layouts/HomeLayout.js index 33167679..f139febf 100644 --- a/frontend/src/layouts/HomeLayout.js +++ b/frontend/src/layouts/HomeLayout.js @@ -1,10 +1,10 @@ // @flow -import React from 'react'; import type { Children } from 'react'; +import React from 'react'; import { Banner } from 'rebass'; -import logo from './logo-7-wonders.png'; -import background from './background-zeus-temple.jpg'; import ErrorToastContainer from '../components/errors/errorToastContainer'; +import background from './background-zeus-temple.jpg'; +import logo from './logo-7-wonders.png'; export default ({ children }: { children: Children }) => ( <div> diff --git a/frontend/src/layouts/LobbyLayout.js b/frontend/src/layouts/LobbyLayout.js index 29d99e1b..389c4096 100644 --- a/frontend/src/layouts/LobbyLayout.js +++ b/frontend/src/layouts/LobbyLayout.js @@ -1,8 +1,8 @@ -import React from 'react'; import type { Children } from 'react'; +import React from 'react'; import { Banner } from 'rebass'; -import logo from './logo-7-wonders.png'; import ErrorToastContainer from '../components/errors/errorToastContainer'; +import logo from './logo-7-wonders.png'; export default ({ children }: { children: Children }) => ( <div> diff --git a/frontend/src/models/games.js b/frontend/src/models/games.js index 36619760..dd660d45 100644 --- a/frontend/src/models/games.js +++ b/frontend/src/models/games.js @@ -1,4 +1,4 @@ -import { Record, Map, List } from 'immutable'; +import { List, Map, Record } from 'immutable'; export type SettingsShape = { initialGold: number, diff --git a/frontend/src/models/players.js b/frontend/src/models/players.js index 13d5ad51..5f7a4d70 100644 --- a/frontend/src/models/players.js +++ b/frontend/src/models/players.js @@ -1,5 +1,5 @@ // @flow -import { Record, Map } from 'immutable'; +import { Map, Record } from 'immutable'; export type PlayerShape = { username: string, diff --git a/frontend/src/reducers.js b/frontend/src/reducers.js index f4e88297..076d269e 100644 --- a/frontend/src/reducers.js +++ b/frontend/src/reducers.js @@ -1,8 +1,7 @@ // @flow -import { combineReducers } from 'redux-immutable'; -import { routerReducer } from 'react-router-redux'; import { reducer as toastrReducer } from 'react-redux-toastr'; - +import { routerReducer } from 'react-router-redux'; +import { combineReducers } from 'redux-immutable'; import gamesReducer from './redux/games'; import playersReducer from './redux/players'; diff --git a/frontend/src/redux/games.js b/frontend/src/redux/games.js index a594ad41..e89bb842 100644 --- a/frontend/src/redux/games.js +++ b/frontend/src/redux/games.js @@ -1,8 +1,8 @@ // @flow +import type { List, Map } from 'immutable'; import { fromJS } from 'immutable'; +import type { Game, GameMapType, GameNormalMapType, GameShape } from '../models/games'; import GamesState from '../models/games'; -import type { GameMapType, GameNormalMapType, GameShape, Game } from '../models/games'; -import type { Map, List } from 'immutable'; export const types = { UPDATE_GAMES: 'GAMES/UPDATE_GAMES', diff --git a/frontend/src/routes.js b/frontend/src/routes.js index 52990728..61c6aacd 100644 --- a/frontend/src/routes.js +++ b/frontend/src/routes.js @@ -1,15 +1,14 @@ // @flow import { fork } from 'redux-saga/effects'; -import homeSaga from './sagas/home'; -import gameBrowserSaga from './sagas/gameBrowser'; -import lobbySaga from './sagas/lobby'; - -import { HomeLayout, LobbyLayout } from './layouts'; -import HomePage from './containers/home'; +import { SevenWondersSession } from './api/sevenWondersApi'; +import Error404 from './components/errors/Error404'; import GameBrowser from './containers/gameBrowser'; +import HomePage from './containers/home'; import Lobby from './containers/lobby'; -import Error404 from './components/errors/Error404'; -import { SevenWondersSession } from './api/sevenWondersApi'; +import { HomeLayout, LobbyLayout } from './layouts'; +import gameBrowserSaga from './sagas/gameBrowser'; +import homeSaga from './sagas/home'; +import lobbySaga from './sagas/lobby'; export const makeSagaRoutes = (sevenWondersSession: SevenWondersSession) => ({ *'/'() { diff --git a/frontend/src/sagas.js b/frontend/src/sagas.js index b7fc4122..a1f80c73 100644 --- a/frontend/src/sagas.js +++ b/frontend/src/sagas.js @@ -1,13 +1,11 @@ // @flow +import type { History } from 'react-router'; import { router } from 'redux-saga-router'; import { call, fork } from 'redux-saga/effects'; - +import { connectToGame, SevenWondersSession } from './api/sevenWondersApi'; import { makeSagaRoutes } from './routes'; import errorHandlingSaga from './sagas/errors'; -import type { History } from 'react-router'; -import { SevenWondersSession, connectToGame } from './api/sevenWondersApi'; - export default function* rootSaga(history: History): * { let sevenWondersSession: SevenWondersSession | void; try { diff --git a/frontend/src/sagas/errors.js b/frontend/src/sagas/errors.js index eece98c8..c5d68e62 100644 --- a/frontend/src/sagas/errors.js +++ b/frontend/src/sagas/errors.js @@ -1,10 +1,10 @@ // @flow -import { toastr } from 'react-redux-toastr' -import type { Channel } from 'redux-saga' -import { eventChannel } from 'redux-saga' -import { apply, cancelled, take } from 'redux-saga/effects' -import type { ApiError } from '../api/model' -import type { SevenWondersSession } from '../api/sevenWondersApi' +import { toastr } from 'react-redux-toastr'; +import type { Channel } from 'redux-saga'; +import { eventChannel } from 'redux-saga'; +import { apply, cancelled, take } from 'redux-saga/effects'; +import type { ApiError } from '../api/model'; +import type { SevenWondersSession } from '../api/sevenWondersApi'; export default function* errorHandlingSaga(session: SevenWondersSession): * { const errorChannel: Channel<ApiError> = yield eventChannel(session.watchErrors()); diff --git a/frontend/src/sagas/gameBrowser.js b/frontend/src/sagas/gameBrowser.js index 5b815f8d..ed17a723 100644 --- a/frontend/src/sagas/gameBrowser.js +++ b/frontend/src/sagas/gameBrowser.js @@ -1,13 +1,12 @@ // @flow -import { normalize } from 'normalizr' -import { push } from 'react-router-redux' -import { eventChannel } from 'redux-saga' -import { apply, call, put, take } from 'redux-saga/effects' -import type { SevenWondersSession } from '../api/sevenWondersApi' - -import { actions as gameActions, types } from '../redux/games' -import { actions as playerActions } from '../redux/players' -import { game as gameSchema, gameList as gameListSchema } from '../schemas/games' +import { normalize } from 'normalizr'; +import { push } from 'react-router-redux'; +import { eventChannel } from 'redux-saga'; +import { apply, call, put, take } from 'redux-saga/effects'; +import type { SevenWondersSession } from '../api/sevenWondersApi'; +import { actions as gameActions, types } from '../redux/games'; +import { actions as playerActions } from '../redux/players'; +import { game as gameSchema, gameList as gameListSchema } from '../schemas/games'; function* watchGames(session: SevenWondersSession): * { const gamesChannel = yield eventChannel(session.watchGames()); diff --git a/frontend/src/sagas/home.js b/frontend/src/sagas/home.js index 0b30f784..a6f19565 100644 --- a/frontend/src/sagas/home.js +++ b/frontend/src/sagas/home.js @@ -1,11 +1,11 @@ // @flow -import { apply, call, put, take } from 'redux-saga/effects' -import { push } from 'react-router-redux' -import { eventChannel } from 'redux-saga' +import { push } from 'react-router-redux'; +import { eventChannel } from 'redux-saga'; +import { apply, call, put, take } from 'redux-saga/effects'; +import type { ApiPlayer } from '../api/model'; +import type { SevenWondersSession } from '../api/sevenWondersApi'; -import { actions, types } from '../redux/players' -import type { SevenWondersSession } from '../api/sevenWondersApi' -import type { ApiPlayer } from '../api/model' +import { actions, types } from '../redux/players'; function* sendUsername(session: SevenWondersSession): * { while (true) { diff --git a/frontend/src/sagas/lobby.js b/frontend/src/sagas/lobby.js index 93e0960f..754bc5bb 100644 --- a/frontend/src/sagas/lobby.js +++ b/frontend/src/sagas/lobby.js @@ -1,14 +1,13 @@ // @flow -import { normalize } from 'normalizr' -import { push } from 'react-router-redux' -import type { Channel } from 'redux-saga' -import { eventChannel } from 'redux-saga' -import { apply, call, put, take } from 'redux-saga/effects' -import { SevenWondersSession } from '../api/sevenWondersApi' -import { actions as gameActions, types } from '../redux/games' -import { actions as playerActions } from '../redux/players' - -import { game as gameSchema } from '../schemas/games' +import { normalize } from 'normalizr'; +import { push } from 'react-router-redux'; +import type { Channel } from 'redux-saga'; +import { eventChannel } from 'redux-saga'; +import { apply, call, put, take } from 'redux-saga/effects'; +import { SevenWondersSession } from '../api/sevenWondersApi'; +import { actions as gameActions, types } from '../redux/games'; +import { actions as playerActions } from '../redux/players'; +import { game as gameSchema } from '../schemas/games'; function getCurrentGameId(): number { const path = window.location.pathname; diff --git a/frontend/src/store.js b/frontend/src/store.js index a095695b..47b2073e 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -1,13 +1,12 @@ // @flow -import { createStore, applyMiddleware, compose } from 'redux'; -import { browserHistory } from 'react-router'; -import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'; import { fromJS } from 'immutable'; - -import createReducer from './reducers'; +import { browserHistory } from 'react-router'; +import { routerMiddleware, syncHistoryWithStore } from 'react-router-redux'; +import { applyMiddleware, compose, createStore } from 'redux'; import createSagaMiddleware from 'redux-saga'; -import rootSaga from './sagas'; +import createReducer from './reducers'; import { makeSelectLocationState } from './redux/app'; +import rootSaga from './sagas'; export default function configureStore(initialState: Object = {}) { const sagaMiddleware = createSagaMiddleware(); |