Skip to content

Commit

Permalink
Merge pull request #36 from werewolfrd/feature/standardize
Browse files Browse the repository at this point in the history
Feature/standardize
  • Loading branch information
wistcc authored Apr 29, 2017
2 parents b5671a7 + dcb552f commit 0fdd9e3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
9 changes: 6 additions & 3 deletions src/js/components/Wizard.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React, {cloneElement} from 'react';
import { browserHistory } from 'react-router';
import werewolfService from '../services/werewolf';
import gamesTypes from '../core/gameTypes';

const DEFAULT_GAME_MODE = 'balanced';
const DEFAULT_GAME_MODE = gamesTypes.balanced;

export default class Wizard extends React.Component {
constructor(){
super();
const defaultDeck = this.getDecks()[0];

this.state = {
players: 5,
currentDeck: 'basic', //todo: proper initialization with deck ' * '
currentCards: werewolfService.getCardsInDeck('basic'), // same as ^
currentDeck: defaultDeck,
currentCards: werewolfService.getCardsInDeck(defaultDeck),
mode: DEFAULT_GAME_MODE,
game: {},
};
Expand Down
4 changes: 4 additions & 0 deletions src/js/core/gameTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
balanced: 'balanced',
chaos: 'chaos'
}
4 changes: 4 additions & 0 deletions src/js/core/languages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
english: 'en',
spanish: 'es'
}
5 changes: 3 additions & 2 deletions src/js/pages/Cards.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Link, browserHistory } from 'react-router';
import gamesTypes from '../core/gameTypes';

import Header from '../components/Header';

Expand Down Expand Up @@ -51,8 +52,8 @@ export default class Cards extends React.Component {

<div class="panel-footer">
<button onClick={browserHistory.goBack} className="btn btn-default col-md-2 col-xs-12 btn-space"><i class="fa fa-arrow-left" aria-hidden="true"></i></button>
<button onClick={this.props.startGame.bind(this, "chaos")} className="btn btn-default col-md-4 col-md-offset-1 col-xs-12 btn-space"><i class="fa fa-arrows" aria-hidden="true"></i> Quick Chaos</button>
<button onClick={this.props.startGame.bind(this, "balanced")} className="btn btn-default col-md-4 col-md-offset-1 col-xs-12 btn-space"><i class="fa fa-balance-scale" aria-hidden="true"></i> Quick Balanced</button>
<button onClick={this.props.startGame.bind(this, gamesTypes.chaos)} className="btn btn-default col-md-4 col-md-offset-1 col-xs-12 btn-space"><i class="fa fa-arrows" aria-hidden="true"></i> Quick Chaos</button>
<button onClick={this.props.startGame.bind(this, gamesTypes.balanced)} className="btn btn-default col-md-4 col-md-offset-1 col-xs-12 btn-space"><i class="fa fa-balance-scale" aria-hidden="true"></i> Quick Balanced</button>
<div class="clearfix"></div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/js/pages/Home.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router';

import Header from '../components/Header';
import gamesTypes from '../core/gameTypes';

export default class Home extends React.Component {
constructor(){
Expand Down Expand Up @@ -48,8 +48,8 @@ export default class Home extends React.Component {
</div>
<hr />
<div class="col-md-12">
<button onClick={this.props.startGame.bind(this, "chaos")} className="btn btn-default col-md-5"><i class="fa fa-arrows" aria-hidden="true"></i> Quick Chaos</button>
<button onClick={this.props.startGame.bind(this, "balanced")} className="btn btn-default col-md-5 col-md-offset-2"><i class="fa fa-balance-scale" aria-hidden="true"></i> Quick Balanced</button>
<button onClick={this.props.startGame.bind(this, gamesTypes.chaos)} className="btn btn-default col-md-5"><i class="fa fa-arrows" aria-hidden="true"></i> Quick Chaos</button>
<button onClick={this.props.startGame.bind(this, gamesTypes.balanced)} className="btn btn-default col-md-5 col-md-offset-2"><i class="fa fa-balance-scale" aria-hidden="true"></i> Quick Balanced</button>
</div>
<div class="clearfix"></div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/js/pages/Screenplay.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Link, browserHistory } from 'react-router';
import service from '../services/werewolf';

import Header from '../components/Header';
import languages from '../core/languages';

export default class Screenplay extends React.Component {
constructor() {
Expand Down Expand Up @@ -43,8 +43,8 @@ export default class Screenplay extends React.Component {
<div class="panel panel-default ">
<div class="panel-heading">
<div class="pull-right">
<button onClick={this.changeLanguage} name="es" type="button" class="btn btn-default">ES</button>
<button onClick={this.changeLanguage} name="en" type="button" class="btn btn-default">EN</button>
<button onClick={this.changeLanguage} name={languages.spanish} type="button" class="btn btn-default">ES</button>
<button onClick={this.changeLanguage} name={languages.english} type="button" class="btn btn-default">EN</button>
</div>
<div class="clearfix"></div>
</div>
Expand Down

0 comments on commit 0fdd9e3

Please sign in to comment.