Automatically apply eslint rules

This commit is contained in:
Felix Hamme 2019-05-08 18:26:54 +02:00 committed by Felix Hamme
parent f93f9a57ce
commit b40c0382a8
24 changed files with 439 additions and 458 deletions

View File

@ -59,7 +59,7 @@ const actiontypes_tournamentinfo = {
'MODIFY_TOURNAMENT_ERROR': 'MODIFY_TOURNAMENT_ERROR', 'MODIFY_TOURNAMENT_ERROR': 'MODIFY_TOURNAMENT_ERROR',
'REHYDRATE': 'TOURNAMENTINFO_REHYDRATE', 'REHYDRATE': 'TOURNAMENTINFO_REHYDRATE',
'CLEAR' : 'TOURNAMENTINFO_CLEAR', 'CLEAR': 'TOURNAMENTINFO_CLEAR'
}; };
const defaultstate_tournamentinfo = { const defaultstate_tournamentinfo = {
@ -138,7 +138,7 @@ function checkForAuthenticationHeaders(response) {
const requiredHeaders = [ const requiredHeaders = [
'access-token', 'client', 'uid', 'expiry' 'access-token', 'client', 'uid', 'expiry'
]; ];
for(var i = 0; i < requiredHeaders.length; i++) { for (let i = 0; i < requiredHeaders.length; i++) {
if (!response.headers[requiredHeaders[i]]) { if (!response.headers[requiredHeaders[i]]) {
return false; return false;
} }
@ -155,12 +155,12 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
'username': action.parameters.username, 'username': action.parameters.username,
'email': action.parameters.email, 'email': action.parameters.email,
'password': action.parameters.password 'password': action.parameters.password
}).then((resp) => { }).then(resp => {
__store.dispatch({ __store.dispatch({
type: actiontypes_userinfo.REGISTER_RESULT_SUCCESS type: actiontypes_userinfo.REGISTER_RESULT_SUCCESS
}); });
storeOptionalToken(resp); storeOptionalToken(resp);
}).catch((error) => { }).catch(error => {
if (error.response) { if (error.response) {
__store.dispatch({ __store.dispatch({
'type': actiontypes_userinfo.REGISTER_RESULT_ERROR, 'type': actiontypes_userinfo.REGISTER_RESULT_ERROR,
@ -195,7 +195,7 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
postRequest(action.state, '/users/sign_in', { postRequest(action.state, '/users/sign_in', {
email: action.parameters.email, email: action.parameters.email,
password: action.parameters.password password: action.parameters.password
}).then((resp) => { }).then(resp => {
__store.dispatch({ __store.dispatch({
type: actiontypes_userinfo.LOGIN_RESULT_SUCCESS, type: actiontypes_userinfo.LOGIN_RESULT_SUCCESS,
parameters: { parameters: {
@ -204,7 +204,7 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
} }
}); });
storeOptionalToken(resp); storeOptionalToken(resp);
}).catch((error) => { }).catch(error => {
if (error.response) { if (error.response) {
__store.dispatch({ __store.dispatch({
'type': actiontypes_userinfo.LOGIN_RESULT_ERROR, 'type': actiontypes_userinfo.LOGIN_RESULT_ERROR,
@ -229,7 +229,7 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
isSignedIn: true, isSignedIn: true,
error: false, error: false,
errorMessages: [], errorMessages: [],
username : action.parameters.username, username: action.parameters.username
}); });
case actiontypes_userinfo.LOGIN_RESULT_ERROR: case actiontypes_userinfo.LOGIN_RESULT_ERROR:
return Object.assign({}, state, { return Object.assign({}, state, {
@ -252,7 +252,7 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
uid: action.parameters.uid uid: action.parameters.uid
}); });
case actiontypes_userinfo.VERIFY_CREDENTIALS: case actiontypes_userinfo.VERIFY_CREDENTIALS:
getRequest(action.state, '/users/validate_token').then((resp) => { getRequest(action.state, '/users/validate_token').then(resp => {
storeOptionalToken(resp); storeOptionalToken(resp);
}).catch(() => { }).catch(() => {
__store.dispatch({type: actiontypes_userinfo.CLEAR}); __store.dispatch({type: actiontypes_userinfo.CLEAR});
@ -279,7 +279,7 @@ const reducer_userinfo = (state = defaultstate_userinfo, action) => {
const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) => { const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) => {
switch (action.type) { switch (action.type) {
case actiontypes_tournamentinfo.CREATE_TOURNAMENT: 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); storeOptionalToken(resp);
action.parameters.successCallback(); action.parameters.successCallback();
}).catch(() => { }).catch(() => {
@ -287,7 +287,7 @@ const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) =>
}); });
return Object.assign({}, state, {}); return Object.assign({}, state, {});
case actiontypes_tournamentinfo.REQUEST_TOURNAMENT: 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({ __store.dispatch({
type: actiontypes_tournamentinfo.REQUEST_TOURNAMENT_SUCCESS, type: actiontypes_tournamentinfo.REQUEST_TOURNAMENT_SUCCESS,
parameters: resp.data parameters: resp.data
@ -312,10 +312,10 @@ const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) =>
case actiontypes_tournamentinfo.MODIFY_TOURNAMENT: case actiontypes_tournamentinfo.MODIFY_TOURNAMENT:
patchRequest(action.state, '/teams/' + action.parameters.teamid, { patchRequest(action.state, '/teams/' + action.parameters.teamid, {
name: action.parameters.name name: action.parameters.name
}).then((resp) => { }).then(resp => {
storeOptionalToken(resp); storeOptionalToken(resp);
action.parameters.onSuccess(); action.parameters.onSuccess();
}).catch((error) => { }).catch(error => {
if (error.response) { if (error.response) {
storeOptionalToken(error.response); storeOptionalToken(error.response);
} }
@ -341,14 +341,14 @@ const reducer_tournamentinfo = (state = defaultstate_tournamentinfo, action) =>
const reducer_tournamentlist = (state = defaultstate_tournamentlist, action) => { const reducer_tournamentlist = (state = defaultstate_tournamentlist, action) => {
switch (action.type) { switch (action.type) {
case actiontypes_tournamentlist.FETCH: 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({ __store.dispatch({
type: actiontypes_tournamentlist.FETCH_SUCCESS, type: actiontypes_tournamentlist.FETCH_SUCCESS,
parameters: resp.data parameters: resp.data
}); });
storeOptionalToken(resp); storeOptionalToken(resp);
action.parameters.successCallback(resp.data); action.parameters.successCallback(resp.data);
}).catch((error) => { }).catch(error => {
if (error.response) { if (error.response) {
storeOptionalToken(error.response); storeOptionalToken(error.response);
} }
@ -374,8 +374,8 @@ const default_applicationstate = {
tournamentlist: defaultstate_tournamentlist tournamentlist: defaultstate_tournamentlist
}; };
var __store; let __store;
var applicationHydrated = false; let applicationHydrated = false;
export function initializeStore(initialState = default_applicationstate) { export function initializeStore(initialState = default_applicationstate) {
__store = createStore( __store = createStore(

View File

@ -13,7 +13,6 @@ import {
import '../../static/css/editablestringlist.css'; import '../../static/css/editablestringlist.css';
export default class EditableStringList extends React.Component { export default class EditableStringList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -32,7 +31,7 @@ export default class EditableStringList extends React.Component {
} }
this.state.teams.push(text); this.state.teams.push(text);
var lastGroup = this.state.groups[this.state.groups.length - 1]; let lastGroup = this.state.groups[this.state.groups.length - 1];
if (lastGroup === undefined || lastGroup.length >= this.state.groupSize) { if (lastGroup === undefined || lastGroup.length >= this.state.groupSize) {
this.state.groups[this.state.groups.length] = []; this.state.groups[this.state.groups.length] = [];
} }
@ -67,15 +66,15 @@ export default class EditableStringList extends React.Component {
removeTeamFromGroup(text) { removeTeamFromGroup(text) {
this.state.teams = this.state.teams.filter(item => item !== text); this.state.teams = this.state.teams.filter(item => item !== text);
let teamIndex = this.findTeam(text); const teamIndex = this.findTeam(text);
if (teamIndex === null) { if (teamIndex === null) {
return false; return false;
} }
// Move every first team to the next group // Move every first team to the next group
this.state.groups[teamIndex.group].splice(teamIndex.team, 1); this.state.groups[teamIndex.group].splice(teamIndex.team, 1);
for(var group = teamIndex.group; group < this.state.groups.length - 1; group++) { for (let group = teamIndex.group; group < this.state.groups.length - 1; group++) {
let currentGroup = this.state.groups[group]; const currentGroup = this.state.groups[group];
currentGroup[currentGroup.length] = this.state.groups[group + 1].splice(0, 1)[0]; currentGroup[currentGroup.length] = this.state.groups[group + 1].splice(0, 1)[0];
} }
@ -88,8 +87,8 @@ export default class EditableStringList extends React.Component {
} }
findTeam(text) { findTeam(text) {
for(var group = 0; group < this.state.groups.length; group++) { for (let group = 0; group < this.state.groups.length; group++) {
for(var team = 0; team < this.state.groups[group].length; team++) { for (let team = 0; team < this.state.groups[group].length; team++) {
if (this.state.groups[group][team] === text) { if (this.state.groups[group][team] === text) {
return { return {
group: group, group: group,
@ -102,15 +101,15 @@ export default class EditableStringList extends React.Component {
} }
resizeGroups(newSize) { resizeGroups(newSize) {
let oldGroups = this.state.groups; const oldGroups = this.state.groups;
var rearrangedGroups = []; const rearrangedGroups = [];
for(var oldGroupIndex = 0; oldGroupIndex < oldGroups.length; oldGroupIndex++) { for (let oldGroupIndex = 0; oldGroupIndex < oldGroups.length; oldGroupIndex++) {
for(var oldTeamIndex = 0; oldTeamIndex < oldGroups[oldGroupIndex].length; oldTeamIndex++) { for (let oldTeamIndex = 0; oldTeamIndex < oldGroups[oldGroupIndex].length; oldTeamIndex++) {
let index = oldGroupIndex * this.state.groupSize + oldTeamIndex; const index = oldGroupIndex * this.state.groupSize + oldTeamIndex;
let newGroupIndex = Math.floor(index / newSize); const newGroupIndex = Math.floor(index / newSize);
let newTeamIndex = index % newSize; const newTeamIndex = index % newSize;
if (newTeamIndex === 0) { if (newTeamIndex === 0) {
rearrangedGroups[newGroupIndex] = []; rearrangedGroups[newGroupIndex] = [];
@ -168,7 +167,7 @@ export default class EditableStringList extends React.Component {
return ( return (
<div className="bg-light p-3 text-secondary font-italic"> <div className="bg-light p-3 text-secondary font-italic">
<StringInput submit={this.add} placeholder={this.props.inputPlaceholder} addButtonText={this.props.addButtonText}/> <StringInput submit={this.add} placeholder={this.props.inputPlaceholder} addButtonText={this.props.addButtonText}/>
{this.state.teams.map((text) => <Item text={text} key={text} removeItem={this.remove}/>)} {this.state.teams.map(text => <Item text={text} key={text} removeItem={this.remove}/>)}
</div> </div>
); );
} else { } else {
@ -184,7 +183,6 @@ export default class EditableStringList extends React.Component {
} }
class GroupView extends React.Component { class GroupView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
@ -199,9 +197,9 @@ class GroupView extends React.Component {
{group.map((team, teamindex) => ( {group.map((team, teamindex) => (
<div key={team} draggable droppable="droppable" <div key={team} draggable droppable="droppable"
className="grouped-team-item" className="grouped-team-item"
onDragStart={(e) => this.onDragStart(e, groupindex,teamindex)} onDragStart={e => this.onDragStart(e, groupindex, teamindex)}
onDragOver={(e) => this.onDragOver(e)} onDragOver={e => this.onDragOver(e)}
onDrop={(e) => this.onDrop(e, groupindex, teamindex)}> onDrop={e => this.onDrop(e, groupindex, teamindex)}>
<Item text={team} removeItem={this.props.removeTeam}/> <Item text={team} removeItem={this.props.removeTeam}/>
@ -231,8 +229,8 @@ class GroupView extends React.Component {
onDrop(e, group, team) { onDrop(e, group, team) {
e.preventDefault(); e.preventDefault();
let src = JSON.parse(e.dataTransfer.getData('text')); const src = JSON.parse(e.dataTransfer.getData('text'));
let dest = { const dest = {
group: group, group: group,
team: team team: team
}; };
@ -256,7 +254,7 @@ class StringInput extends React.Component {
render() { render() {
return ( return (
<InputGroup className="mb-3"> <InputGroup className="mb-3">
<Input placeholder={this.props.placeholder} type="text" size="255" value={this.state.value} required onChange={this.handleChange} onKeyPress={(e) => { <Input placeholder={this.props.placeholder} type="text" size="255" value={this.state.value} required onChange={this.handleChange} onKeyPress={e => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
this.submit(); this.submit();
return false; return false;

View File

@ -11,7 +11,6 @@ import '../../static/everypage.css';
import '../../static/css/error.css'; import '../../static/css/error.css';
export class ErrorPageComponent extends React.Component { export class ErrorPageComponent extends React.Component {
static getInitialProps({statusCode}) { static getInitialProps({statusCode}) {
return {statusCode}; return {statusCode};
} }

View File

@ -46,7 +46,7 @@ class LoginErrorList extends React.Component {
} }
} }
const mapStateToErrorMessages = (state) => { const mapStateToErrorMessages = state => {
const {errorMessages, error} = state.userinfo; const {errorMessages, error} = state.userinfo;
return {errorMessages, error}; return {errorMessages, error};
}; };
@ -64,7 +64,7 @@ class LoginSuccessRedirectComponent extends React.Component {
} }
} }
const mapLoginState = (state) => { const mapLoginState = state => {
const {isSignedIn} = state.userinfo; const {isSignedIn} = state.userinfo;
return {isSignedIn}; return {isSignedIn};
}; };
@ -72,7 +72,6 @@ const mapLoginState = (state) => {
const LoginSuccessRedirect = connect(mapLoginState)(LoginSuccessRedirectComponent); const LoginSuccessRedirect = connect(mapLoginState)(LoginSuccessRedirectComponent);
class LoginForm extends React.Component { class LoginForm extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -84,7 +83,7 @@ class LoginForm extends React.Component {
tryLogin(event) { tryLogin(event) {
event.preventDefault(); 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() { render() {

View File

@ -17,7 +17,6 @@ import { logout } from '../api';
import {notify} from 'react-notify-toast'; import {notify} from 'react-notify-toast';
export class TurniereNavigation extends React.Component { export class TurniereNavigation extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -58,7 +57,6 @@ function Navlink(props) {
} }
class SmartNavLinks extends React.Component { class SmartNavLinks extends React.Component {
render() { render() {
return (<Nav navbar className="mr-auto"> return (<Nav navbar className="mr-auto">
<Navlink target="/create" text="Turnier erstellen"/> <Navlink target="/create" text="Turnier erstellen"/>
@ -74,7 +72,6 @@ function Betabadge() {
} }
class InvisibleLoginLogoutButtons extends React.Component { class InvisibleLoginLogoutButtons extends React.Component {
logout() { logout() {
logout(() => notify.show('Du bist jetzt abgemeldet.', 'success', 2500)); logout(() => notify.show('Du bist jetzt abgemeldet.', 'success', 2500));
} }
@ -100,7 +97,7 @@ class InvisibleLoginLogoutButtons extends React.Component {
} }
} }
const mapStateToUserinfo = (state) => { const mapStateToUserinfo = state => {
const {isSignedIn, username} = state.userinfo; const {isSignedIn, username} = state.userinfo;
return {isSignedIn, username}; return {isSignedIn, username};
}; };

View File

@ -30,12 +30,11 @@ import React from 'react';
* since it would always be taken otherwise (the options' conditions are checked from top to bottom) * since it would always be taken otherwise (the options' conditions are checked from top to bottom)
*/ */
export class UserRestrictor extends React.Component { export class UserRestrictor extends React.Component {
render() { render() {
const {children} = this.props; const {children} = this.props;
for(var i in children) { for (const i in children) {
var c = children[i]; const c = children[i];
if (c.props.condition) { if (c.props.condition) {
return c; return c;

View File

@ -17,7 +17,7 @@ function getOrCreateStore (initialState) {
return window[__NEXT_REDUX_STORE__]; return window[__NEXT_REDUX_STORE__];
} }
export default (App) => { export default App => {
return class AppWithRedux extends React.Component { return class AppWithRedux extends React.Component {
static async getInitialProps(appContext) { static async getInitialProps(appContext) {
// Get or Create the store with `undefined` as initialState // Get or Create the store with `undefined` as initialState

View File

@ -8,7 +8,6 @@ import withReduxStore from '../js/redux/reduxStoreBinder';
import {verifyCredentials} from '../js/api.js'; import {verifyCredentials} from '../js/api.js';
class TurniereApp extends App { class TurniereApp extends App {
componentDidMount() { componentDidMount() {
verifyCredentials(); verifyCredentials();
} }

View File

@ -26,7 +26,6 @@ import { createTournament } from '../js/api';
import '../static/everypage.css'; import '../static/everypage.css';
class CreatePage extends React.Component { class CreatePage extends React.Component {
render() { render() {
const {isSignedIn} = this.props; const {isSignedIn} = this.props;
@ -181,7 +180,7 @@ class CreateTournamentForm extends React.Component {
} }
handleGroupSizeInput(input) { handleGroupSizeInput(input) {
let newSize = input.target.value; const newSize = input.target.value;
if (newSize <= this.state.groupAdvance) { if (newSize <= this.state.groupAdvance) {
this.setState({ this.setState({
groupSize: newSize, groupSize: newSize,
@ -225,7 +224,6 @@ class CreateTournamentForm extends React.Component {
notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000); notify.show('Das Turnier konnte nicht erstellt werden.', 'warning', 5000);
}); });
} }
} }
/** /**
@ -245,7 +243,7 @@ class CreateTournamentForm extends React.Component {
* backend * backend
*/ */
function createTeamArray(groupphase, groups, teams) { function createTeamArray(groupphase, groups, teams) {
let result = []; const result = [];
if (groupphase) { if (groupphase) {
for (let groupNumber = 0; groupNumber < groups.length; groupNumber++) { for (let groupNumber = 0; groupNumber < groups.length; groupNumber++) {

View File

@ -222,7 +222,6 @@ function TournamentFaq() {
} }
export default class FaqPage extends React.Component { export default class FaqPage extends React.Component {
render() { render() {
return ( return (
<div> <div>

View File

@ -74,7 +74,6 @@ function ImprintText(){
export default class ImprintPage extends React.Component { export default class ImprintPage extends React.Component {
render() { render() {
return ( return (
<div> <div>

View File

@ -170,7 +170,6 @@ function PromotedLinkCreateTournament() {
class Index extends React.Component { class Index extends React.Component {
render() { render() {
return ( return (
<div> <div>

View File

@ -10,7 +10,6 @@ import TournamentList from '../js/components/TournamentList';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
export default class PublicTournamentsPage extends React.Component { export default class PublicTournamentsPage extends React.Component {
render() { render() {
return ( return (
<div className="main generic-fullpage-bg"> <div className="main generic-fullpage-bg">
@ -46,7 +45,6 @@ function PublicTournaments(props) {
<a href='/private' className="btn btn-success shadow">zu den privaten Turnieren</a> <a href='/private' className="btn btn-success shadow">zu den privaten Turnieren</a>
</Container> </Container>
</div>); </div>);
} else { } else {
return (<Container className='py-5'> return (<Container className='py-5'>
<PublicTournamentsCard/> <PublicTournamentsCard/>

View File

@ -8,7 +8,6 @@ import { Login } from '../js/components/Login';
import '../static/everypage.css'; import '../static/everypage.css';
export default class LoginPage extends React.Component { export default class LoginPage extends React.Component {
render() { render() {
return ( return (
<div className="main generic-fullpage-bg"> <div className="main generic-fullpage-bg">

View File

@ -494,7 +494,6 @@ function PrivacyText(){
export default class PrivacyPage extends React.Component { export default class PrivacyPage extends React.Component {
render() { render() {
return ( return (
<div> <div>

View File

@ -2,7 +2,7 @@ import Head from 'next/head';
import React from 'react'; import React from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {Card, CardBody, Container,} from 'reactstrap'; import {Card, CardBody, Container} from 'reactstrap';
import {TurniereNavigation} from '../js/components/Navigation'; import {TurniereNavigation} from '../js/components/Navigation';
import {Footer} from '../js/components/Footer'; import {Footer} from '../js/components/Footer';
@ -13,7 +13,6 @@ import '../static/everypage.css';
import TournamentList from '../js/components/TournamentList'; import TournamentList from '../js/components/TournamentList';
class PrivateTournamentsPage extends React.Component { class PrivateTournamentsPage extends React.Component {
render() { render() {
const {isSignedIn} = this.props; const {isSignedIn} = this.props;

View File

@ -39,7 +39,6 @@ export default class RegisterPage extends React.Component {
} }
class Register extends React.Component { class Register extends React.Component {
render() { render() {
return ( return (
<Container className="py-5"> <Container className="py-5">
@ -74,7 +73,7 @@ class RegisterErrorList extends React.Component {
} }
} }
const mapStateToErrorMessages = (state) => { const mapStateToErrorMessages = state => {
const {errorMessages, error} = state.userinfo; const {errorMessages, error} = state.userinfo;
return {errorMessages, error}; return {errorMessages, error};
}; };

View File

@ -25,7 +25,6 @@ import '../static/everypage.css';
import '../static/css/index.css'; import '../static/css/index.css';
class EditTournamentPage extends React.Component { class EditTournamentPage extends React.Component {
static async getInitialProps({query}) { static async getInitialProps({query}) {
return {query}; return {query};
} }
@ -64,7 +63,9 @@ class EditTournamentPage extends React.Component {
<TurniereNavigation/> <TurniereNavigation/>
<BigImage text={ tournamentname }/> <BigImage text={ tournamentname }/>
<EditTournamentContent ref={(edittournamentcontent) => { this._edittournamentcontent = edittournamentcontent; }}/> <EditTournamentContent ref={edittournamentcontent => {
this._edittournamentcontent = edittournamentcontent;
}}/>
<Footer/> <Footer/>
</div> </div>
</Option> </Option>
@ -103,13 +104,16 @@ export default connect(
)(EditTournamentPage); )(EditTournamentPage);
class EditTournamentContent extends React.Component { class EditTournamentContent extends React.Component {
render() { render() {
return ( return (
<div className='mb-5'> <div className='mb-5'>
<ReturnToTournamentButton/> <ReturnToTournamentButton/>
<EditTournamentPropertiesField ref={(field) => { this._edittournamentpropertiesfield = field; }}/> <EditTournamentPropertiesField ref={field => {
<EditTeamField ref={(field) => { this._editteamfield = field; }}/> this._edittournamentpropertiesfield = field;
}}/>
<EditTeamField ref={field => {
this._editteamfield = field;
}}/>
</div> </div>
); );
} }
@ -129,13 +133,14 @@ function ReturnToTournamentButton() {
} }
class EditTournamentPropertiesField extends React.Component { class EditTournamentPropertiesField extends React.Component {
render() { render() {
return ( return (
<Card className="container"> <Card className="container">
<CardBody> <CardBody>
<h2>Turnier-Eigenschaften ändern</h2> <h2>Turnier-Eigenschaften ändern</h2>
<VisibleEditTournamentForm ref={(form) => { this._visibleedittournamentform = form; }}/> <VisibleEditTournamentForm ref={form => {
this._visibleedittournamentform = form;
}}/>
</CardBody> </CardBody>
</Card> </Card>
); );
@ -147,7 +152,6 @@ class EditTournamentPropertiesField extends React.Component {
} }
class EditTournamentForm extends React.Component { class EditTournamentForm extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -222,13 +226,14 @@ const VisibleEditTournamentForm = connect(
)(EditTournamentForm); )(EditTournamentForm);
class EditTeamField extends React.Component { class EditTeamField extends React.Component {
render() { render() {
return ( return (
<Card className="container my-4"> <Card className="container my-4">
<CardBody> <CardBody>
<h2>Team-Namen ändern</h2> <h2>Team-Namen ändern</h2>
<VisibleEditTeamNamesForm ref={(form) => { this._visibleeditteamnamesform = form; }}/> <VisibleEditTeamNamesForm ref={form => {
this._visibleeditteamnamesform = form;
}}/>
</CardBody> </CardBody>
</Card> </Card>
); );
@ -240,7 +245,6 @@ class EditTeamField extends React.Component {
} }
class EditTeamNamesForm extends React.Component { class EditTeamNamesForm extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -279,7 +283,7 @@ class EditTeamNamesForm extends React.Component {
} }
handleNameInput(index, input) { handleNameInput(index, input) {
let team = this.state.teams.slice(); const team = this.state.teams.slice();
team[index].name = input.target.value; team[index].name = input.target.value;

View File

@ -2,7 +2,6 @@ import Head from 'next/head';
import React from 'react'; import React from 'react';
class FullscreenTournamentPage extends React.Component { class FullscreenTournamentPage extends React.Component {
static async getInitialProps({query}) { static async getInitialProps({query}) {
return {query}; return {query};
} }

View File

@ -35,7 +35,6 @@ import '../static/everypage.css';
import '../static/css/tournament.css'; import '../static/css/tournament.css';
class PrivateTournamentPage extends React.Component { class PrivateTournamentPage extends React.Component {
render() { render() {
const {id, description, isPublic, code, ownerUsername, playoffStages} = this.props.tournament; const {id, description, isPublic, code, ownerUsername, playoffStages} = this.props.tournament;
const {isSignedIn, username} = this.props; const {isSignedIn, username} = this.props;
@ -126,7 +125,7 @@ class Match extends React.Component {
} }
render() { render() {
let cardClass, smallMessage, borderClass; let cardClass; let smallMessage; let borderClass;
// possible states: single_team not_ready not_started in_progress team1_won team2_won undecided // possible states: single_team not_ready not_started in_progress team1_won team2_won undecided
switch (this.props.match.state) { switch (this.props.match.state) {
case 'in_progress': case 'in_progress':
@ -220,7 +219,7 @@ function MatchModal(props) {
} }
function MatchTable(props) { function MatchTable(props) {
let team1Class, team2Class; let team1Class; let team2Class;
// possible states: single_team not_ready not_started in_progress team1_won team2_won undecided // possible states: single_team not_ready not_started in_progress team1_won team2_won undecided
switch (props.match.state) { switch (props.match.state) {
case 'in_progress': case 'in_progress':
@ -327,8 +326,8 @@ class ScoreInput extends React.Component {
function convertTournament(apiTournament) { function convertTournament(apiTournament) {
let groupStage = null; let groupStage = null;
let playoffStages = []; const playoffStages = [];
for (let stage of apiTournament.stages) { for (const stage of apiTournament.stages) {
if (stage.groups.length > 0) { if (stage.groups.length > 0) {
// group stage // group stage
groupStage = {groups: stage.groups.map(group => convertGroup(group))}; groupStage = {groups: stage.groups.map(group => convertGroup(group))};
@ -363,7 +362,7 @@ function convertGroup(apiGroup) {
} }
function convertMatch(apiMatch) { function convertMatch(apiMatch) {
let result = { const result = {
id: apiMatch.id, id: apiMatch.id,
state: apiMatch.state state: apiMatch.state
}; };
@ -389,7 +388,6 @@ function convertMatch(apiMatch) {
} }
class Main extends React.Component { class Main extends React.Component {
static async getInitialProps({query}) { static async getInitialProps({query}) {
return {query}; return {query};
} }
@ -409,7 +407,7 @@ class Main extends React.Component {
.then(response => { .then(response => {
this.setState({status: response.status, tournament: convertTournament(response.data)}); this.setState({status: response.status, tournament: convertTournament(response.data)});
}) })
.catch((err) => { .catch(err => {
if (err.response) { if (err.response) {
this.setState({status: err.response.status}); this.setState({status: err.response.status});
} else { } else {

View File

@ -31,7 +31,7 @@ app.prepare()
return handle(req, res); return handle(req, res);
}); });
server.listen(dev ? 3000 : 80, (err) => { server.listen(dev ? 3000 : 80, err => {
if (err) throw err; if (err) throw err;
}); });
}) })