Skip to content

Commit

Permalink
Cleaning up after module refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneZ committed Jan 22, 2017
1 parent 276f189 commit b77bc88
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 294 deletions.
10 changes: 5 additions & 5 deletions client/component/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, { Component } from 'react';
import { connect } from 'react-redux'
import autobind from 'autobind-decorator'
import { withRouter } from 'react-router';
import AppBar from 'material-ui/AppBar';
import IconButton from 'material-ui/IconButton';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import { AppBar } from 'material-ui';
import { IconButton }from 'material-ui';
import { IconMenu } from 'material-ui';
import { MenuItem } from 'material-ui';
import MenuIcon from 'material-ui/svg-icons/navigation/menu';
import feathers from '../feathers';

Expand Down Expand Up @@ -77,7 +77,7 @@ export default withRouter(class App extends Component {
}

onSendAction(data) {
this.props.dispatch({ type: 'GAME_ACTION', data: Object.assign({ id: this.props.params.id }, data ) });
this.props.dispatch({ type: 'GAME_ACTION', data: Object.assign({ id: this.props.params.id }, data) });
}

onPatchProfile(data) {
Expand Down
24 changes: 13 additions & 11 deletions client/component/GamesList.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React, { Component } from 'react';
import autobind from 'autobind-decorator';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui/Table';
import Paper from 'material-ui/Paper';
import RaisedButton from 'material-ui/RaisedButton';
import Toggle from 'material-ui/Toggle';
import _ from 'lodash';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow, TableRowColumn } from 'material-ui';
import { Paper } from 'material-ui';
import { RaisedButton } from 'material-ui';
import { Toggle } from 'material-ui';
import castArray from 'lodash/castArray';
import startCase from 'lodash/startCase';

function getWinnersArray(game, users) {
const winners = game.winner || game.winners;
if (!winners) {
return [];
}

return _.castArray(winners).map(winner => {
return castArray(winners).map(winner => {
if (winner && winner.name) {
return name;
} else if (game.players.includes(winner)) {
Expand All @@ -35,7 +36,7 @@ export default class GamesList extends Component {
const games = this.props.games
.slice()
.filter(game => !this.state.showCompleted ^ game.mode === 'gameover')
.sort((a, b)=>parseInt(b.updated.replace(/[^0-9]/g,''), 10) - parseInt(a.updated.replace(/[^0-9]/g,''), 10));
.sort((a, b) => parseInt(b.updated.replace(/[^0-9]/g, ''), 10) - parseInt(a.updated.replace(/[^0-9]/g, ''), 10));

if (!users || !users.length || !games || !games.length) {
return this.renderNoGames();
Expand All @@ -44,7 +45,7 @@ export default class GamesList extends Component {
return (
<div>
<Toggle label="Show Completed" style={{ margin: 16, width: 200 }} onToggle={this.onToggleCompleted}/>
<Table onRowSelection={arr=>onGotoGame(games[arr[0]])}>
<Table onRowSelection={arr => onGotoGame(games[arr[0]])}>
<TableHeader displaySelectAll={false} adjustForCheckbox={false}>
<TableRow>
<TableHeaderColumn>Game</TableHeaderColumn>
Expand All @@ -56,10 +57,10 @@ export default class GamesList extends Component {
<TableBody displayRowCheckbox={false} showRowHover={true} stripedRows={true}>
{games.map(game =>
<TableRow key={game.id}>
<TableRowColumn>{_.startCase(game.game)}</TableRowColumn>
<TableRowColumn>{startCase(game.game)}</TableRowColumn>
<TableRowColumn>{game.title}</TableRowColumn>
<TableRowColumn>{game.players.map((id, key) => {
const user = users.filter(p=>p.id == id)[0];
const user = users.filter(p => p.id == id)[0];
return (
<div key={key}>{user ? user.name : 'Deleted User'}</div>
);
Expand All @@ -86,7 +87,8 @@ export default class GamesList extends Component {
return (
<Paper style={{ maxWidth: 500, padding: 10, margin: '0 auto' }}>
<p>You don't have any active games. You can create one or view completed games.</p>
<Toggle label="Show Completed" style={{ margin: 16, width: 200 }} onToggle={this.onToggleCompleted} toggled={this.state.showCompleted}/>
<Toggle label="Show Completed" style={{ margin: 16, width: 200 }} onToggle={this.onToggleCompleted}
toggled={this.state.showCompleted}/>
<RaisedButton primary={true} label="Create a game" onClick={this.props.onGotoNewGame}/>
</Paper>
);
Expand Down
14 changes: 7 additions & 7 deletions client/component/NewGame.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { Component } from 'react';
import TextField from 'material-ui/TextField';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
import RaisedButton from 'material-ui/RaisedButton';
import Paper from 'material-ui/Paper';
import Toggle from 'material-ui/Toggle';
import { TextField } from 'material-ui';
import { SelectField } from 'material-ui';
import { MenuItem } from 'material-ui';
import { RaisedButton } from 'material-ui';
import { Paper } from 'material-ui';
import { Toggle } from 'material-ui';
import autobind from 'autobind-decorator';
import { getLibrary, getConfiguration } from '../gameProvider';
import loadRemoteModule from '../hoc/loadRemoteModule';

@loadRemoteModule(()=>({
@loadRemoteModule(() => ({
configurations: 'configurations'
}))
@autobind
Expand Down
7 changes: 3 additions & 4 deletions client/component/Profile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { Component } from 'react';
import autobind from 'autobind-decorator';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import RaisedButton from 'material-ui/RaisedButton';
import feathers from '../feathers';
import { Paper } from 'material-ui';
import { TextField } from 'material-ui';
import { RaisedButton } from 'material-ui';

function getMyName(props) {
const me = props.user;
Expand Down
6 changes: 3 additions & 3 deletions client/component/Welcome.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import FontIcon from 'material-ui/FontIcon';
import { RaisedButton } from 'material-ui';
import { FontIcon } from 'material-ui';

export default ()=>
export default () =>
<div style={{ padding: '5%' }}>
<div style={{ display: 'flex', marginBottom: 50, flexWrap: 'wrap' }}>
<RaisedButton primary={true} label="Login with Google" href="/auth/google"
Expand Down
2 changes: 1 addition & 1 deletion client/routes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Router, Route, browserHistory, IndexRoute } from 'react-router'
import { Provider } from 'react-redux';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import { MuiThemeProvider } from 'material-ui';
import feathers from './feathers';
import App from './component/App';
import GamesList from './component/GamesList';
Expand Down
8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
"cardboardez-game-trixit": "^0.0.1",
"compression": "^1.6.2",
"config": "^1.10.0",
"crypto-js": "^3.1.6",
"empty-module": "^0.0.2",
"feathers": "^2.0.2",
"feathers-authentication": "^0.7.10",
"feathers-errors": "^2.4.0",
Expand All @@ -46,23 +44,17 @@
"lodash": "^4.16.2",
"material-ui": "^0.16.7",
"mkdirp": "^0.5.1",
"moment": "^2.17.1",
"partition-bundle": "^2.5.0",
"passport-facebook": "^1.0.3",
"passport-github": "^1.1.0",
"passport-google-oauth20": "^1.0.0",
"passport-vimeo-oauth2": "0.0.3",
"react": "^15.4.2",
"react-dnd": "^2.1.4",
"react-dnd-html5-backend": "^2.1.2",
"react-dnd-touch-backend": "^0.3.3",
"react-dom": "^15.4.2",
"react-redux": "^4.4.5",
"react-router": "^2.8.1",
"react-tap-event-plugin": "^2.0.1",
"redux": "^3.6.0",
"redux-saga": "^0.11.1",
"require-globify": "^1.4.1",
"reselect": "^2.5.4",
"rethinkdbdash": "^2.3.23",
"scriptloader": "^1.1.2",
Expand Down
142 changes: 0 additions & 142 deletions test/unit/summit/server.js

This file was deleted.

Loading

0 comments on commit b77bc88

Please sign in to comment.