diff --git a/js/components/EditableStringList.js b/js/components/EditableStringList.js index b7ea161..836d4d6 100644 --- a/js/components/EditableStringList.js +++ b/js/components/EditableStringList.js @@ -1,13 +1,6 @@ import React from 'react'; import { - Alert, - Button, - Card, - CardBody, - CardTitle, - Input, - InputGroup, - InputGroupAddon + Alert, Button, Card, CardBody, CardTitle, Input, InputGroup, InputGroupAddon } from 'reactstrap'; import '../../static/css/editablestringlist.css'; @@ -16,9 +9,7 @@ export default class EditableStringList extends React.Component { constructor(props) { super(props); this.state = { - groupSize: props.groupSize, - teams: props.teams, - groups: props.groups + groupSize: props.groupSize, teams: props.teams, groups: props.groups }; this.add = this.add.bind(this); this.remove = this.remove.bind(this); @@ -39,8 +30,7 @@ export default class EditableStringList extends React.Component { lastGroup[lastGroup.length] = text; this.setState({ - teams: this.state.teams, - groups: this.state.groups + teams: this.state.teams, groups: this.state.groups }); this.props.onTeamsChange(this.state.teams); @@ -55,8 +45,7 @@ export default class EditableStringList extends React.Component { } this.setState({ - teams: this.state.teams, - groups: this.state.groups + teams: this.state.teams, groups: this.state.groups }); this.props.onTeamsChange(this.state.teams); @@ -91,8 +80,7 @@ export default class EditableStringList extends React.Component { for (let team = 0; team < this.state.groups[group].length; team++) { if (this.state.groups[group][team] === text) { return { - group: group, - team: team + group: group, team: team }; } } @@ -120,8 +108,7 @@ export default class EditableStringList extends React.Component { } this.setState({ - groupSize: newSize, - groups: rearrangedGroups + groupSize: newSize, groups: rearrangedGroups }); this.props.onGroupsChange(this.state.groups); } @@ -148,35 +135,32 @@ export default class EditableStringList extends React.Component { if (this.props.groupPhaseEnabled) { if ((typeof this.state.teams !== 'undefined') && this.state.teams.length > 0) { - return ( -
- - -
- ); + return (
+ + +
); } else { - return ( -
- - {this.props.groupPlaceHolder} -
- ); + return (
+ + {this.props.groupPlaceHolder} +
); } } else { if ((typeof this.state.teams !== 'undefined') && this.state.teams.length > 0) { - return ( -
- - {this.state.teams.map(text => )} -
- ); + return (
+ + {this.state.teams.map(text => )} +
); } else { - return ( -
- - {this.props.teamPlaceholder} -
- ); + return (
+ + {this.props.teamPlaceholder} +
); } } } @@ -188,38 +172,28 @@ class GroupView extends React.Component { } render() { - return ( -
- {this.props.groups.map((group, groupindex) => ( - - - Group {groupindex + 1} - {group.map((team, teamindex) => ( -
this.onDragStart(e, groupindex, teamindex)} - onDragOver={e => this.onDragOver(e)} - onDrop={e => this.onDrop(e, groupindex, teamindex)}> + return (
+ {this.props.groups.map((group, groupindex) => ( + + Group {groupindex + 1} + {group.map((team, teamindex) => (
this.onDragStart(e, groupindex, teamindex)} + onDragOver={e => this.onDragOver(e)} + onDrop={e => this.onDrop(e, groupindex, teamindex)}> - + -
- ))} -
-
- ))} -
- ); +
))} +
+
))} +
); } onDragStart(e, group, team) { - e.dataTransfer.setData( - 'text/plain', - JSON.stringify({ - group: group, - team: team - }) - ); + e.dataTransfer.setData('text/plain', JSON.stringify({ + group: group, team: team + })); } onDragOver(e) { @@ -231,8 +205,7 @@ class GroupView extends React.Component { const src = JSON.parse(e.dataTransfer.getData('text')); const dest = { - group: group, - team: team + group: group, team: team }; this.props.onGroupSwitched(src, dest); @@ -252,20 +225,19 @@ class StringInput extends React.Component { } render() { - return ( - - { + return ( + { if (e.key === 'Enter') { this.submit(); return false; } }}/> - - - - - ); + + + + ); } submit() { @@ -290,10 +262,8 @@ class Item extends React.Component { } render() { - return ( - - {this.props.text} - - ); + return ( + {this.props.text} + ); } } diff --git a/js/components/Login.js b/js/components/Login.js index f90d30d..e2b5026 100644 --- a/js/components/Login.js +++ b/js/components/Login.js @@ -9,37 +9,30 @@ import '../../static/css/errormessages.css'; import {notify} from 'react-notify-toast'; export function Login(props) { - return ( - - - -

Login

- - - -
-
-
- ); + return ( + + +

Login

+ + + +
+
+
); } class LoginErrorList extends React.Component { render() { const {error, errorMessages} = this.props; if (error) { - return ( - - ); + return (); } else { return null; } @@ -51,9 +44,7 @@ const mapStateToErrorMessages = state => { return {errorMessages, error}; }; -const VisibleLoginErrorList = connect( - mapStateToErrorMessages -)(LoginErrorList); +const VisibleLoginErrorList = connect(mapStateToErrorMessages)(LoginErrorList); class LoginSuccessRedirectComponent extends React.Component { render() { @@ -76,32 +67,32 @@ class LoginForm extends React.Component { 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() { - return ( -
- - - - - - - - - - - - - ); + return (
+ + + + + + + + + + + + ); } handlePasswordInput(input) { @@ -115,9 +106,7 @@ class LoginForm extends React.Component { function Hint(props) { if (props.hint != null) { - return ( -

{ props.hint }

- ); + return (

{props.hint}

); } else { return null; } diff --git a/js/components/Navigation.js b/js/components/Navigation.js index eb2ec81..917d30a 100644 --- a/js/components/Navigation.js +++ b/js/components/Navigation.js @@ -1,14 +1,5 @@ import { - Badge, - Button, - ButtonGroup, - Collapse, - Nav, - Navbar, - NavbarBrand, - NavbarToggler, - NavItem, - NavLink + Badge, Button, ButtonGroup, Collapse, Nav, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap'; import {connect} from 'react-redux'; import React from 'react'; @@ -34,26 +25,22 @@ export class TurniereNavigation extends React.Component { } render() { - return ( - - turnie.re - - - - - - - - ); + return ( + turnie.re + + + + + + + ); } } function Navlink(props) { - return ( - - {props.text} - - ); + return ( + {props.text} + ); } class SmartNavLinks extends React.Component { @@ -80,19 +67,19 @@ class InvisibleLoginLogoutButtons extends React.Component { const {isSignedIn, username} = this.props; if (isSignedIn) { - return ( - - - - - ); + return ( + + + ); } else { - return ( - - - - - ); + return ( + + + ); } } } @@ -102,10 +89,6 @@ const mapStateToUserinfo = state => { return {isSignedIn, username}; }; -const LoginLogoutButtons = connect( - mapStateToUserinfo -)(InvisibleLoginLogoutButtons); +const LoginLogoutButtons = connect(mapStateToUserinfo)(InvisibleLoginLogoutButtons); -const NavLinks = connect( - mapStateToUserinfo -)(SmartNavLinks); +const NavLinks = connect(mapStateToUserinfo)(SmartNavLinks); diff --git a/pages/_app.js b/pages/_app.js index fa32ca1..ac91bd6 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -14,15 +14,13 @@ class TurniereApp extends App { render() { const {Component, pageProps, reduxStore} = this.props; - return ( - - - - - - - - ); + return ( + + + + + + ); } } diff --git a/pages/_error.js b/pages/_error.js index ed893ca..b9af198 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -14,8 +14,6 @@ export default class Error extends React.Component { } render() { - return ( - - ); + return (); } } diff --git a/pages/create.js b/pages/create.js index fd67f55..e70c10c 100644 --- a/pages/create.js +++ b/pages/create.js @@ -5,15 +5,7 @@ import {connect} from 'react-redux'; import posed from 'react-pose'; import { - Button, - Card, - CardBody, - Container, - CustomInput, - Form, - FormGroup, - Input, - Label + Button, Card, CardBody, Container, CustomInput, Form, FormGroup, Input, Label } from 'reactstrap'; import {TurniereNavigation} from '../js/components/Navigation'; @@ -29,34 +21,32 @@ class CreatePage extends React.Component { render() { const {isSignedIn} = this.props; - return ( - -