summaryrefslogtreecommitdiff
path: root/frontend/src/models/players.js
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2019-02-27 03:12:55 +0100
committerjbion <joffrey.bion@amadeus.com>2019-02-27 03:12:55 +0100
commit8d73d21108738754efd07b63ecc7368fd49502fa (patch)
tree8755dd1aa9c61e9f473fd6787ba8f3595006f0fa /frontend/src/models/players.js
parentRemove unnecessary Jackson annotation on non-DTOs (diff)
downloadseven-wonders-8d73d21108738754efd07b63ecc7368fd49502fa.tar.gz
seven-wonders-8d73d21108738754efd07b63ecc7368fd49502fa.tar.bz2
seven-wonders-8d73d21108738754efd07b63ecc7368fd49502fa.zip
Simplify state and reducers
Diffstat (limited to 'frontend/src/models/players.js')
-rw-r--r--frontend/src/models/players.js47
1 files changed, 0 insertions, 47 deletions
diff --git a/frontend/src/models/players.js b/frontend/src/models/players.js
deleted file mode 100644
index 587300f5..00000000
--- a/frontend/src/models/players.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// @flow
-import { Map, Record } from 'immutable';
-
-export type PlayerShape = {
- username: string,
- displayName: string,
- index: number,
- ready: boolean,
- gameOwner: boolean,
- user: boolean,
-};
-export type PlayerType = Record<PlayerShape>;
-
-const PlayerRecord: PlayerType = Record({
- username: null,
- displayName: null,
- index: 0,
- ready: false,
- gameOwner: false,
- user: false,
-});
-// $FlowFixMe
-export class Player extends PlayerRecord {}
-
-export type PlayersShape = {
- all: Map<string, PlayerType>,
- current: string
-};
-export type PlayersType = Record<PlayersShape>;
-
-const PlayersRecord: PlayersType = Record({
- all: Map(),
- current: '',
-});
-// $FlowFixMe
-export class PlayerState extends PlayersRecord {
- addPlayer(p: PlayerShape) {
- const player: Player = new Player(p);
- const playerMap = Map({ [player.username]: player });
- return this.addPlayers(playerMap).set('current', player.username);
- }
-
- addPlayers(p: Map<string, PlayerShape>) {
- const players: Map<string, PlayerShape> = Map(p);
- return this.mergeIn(['all'], players.map((player: PlayerShape): Player => new Player(player)));
- }
-}
bgstack15