diff options
Diffstat (limited to 'frontend/src/redux/players.js')
-rw-r--r-- | frontend/src/redux/players.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/frontend/src/redux/players.js b/frontend/src/redux/players.js deleted file mode 100644 index ce3c305f..00000000 --- a/frontend/src/redux/players.js +++ /dev/null @@ -1,25 +0,0 @@ -import { List } from 'immutable'; -import { Player, PlayerState } from '../models/players'; -import type { Action } from './actions/all'; -import { types } from './actions/players'; - -export const playersReducer = (state = new PlayerState(), action: Action) => { - switch (action.type) { - case types.SET_CURRENT_PLAYER: - return state.addPlayer(action.player); - case types.UPDATE_PLAYERS: - return state.addPlayers(action.players); - default: - return state; - } -}; - -const ANONYMOUS = new Player({displayName: '[NOT LOGGED]'}); - -export function getCurrentPlayer(state): Player { - const players = state.get('players'); - return getPlayer(players, players.current, ANONYMOUS); -} - -export const getPlayer = (players, username, defaultPlayer): ?Player => players.all.get(username, defaultPlayer); -export const getPlayers = (players, usernames): List<Player> => usernames.map(u => getPlayer(players, u, undefined)); |