diff --git a/js/api.js b/js/api.js
index d1222e9..35b4921 100644
--- a/js/api.js
+++ b/js/api.js
@@ -3,74 +3,74 @@ import {
applyMiddleware,
combineReducers
} from 'redux';
-import { composeWithDevTools } from 'redux-devtools-extension';
-import thunkMiddleware from 'redux-thunk';
+import {composeWithDevTools} from 'redux-devtools-extension';
+import thunkMiddleware from 'redux-thunk';
-import { errorMessages } from './constants';
+import {errorMessages} from './constants';
import getConfig from 'next/config';
-const { publicRuntimeConfig } = getConfig();
+const {publicRuntimeConfig} = getConfig();
const api_url = publicRuntimeConfig.api_url;
const axios = require('axios');
const actiontypes_userinfo = {
- 'REGISTER' : 'REGISTER',
- 'REGISTER_RESULT_SUCCESS' : 'REGISTER_RESULT_SUCCESS',
- 'REGISTER_RESULT_ERROR' : 'REGISTER_RESULT_ERROR',
+ 'REGISTER': 'REGISTER',
+ 'REGISTER_RESULT_SUCCESS': 'REGISTER_RESULT_SUCCESS',
+ 'REGISTER_RESULT_ERROR': 'REGISTER_RESULT_ERROR',
- 'LOGIN' : 'LOGIN',
- 'LOGIN_RESULT_SUCCESS' : 'LOGIN_RESULT_SUCCESS',
- 'LOGIN_RESULT_ERROR' : 'LOGIN_RESULT_ERROR',
+ 'LOGIN': 'LOGIN',
+ 'LOGIN_RESULT_SUCCESS': 'LOGIN_RESULT_SUCCESS',
+ 'LOGIN_RESULT_ERROR': 'LOGIN_RESULT_ERROR',
- 'LOGOUT' : 'LOGOUT',
+ 'LOGOUT': 'LOGOUT',
- 'VERIFY_CREDENTIALS' : 'VERIFY_CREDENTIALS',
- 'VERIFY_CREDENTIALS_SUCCESS' : 'VERIFY_CREDENTIALS_SUCCESS',
- 'VERIFY_CREDENTIALS_ERROR' : 'VERIFY_CREDENTIALS_ERROR',
+ 'VERIFY_CREDENTIALS': 'VERIFY_CREDENTIALS',
+ 'VERIFY_CREDENTIALS_SUCCESS': 'VERIFY_CREDENTIALS_SUCCESS',
+ 'VERIFY_CREDENTIALS_ERROR': 'VERIFY_CREDENTIALS_ERROR',
- 'STORE_AUTH_HEADERS' : 'STORE_AUTH_HEADERS',
+ 'STORE_AUTH_HEADERS': 'STORE_AUTH_HEADERS',
- 'REHYDRATE' : 'USERINFO_REHYDRATE',
- 'CLEAR' : 'USERINFO_CLEAR'
+ 'REHYDRATE': 'USERINFO_REHYDRATE',
+ 'CLEAR': 'USERINFO_CLEAR'
};
const defaultstate_userinfo = {
- isSignedIn : false,
- username : null,
- error : false,
- errorMessages : [],
+ isSignedIn: false,
+ username: null,
+ error: false,
+ errorMessages: [],
- accesstoken : null,
- client : null,
- expiry : null,
- uid : null
+ accesstoken: null,
+ client: null,
+ expiry: null,
+ uid: null
};
const actiontypes_tournamentinfo = {
- 'REQUEST_TOURNAMENT' : 'REQUEST_TOURNAMENT',
- 'REQUEST_TOURNAMENT_SUCCESS' : 'REQUEST_TOURNAMENT_SUCCESS',
+ 'REQUEST_TOURNAMENT': 'REQUEST_TOURNAMENT',
+ 'REQUEST_TOURNAMENT_SUCCESS': 'REQUEST_TOURNAMENT_SUCCESS',
- 'CREATE_TOURNAMENT' : 'CREATE_TOURNAMENT',
+ 'CREATE_TOURNAMENT': 'CREATE_TOURNAMENT',
- 'MODIFY_TOURNAMENT' : 'MODIFY_TOURNAMENT',
- 'MODIFY_TOURNAMENT_SUCCESS' : 'MODIFY_TOURNAMENT_SUCCESS',
- 'MODIFY_TOURNAMENT_ERROR' : 'MODIFY_TOURNAMENT_ERROR',
+ 'MODIFY_TOURNAMENT': 'MODIFY_TOURNAMENT',
+ 'MODIFY_TOURNAMENT_SUCCESS': 'MODIFY_TOURNAMENT_SUCCESS',
+ 'MODIFY_TOURNAMENT_ERROR': 'MODIFY_TOURNAMENT_ERROR',
- 'REHYDRATE' : 'TOURNAMENTINFO_REHYDRATE',
- 'CLEAR' : 'TOURNAMENTINFO_CLEAR',
+ 'REHYDRATE': 'TOURNAMENTINFO_REHYDRATE',
+ 'CLEAR': 'TOURNAMENTINFO_CLEAR'
};
const defaultstate_tournamentinfo = {
- code : '',
- description : '',
- id : -1,
- name : '',
- ownerUsername : '',
- isPublic : '',
+ code: '',
+ description: '',
+ id: -1,
+ name: '',
+ ownerUsername: '',
+ isPublic: '',
stages: [],
- teams : []
+ teams: []
};
const actiontypes_tournamentlist = {
@@ -85,34 +85,34 @@ const defaultstate_tournamentlist = {
export function postRequest(state, url, data) {
return axios.post(api_url + url, data, {
- headers : generateHeaders(state)
+ headers: generateHeaders(state)
});
}
export function getRequest(state, url) {
return axios.get(api_url + url, {
- headers : generateHeaders(state)
+ headers: generateHeaders(state)
});
}
export function deleteRequest(state, url) {
return axios.delete(api_url + url, {
- headers : generateHeaders(state)
+ headers: generateHeaders(state)
});
}
export function patchRequest(state, url, data) {
return axios.patch(api_url + url, data, {
- headers : generateHeaders(state)
+ headers: generateHeaders(state)
});
}
function generateHeaders(state) {
- if(state.userinfo.isSignedIn) {
+ if (state.userinfo.isSignedIn) {
return {
- 'access-token' : state.userinfo.accesstoken,
- 'client' : state.userinfo.client,
- 'uid' : state.userinfo.uid
+ 'access-token': state.userinfo.accesstoken,
+ 'client': state.userinfo.client,
+ 'uid': state.userinfo.uid
};
} else {
return {};
@@ -120,26 +120,26 @@ function generateHeaders(state) {
}
function storeOptionalToken(response) {
- if(checkForAuthenticationHeaders(response)) {
+ if (checkForAuthenticationHeaders(response)) {
__store.dispatch({
- type : actiontypes_userinfo.STORE_AUTH_HEADERS,
- parameters : {
- accesstoken : response.headers['access-token'],
- client : response.headers['client'],
- expiry : response.headers['expiry'],
- uid : response.headers['uid']
+ type: actiontypes_userinfo.STORE_AUTH_HEADERS,
+ parameters: {
+ accesstoken: response.headers['access-token'],
+ client: response.headers['client'],
+ expiry: response.headers['expiry'],
+ uid: response.headers['uid']
}
});
}
}
function checkForAuthenticationHeaders(response) {
- if(response.headers) {
+ if (response.headers) {
const requiredHeaders = [
'access-token', 'client', 'uid', 'expiry'
];
- for(var i = 0; i < requiredHeaders.length; i++) {
- if(!response.headers[requiredHeaders[i]]) {
+ for (let i = 0; i < requiredHeaders.length; i++) {
+ if (!response.headers[requiredHeaders[i]]) {
return false;
}
}
@@ -149,31 +149,31 @@ function checkForAuthenticationHeaders(response) {
}
const reducer_userinfo = (state = defaultstate_userinfo, action) => {
- switch(action.type) {
+ switch (action.type) {
case actiontypes_userinfo.REGISTER:
postRequest(action.state, '/users', {
- 'username' : action.parameters.username,
- 'email' : action.parameters.email,
- 'password' : action.parameters.password
- }).then((resp) => {
+ 'username': action.parameters.username,
+ 'email': action.parameters.email,
+ 'password': action.parameters.password
+ }).then(resp => {
__store.dispatch({
- type : actiontypes_userinfo.REGISTER_RESULT_SUCCESS
+ type: actiontypes_userinfo.REGISTER_RESULT_SUCCESS
});
storeOptionalToken(resp);
- }).catch((error) => {
+ }).catch(error => {
if (error.response) {
__store.dispatch({
- 'type' : actiontypes_userinfo.REGISTER_RESULT_ERROR,
- 'parameters' : {
- 'errorMessages' : error.response.data.errors.full_messages
+ 'type': actiontypes_userinfo.REGISTER_RESULT_ERROR,
+ 'parameters': {
+ 'errorMessages': error.response.data.errors.full_messages
}
});
storeOptionalToken(error.response);
} else {
__store.dispatch({
- 'type' : actiontypes_userinfo.REGISTER_RESULT_ERROR,
- 'parameters' : {
- 'errorMessages' : [
+ 'type': actiontypes_userinfo.REGISTER_RESULT_ERROR,
+ 'parameters': {
+ 'errorMessages': [
errorMessages['registration_errorunknown']['en']
]
}
@@ -183,41 +183,41 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
return Object.assign({}, state, {});
case actiontypes_userinfo.REGISTER_RESULT_SUCCESS:
return Object.assign({}, state, {
- error : false,
- errorMessages : []
+ error: false,
+ errorMessages: []
});
case actiontypes_userinfo.REGISTER_RESULT_ERROR:
return Object.assign({}, state, {
- error : true,
- errorMessages : action.parameters.errorMessages
+ error: true,
+ errorMessages: action.parameters.errorMessages
});
case actiontypes_userinfo.LOGIN:
postRequest(action.state, '/users/sign_in', {
- email : action.parameters.email,
- password : action.parameters.password
- }).then((resp) => {
+ email: action.parameters.email,
+ password: action.parameters.password
+ }).then(resp => {
__store.dispatch({
- type : actiontypes_userinfo.LOGIN_RESULT_SUCCESS,
- parameters : {
- username : resp.data.username,
+ type: actiontypes_userinfo.LOGIN_RESULT_SUCCESS,
+ parameters: {
+ username: resp.data.username,
successCallback: action.parameters.successCallback
}
});
storeOptionalToken(resp);
- }).catch((error) => {
- if(error.response) {
+ }).catch(error => {
+ if (error.response) {
__store.dispatch({
- 'type' : actiontypes_userinfo.LOGIN_RESULT_ERROR,
- 'parameters' : {
- 'errorMessages' : error.response.data.errors
+ 'type': actiontypes_userinfo.LOGIN_RESULT_ERROR,
+ 'parameters': {
+ 'errorMessages': error.response.data.errors
}
});
storeOptionalToken(error.response);
} else {
__store.dispatch({
- 'type' : actiontypes_userinfo.LOGIN_RESULT_ERROR,
- 'parameters' : {
- 'errorMessages' : [ errorMessages['login_errorunknown']['en'] ]
+ 'type': actiontypes_userinfo.LOGIN_RESULT_ERROR,
+ 'parameters': {
+ 'errorMessages': [errorMessages['login_errorunknown']['en']]
}
});
}
@@ -226,60 +226,60 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
case actiontypes_userinfo.LOGIN_RESULT_SUCCESS:
action.parameters.successCallback(action.parameters.username);
return Object.assign({}, state, {
- isSignedIn : true,
- error : false,
- errorMessages : [],
- username : action.parameters.username,
+ isSignedIn: true,
+ error: false,
+ errorMessages: [],
+ username: action.parameters.username
});
case actiontypes_userinfo.LOGIN_RESULT_ERROR:
return Object.assign({}, state, {
- error : true,
- errorMessages : action.parameters.errorMessages
+ error: true,
+ errorMessages: action.parameters.errorMessages
});
case actiontypes_userinfo.LOGOUT:
deleteRequest(action.state, '/users/sign_out').then(() => {
action.parameters.successCallback();
- __store.dispatch({ type : actiontypes_userinfo.CLEAR });
+ __store.dispatch({type: actiontypes_userinfo.CLEAR});
}).catch(() => {
- __store.dispatch({ type : actiontypes_userinfo.CLEAR });
+ __store.dispatch({type: actiontypes_userinfo.CLEAR});
});
return Object.assign({}, state, {});
case actiontypes_userinfo.STORE_AUTH_HEADERS:
return Object.assign({}, state, {
- accesstoken : action.parameters.accesstoken,
- client : action.parameters.client,
- expiry : action.parameters.expiry,
- uid : action.parameters.uid
+ accesstoken: action.parameters.accesstoken,
+ client: action.parameters.client,
+ expiry: action.parameters.expiry,
+ uid: action.parameters.uid
});
case actiontypes_userinfo.VERIFY_CREDENTIALS:
- getRequest(action.state, '/users/validate_token').then((resp) => {
+ getRequest(action.state, '/users/validate_token').then(resp => {
storeOptionalToken(resp);
}).catch(() => {
- __store.dispatch({ type: actiontypes_userinfo.CLEAR });
+ __store.dispatch({type: actiontypes_userinfo.CLEAR});
});
return Object.assign({}, state, {});
case actiontypes_userinfo.REHYDRATE:
- return Object.assign({}, state, action.parameters, { error: false, errorMessages: [] });
+ return Object.assign({}, state, action.parameters, {error: false, errorMessages: []});
case actiontypes_userinfo.CLEAR:
return Object.assign({}, state, {
- isSignedIn : false,
- username : null,
- error : false,
- errorMessages : [],
+ isSignedIn: false,
+ username: null,
+ error: false,
+ errorMessages: [],
- accesstoken : null,
- client : null,
- expiry : null,
- uid : null
+ accesstoken: null,
+ client: null,
+ expiry: null,
+ uid: null
});
default: return state;
}
};
const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) => {
- switch(action.type) {
+ switch (action.type) {
case actiontypes_tournamentinfo.CREATE_TOURNAMENT:
- postRequest(action.state, '/tournaments', action.parameters.tournament).then((resp) => {
+ postRequest(action.state, '/tournaments', action.parameters.tournament).then(resp => {
storeOptionalToken(resp);
action.parameters.successCallback();
}).catch(() => {
@@ -287,7 +287,7 @@ const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) =>
});
return Object.assign({}, state, {});
case actiontypes_tournamentinfo.REQUEST_TOURNAMENT:
- getRequest(action.state, '/tournaments/' + action.parameters.code).then((resp) => {
+ getRequest(action.state, '/tournaments/' + action.parameters.code).then(resp => {
__store.dispatch({
type: actiontypes_tournamentinfo.REQUEST_TOURNAMENT_SUCCESS,
parameters: resp.data
@@ -300,23 +300,23 @@ const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) =>
return Object.assign({}, state, {});
case actiontypes_tournamentinfo.REQUEST_TOURNAMENT_SUCCESS:
return Object.assign({}, state, {
- code : action.parameters.code,
- description : action.parameters.description,
- id : action.parameters.id,
- name : action.parameters.name,
- ownerUsername : action.parameters.owner_username,
- isPublic : action.parameters.public,
+ code: action.parameters.code,
+ description: action.parameters.description,
+ id: action.parameters.id,
+ name: action.parameters.name,
+ ownerUsername: action.parameters.owner_username,
+ isPublic: action.parameters.public,
stages: action.parameters.stages,
- teams : action.parameters.teams
+ teams: action.parameters.teams
});
case actiontypes_tournamentinfo.MODIFY_TOURNAMENT:
patchRequest(action.state, '/teams/' + action.parameters.teamid, {
name: action.parameters.name
- }).then((resp) => {
+ }).then(resp => {
storeOptionalToken(resp);
action.parameters.onSuccess();
- }).catch((error) => {
- if(error.response) {
+ }).catch(error => {
+ if (error.response) {
storeOptionalToken(error.response);
}
action.parameters.onError();
@@ -341,15 +341,15 @@ const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) =>
const reducer_tournamentlist = (state = defaultstate_tournamentlist, action) => {
switch (action.type) {
case actiontypes_tournamentlist.FETCH:
- getRequest(action.state, '/tournaments?type=' + action.parameters.type).then((resp) => {
+ getRequest(action.state, '/tournaments?type=' + action.parameters.type).then(resp => {
__store.dispatch({
type: actiontypes_tournamentlist.FETCH_SUCCESS,
parameters: resp.data
});
storeOptionalToken(resp);
action.parameters.successCallback(resp.data);
- }).catch((error) => {
- if(error.response) {
+ }).catch(error => {
+ if (error.response) {
storeOptionalToken(error.response);
}
action.parameters.errorCallback();
@@ -369,13 +369,13 @@ const reducers = {
};
const default_applicationstate = {
- userinfo : defaultstate_userinfo,
+ userinfo: defaultstate_userinfo,
tournamentinfo: defaultstate_tournamentinfo,
tournamentlist: defaultstate_tournamentlist
};
-var __store;
-var applicationHydrated = false;
+let __store;
+let applicationHydrated = false;
export function initializeStore(initialState = default_applicationstate) {
__store = createStore(
@@ -384,7 +384,7 @@ export function initializeStore(initialState = default_applicationstate) {
composeWithDevTools(applyMiddleware(thunkMiddleware))
);
__store.subscribe(() => {
- if(applicationHydrated) {
+ if (applicationHydrated) {
localStorage.setItem('reduxState', JSON.stringify(__store.getState()));
}
});
@@ -394,7 +394,7 @@ export function initializeStore(initialState = default_applicationstate) {
export function verifyCredentials() {
rehydrateApplicationState();
- if(__store.getState().userinfo.isSignedIn) {
+ if (__store.getState().userinfo.isSignedIn) {
__store.dispatch({
type: actiontypes_userinfo.VERIFY_CREDENTIALS,
state: __store.getState()
@@ -428,7 +428,7 @@ export function login(email, password, successCallback) {
export function logout(successCallback) {
__store.dispatch({
- type : actiontypes_userinfo.LOGOUT,
+ type: actiontypes_userinfo.LOGOUT,
parameters: {
successCallback: successCallback
},
@@ -466,8 +466,8 @@ export function updateTeamName(team, successCB, errorCB) {
parameters: {
teamid: team.id,
name: team.name,
- onSuccess : successCB,
- onError : errorCB
+ onSuccess: successCB,
+ onError: errorCB
},
state: __store.getState()
});
@@ -494,18 +494,18 @@ function rehydrateApplicationState() {
JSON.parse(localStorage.getItem('reduxState')) :
undefined;
- if(persistedState) {
+ if (persistedState) {
__store.dispatch({
- type : actiontypes_userinfo.REHYDRATE,
- parameters : Object.assign({}, persistedState.userinfo)
+ type: actiontypes_userinfo.REHYDRATE,
+ parameters: Object.assign({}, persistedState.userinfo)
});
__store.dispatch({
- type : actiontypes_tournamentinfo.REHYDRATE,
- parameters : Object.assign({}, persistedState.tournamentinfo)
+ type: actiontypes_tournamentinfo.REHYDRATE,
+ parameters: Object.assign({}, persistedState.tournamentinfo)
});
__store.dispatch({
- type : actiontypes_tournamentlist.REHYDRATE,
- parameters : Object.assign({}, persistedState.tournamentlist)
+ type: actiontypes_tournamentlist.REHYDRATE,
+ parameters: Object.assign({}, persistedState.tournamentlist)
});
applicationHydrated = true;
}
diff --git a/js/components/EditableStringList.js b/js/components/EditableStringList.js
index 38e7cf7..b7ea161 100644
--- a/js/components/EditableStringList.js
+++ b/js/components/EditableStringList.js
@@ -1,19 +1,18 @@
import React from 'react';
-import {
+import {
Alert,
Button,
Card,
CardBody,
CardTitle,
- Input,
- InputGroup,
- InputGroupAddon
+ Input,
+ InputGroup,
+ InputGroupAddon
} from 'reactstrap';
import '../../static/css/editablestringlist.css';
export default class EditableStringList extends React.Component {
-
constructor(props) {
super(props);
this.state = {
@@ -31,9 +30,9 @@ export default class EditableStringList extends React.Component {
return false;
}
this.state.teams.push(text);
-
- var lastGroup = this.state.groups[this.state.groups.length - 1];
- if(lastGroup === undefined || lastGroup.length >= this.state.groupSize) {
+
+ let lastGroup = this.state.groups[this.state.groups.length - 1];
+ if (lastGroup === undefined || lastGroup.length >= this.state.groupSize) {
this.state.groups[this.state.groups.length] = [];
}
lastGroup = this.state.groups[this.state.groups.length - 1];
@@ -51,7 +50,7 @@ export default class EditableStringList extends React.Component {
}
remove(text) {
- if(this.removeTeamFromGroup(text) === false) {
+ if (this.removeTeamFromGroup(text) === false) {
return false;
}
@@ -67,20 +66,20 @@ export default class EditableStringList extends React.Component {
removeTeamFromGroup(text) {
this.state.teams = this.state.teams.filter(item => item !== text);
- let teamIndex = this.findTeam(text);
- if(teamIndex === null) {
+ const teamIndex = this.findTeam(text);
+ if (teamIndex === null) {
return false;
}
-
+
// Move every first team to the next group
this.state.groups[teamIndex.group].splice(teamIndex.team, 1);
- for(var group = teamIndex.group; group < this.state.groups.length - 1; group++) {
- let currentGroup = this.state.groups[group];
+ for (let group = teamIndex.group; group < this.state.groups.length - 1; group++) {
+ const currentGroup = this.state.groups[group];
currentGroup[currentGroup.length] = this.state.groups[group + 1].splice(0, 1)[0];
}
// delete the last group in case it is empty
- if(this.state.groups[this.state.groups.length - 1].length === 0) {
+ if (this.state.groups[this.state.groups.length - 1].length === 0) {
this.state.groups.splice(this.state.groups.length - 1, 1);
}
@@ -88,9 +87,9 @@ export default class EditableStringList extends React.Component {
}
findTeam(text) {
- for(var group = 0; group < this.state.groups.length; group++) {
- for(var team = 0; team < this.state.groups[group].length; team++) {
- if(this.state.groups[group][team] === text) {
+ for (let group = 0; group < this.state.groups.length; group++) {
+ for (let team = 0; team < this.state.groups[group].length; team++) {
+ if (this.state.groups[group][team] === text) {
return {
group: group,
team: team
@@ -102,17 +101,17 @@ export default class EditableStringList extends React.Component {
}
resizeGroups(newSize) {
- let oldGroups = this.state.groups;
- var rearrangedGroups = [];
+ const oldGroups = this.state.groups;
+ const rearrangedGroups = [];
- for(var oldGroupIndex = 0; oldGroupIndex < oldGroups.length; oldGroupIndex++) {
- for(var oldTeamIndex = 0; oldTeamIndex < oldGroups[oldGroupIndex].length; oldTeamIndex++) {
- let index = oldGroupIndex * this.state.groupSize + oldTeamIndex;
+ for (let oldGroupIndex = 0; oldGroupIndex < oldGroups.length; oldGroupIndex++) {
+ for (let oldTeamIndex = 0; oldTeamIndex < oldGroups[oldGroupIndex].length; oldTeamIndex++) {
+ const index = oldGroupIndex * this.state.groupSize + oldTeamIndex;
- let newGroupIndex = Math.floor(index / newSize);
- let newTeamIndex = index % newSize;
+ const newGroupIndex = Math.floor(index / newSize);
+ const newTeamIndex = index % newSize;
- if(newTeamIndex === 0) {
+ if (newTeamIndex === 0) {
rearrangedGroups[newGroupIndex] = [];
}
@@ -143,11 +142,11 @@ export default class EditableStringList extends React.Component {
}
render() {
- if(this.props.groupSize !== this.state.groupSize) {
+ if (this.props.groupSize !== this.state.groupSize) {
this.resizeGroups(this.props.groupSize);
}
- if(this.props.groupPhaseEnabled) {
+ if (this.props.groupPhaseEnabled) {
if ((typeof this.state.teams !== 'undefined') && this.state.teams.length > 0) {
return (
@@ -168,7 +167,7 @@ export default class EditableStringList extends React.Component {
return (
- {this.state.teams.map((text) => - )}
+ {this.state.teams.map(text =>
- )}
);
} else {
@@ -184,7 +183,6 @@ export default class EditableStringList extends React.Component {
}
class GroupView extends React.Component {
-
constructor(props) {
super(props);
}
@@ -199,9 +197,9 @@ class GroupView extends React.Component {
{group.map((team, teamindex) => (
this.onDragStart(e, groupindex,teamindex)}
- onDragOver={(e) => this.onDragOver(e)}
- onDrop={(e) => this.onDrop(e, groupindex, teamindex)}>
+ onDragStart={e => this.onDragStart(e, groupindex, teamindex)}
+ onDragOver={e => this.onDragOver(e)}
+ onDrop={e => this.onDrop(e, groupindex, teamindex)}>
-
@@ -231,8 +229,8 @@ class GroupView extends React.Component {
onDrop(e, group, team) {
e.preventDefault();
- let src = JSON.parse(e.dataTransfer.getData('text'));
- let dest = {
+ const src = JSON.parse(e.dataTransfer.getData('text'));
+ const dest = {
group: group,
team: team
};
@@ -256,7 +254,7 @@ class StringInput extends React.Component {
render() {
return (
- {
+ {
if (e.key === 'Enter') {
this.submit();
return false;
@@ -298,4 +296,4 @@ class Item extends React.Component {
);
}
-}
\ No newline at end of file
+}
diff --git a/js/components/ErrorComponents.js b/js/components/ErrorComponents.js
index beb7a0d..69e5745 100644
--- a/js/components/ErrorComponents.js
+++ b/js/components/ErrorComponents.js
@@ -1,9 +1,9 @@
-import Head from 'next/head';
-import React from 'react';
-import { Container } from 'reactstrap';
+import Head from 'next/head';
+import React from 'react';
+import {Container} from 'reactstrap';
-import { TurniereNavigation } from './Navigation';
-import { Footer } from './Footer';
+import {TurniereNavigation} from './Navigation';
+import {Footer} from './Footer';
import 'bootstrap/dist/css/bootstrap.min.css';
@@ -11,9 +11,8 @@ import '../../static/everypage.css';
import '../../static/css/error.css';
export class ErrorPageComponent extends React.Component {
-
- static getInitialProps({ statusCode }) {
- return { statusCode };
+ static getInitialProps({statusCode}) {
+ return {statusCode};
}
render() {
@@ -30,7 +29,7 @@ export class ErrorPageComponent extends React.Component {
}
}
-export function ErrorPage(props){
+export function ErrorPage(props) {
return (
diff --git a/js/components/Login.js b/js/components/Login.js
index 9590154..f90d30d 100644
--- a/js/components/Login.js
+++ b/js/components/Login.js
@@ -3,7 +3,7 @@ import React from 'react';
import {connect} from 'react-redux';
import Router from 'next/router';
-import { login } from '../api';
+import {login} from '../api';
import '../../static/css/errormessages.css';
import {notify} from 'react-notify-toast';
@@ -28,11 +28,11 @@ export function Login(props) {
class LoginErrorList extends React.Component {
render() {
- const { error, errorMessages } = this.props;
- if(error) {
+ const {error, errorMessages} = this.props;
+ if (error) {
return (
- { errorMessages.map((message, index) =>
+ { errorMessages.map((message, index) =>
-
{message}
@@ -46,9 +46,9 @@ class LoginErrorList extends React.Component {
}
}
-const mapStateToErrorMessages = (state) => {
- const { errorMessages, error } = state.userinfo;
- return { errorMessages, error };
+const mapStateToErrorMessages = state => {
+ const {errorMessages, error} = state.userinfo;
+ return {errorMessages, error};
};
const VisibleLoginErrorList = connect(
@@ -64,7 +64,7 @@ class LoginSuccessRedirectComponent extends React.Component {
}
}
-const mapLoginState = (state) => {
+const mapLoginState = state => {
const {isSignedIn} = state.userinfo;
return {isSignedIn};
};
@@ -72,19 +72,18 @@ const mapLoginState = (state) => {
const LoginSuccessRedirect = connect(mapLoginState)(LoginSuccessRedirectComponent);
class LoginForm extends React.Component {
-
constructor(props) {
super(props);
this.state = {
- email : '',
- password : ''
+ email: '',
+ password: ''
};
}
tryLogin(event) {
event.preventDefault();
- login(this.state.email, this.state.password, (username) => notify.show('Willkommen, ' + username + '!', 'success', 2500));
+ login(this.state.email, this.state.password, username => notify.show('Willkommen, ' + username + '!', 'success', 2500));
}
render() {
@@ -106,16 +105,16 @@ class LoginForm extends React.Component {
}
handlePasswordInput(input) {
- this.setState({ password : input.target.value });
+ this.setState({password: input.target.value});
}
handleEmailInput(input) {
- this.setState({ email : input.target.value });
+ this.setState({email: input.target.value});
}
}
function Hint(props) {
- if(props.hint != null) {
+ if (props.hint != null) {
return (
{ props.hint }
);
diff --git a/js/components/Navigation.js b/js/components/Navigation.js
index c14e8ac..eb2ec81 100644
--- a/js/components/Navigation.js
+++ b/js/components/Navigation.js
@@ -10,14 +10,13 @@ import {
NavItem,
NavLink
} from 'reactstrap';
-import { connect } from 'react-redux';
-import React from 'react';
+import {connect} from 'react-redux';
+import React from 'react';
-import { logout } from '../api';
+import {logout} from '../api';
import {notify} from 'react-notify-toast';
export class TurniereNavigation extends React.Component {
-
constructor(props) {
super(props);
@@ -58,7 +57,6 @@ function Navlink(props) {
}
class SmartNavLinks extends React.Component {
-
render() {
return (