Fix some code issues from eslint
This commit is contained in:
parent
7f28252ae8
commit
38e24a2ec1
|
|
@ -300,10 +300,10 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a
|
||||||
return Object.assign({}, state, action.parameters.tournamentInfo);
|
return Object.assign({}, state, action.parameters.tournamentInfo);
|
||||||
case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS:
|
case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS:
|
||||||
action.parameters.successCallback();
|
action.parameters.successCallback();
|
||||||
return Object.assign({}, state, tournamentStatistics);
|
return Object.assign({}, state, action.parameters.tournamentStatistics);
|
||||||
default: return state;
|
default: return state;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const reducerTournamentlist = (state = defaultStateTournamentlist, action) => {
|
const reducerTournamentlist = (state = defaultStateTournamentlist, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import {
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
|
|
||||||
export class DominanceShower extends React.Component {
|
export class DominanceShower extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Card className="shadow-sm">
|
<Card className="shadow-sm">
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,9 @@ import {
|
||||||
Table
|
Table
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
|
|
||||||
import { rangedmap } from '../utils/rangedmap';
|
import {rangedmap} from '../utils/rangedmap';
|
||||||
|
|
||||||
export class StandingsTable extends React.Component {
|
export class StandingsTable extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
|
@ -21,7 +20,7 @@ export class StandingsTable extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let performances = this.props.data.group_phase_performances;
|
const performances = this.props.data.group_phase_performances;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="shadow-sm">
|
<Card className="shadow-sm">
|
||||||
|
|
@ -38,18 +37,21 @@ export class StandingsTable extends React.Component {
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{ rangedmap(performances, (team, index) => (
|
{ rangedmap(performances, (team, index) => (
|
||||||
<TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'} key={index} teamToShow={team}/>
|
<TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'}
|
||||||
|
key={index} teamToShow={team}/>
|
||||||
), 0, 3) }
|
), 0, 3) }
|
||||||
</tbody>
|
</tbody>
|
||||||
<Collapse isOpen={ this.state.showFullTable } tag="tbody">
|
<Collapse isOpen={ this.state.showFullTable } tag="tbody">
|
||||||
{ rangedmap(performances, (team, index) => (
|
{ rangedmap(performances, (team, index) => (
|
||||||
<TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'} key={index} teamToShow={team}/>
|
<TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'}
|
||||||
|
key={index} teamToShow={team}/>
|
||||||
), 3) }
|
), 3) }
|
||||||
</Collapse>
|
</Collapse>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan='4'>
|
<td colSpan='4'>
|
||||||
<TableButton isFullTableShown={this.state.showFullTable} onToggle={this.toggleShowFullTable}/>
|
<TableButton isFullTableShown={this.state.showFullTable}
|
||||||
|
onToggle={this.toggleShowFullTable}/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|
@ -60,7 +62,7 @@ export class StandingsTable extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleShowFullTable() {
|
toggleShowFullTable() {
|
||||||
this.setState({ showFullTable: !this.state.showFullTable });
|
this.setState({showFullTable: !this.state.showFullTable});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,11 +84,10 @@ class TeamRow extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TableButton extends React.Component {
|
class TableButton extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { isFullTableShown } = this.props;
|
const {isFullTableShown} = this.props;
|
||||||
|
|
||||||
if(isFullTableShown) {
|
if (isFullTableShown) {
|
||||||
return <Button className="w-100" onClick={this.props.onToggle}>Zeige nur die 3 besten Teams</Button>;
|
return <Button className="w-100" onClick={this.props.onToggle}>Zeige nur die 3 besten Teams</Button>;
|
||||||
} else {
|
} else {
|
||||||
return <Button className="w-100" onClick={this.props.onToggle}>Zeige alle Teams</Button>;
|
return <Button className="w-100" onClick={this.props.onToggle}>Zeige alle Teams</Button>;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
ButtonGroup,
|
ButtonGroup,
|
||||||
|
|
@ -12,9 +12,8 @@ import {
|
||||||
|
|
||||||
|
|
||||||
class PrivateTournamentInformationView extends React.Component {
|
class PrivateTournamentInformationView extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { tournament, isSignedIn, username, currentpage } = this.props;
|
const {tournament, isSignedIn, username, currentpage} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
|
|
@ -45,8 +44,8 @@ class PrivateTournamentInformationView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToPrivateTournamentInformationViewProps(state) {
|
function mapStateToPrivateTournamentInformationViewProps(state) {
|
||||||
const { isSignedIn, username } = state.userinfo;
|
const {isSignedIn, username} = state.userinfo;
|
||||||
return { isSignedIn, username };
|
return {isSignedIn, username};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TournamentInformationView = connect(
|
export const TournamentInformationView = connect(
|
||||||
|
|
@ -54,9 +53,9 @@ export const TournamentInformationView = connect(
|
||||||
)(PrivateTournamentInformationView);
|
)(PrivateTournamentInformationView);
|
||||||
|
|
||||||
function ButtonsBadge(props) {
|
function ButtonsBadge(props) {
|
||||||
const { id, ownerName, isSignedIn, username, currentpage } = props;
|
const {id, ownerName, isSignedIn, username, currentpage} = props;
|
||||||
|
|
||||||
switch(currentpage) {
|
switch (currentpage) {
|
||||||
case 'statistics':
|
case 'statistics':
|
||||||
return (
|
return (
|
||||||
<ButtonGroup className={props.className}>
|
<ButtonGroup className={props.className}>
|
||||||
|
|
@ -83,14 +82,14 @@ function ButtonsBadge(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function TournamentButton(props) {
|
function TournamentButton(props) {
|
||||||
const { id } = props;
|
const {id} = props;
|
||||||
return <Button href={'/t/' + id} color='success'>Zum Turnier</Button>;
|
return <Button href={'/t/' + id} color='success'>Zum Turnier</Button>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EditButton(props) {
|
function EditButton(props) {
|
||||||
const { id, ownerName, isSignedIn, username } = props;
|
const {id, ownerName, isSignedIn, username} = props;
|
||||||
|
|
||||||
if(isSignedIn && ownerName === username) {
|
if (isSignedIn && ownerName === username) {
|
||||||
return (
|
return (
|
||||||
<Button href={'/t/' + id + '/edit'} color='success'>Turnier bearbeiten</Button>
|
<Button href={'/t/' + id + '/edit'} color='success'>Turnier bearbeiten</Button>
|
||||||
);
|
);
|
||||||
|
|
@ -100,7 +99,7 @@ function EditButton(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function StatisticsButton(props) {
|
function StatisticsButton(props) {
|
||||||
const { id } = props;
|
const {id} = props;
|
||||||
return <Button href={'/t/' + id + '/statistics'} color='success'>Statistiken zum Turnier</Button>;
|
return <Button href={'/t/' + id + '/statistics'} color='success'>Statistiken zum Turnier</Button>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export function transformTournamentInfoToStatistics(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformTournamentStatsToStatistics(data) {
|
export function transformTournamentStatsToStatistics(data) {
|
||||||
if(statisticsUnavailable(data)) {
|
if (statisticsUnavailable(data)) {
|
||||||
return {
|
return {
|
||||||
statistics_available: false,
|
statistics_available: false,
|
||||||
most_dominant_team: {},
|
most_dominant_team: {},
|
||||||
|
|
@ -61,14 +61,14 @@ export function transformTournamentStatsToStatistics(data) {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let i = 0; i < data.group_scores.length; i++) {
|
for (let i = 0; i < data.group_scores.length; i++) {
|
||||||
let score = data.group_scores[i];
|
const score = data.group_scores[i];
|
||||||
|
|
||||||
statistics.group_phase_performances[i] = {
|
statistics.group_phase_performances[i] = {
|
||||||
win_loss_differential: score.group_points,
|
win_loss_differential: score.group_points,
|
||||||
point_differential: score.scored_points - score.received_points,
|
point_differential: score.scored_points - score.received_points,
|
||||||
rank: i + 1,
|
rank: i + 1,
|
||||||
team_name: score.team.name
|
team_name: score.team.name
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return statistics;
|
return statistics;
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,21 @@
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {
|
import {
|
||||||
Col,
|
Col,
|
||||||
Container,
|
Container,
|
||||||
Row
|
Row
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
|
|
||||||
import { TurniereNavigation } from '../js/components/Navigation';
|
import {TurniereNavigation} from '../js/components/Navigation';
|
||||||
import { TournamentInformationView } from '../js/components/TournamentInformationView';
|
import {TournamentInformationView} from '../js/components/TournamentInformationView';
|
||||||
import { BigImage } from '../js/components/BigImage';
|
import {BigImage} from '../js/components/BigImage';
|
||||||
import { StandingsTable } from '../js/components/StandingsTable';
|
import {StandingsTable} from '../js/components/StandingsTable';
|
||||||
import { DominanceShower } from '../js/components/DominanceShower';
|
import {DominanceShower} from '../js/components/DominanceShower';
|
||||||
import { Footer } from '../js/components/Footer';
|
import {Footer} from '../js/components/Footer';
|
||||||
import { requestTournamentStatistics } from '../js/api';
|
import {requestTournamentStatistics} from '../js/api';
|
||||||
|
|
||||||
class StatisticsTournamentPage extends React.Component {
|
class StatisticsTournamentPage extends React.Component {
|
||||||
|
|
||||||
static async getInitialProps({query}) {
|
static async getInitialProps({query}) {
|
||||||
return {query};
|
return {query};
|
||||||
}
|
}
|
||||||
|
|
@ -26,7 +25,7 @@ class StatisticsTournamentPage extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { tournamentStatistics } = this.props;
|
const {tournamentStatistics} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -51,10 +50,12 @@ function StatisticsView(props) {
|
||||||
<Container className="py-5">
|
<Container className="py-5">
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs="6">
|
<Col xs="6">
|
||||||
<DominanceShower stats={props.tournamentStatistics.most_dominant_team} title="Stärkstes Team"/>
|
<DominanceShower stats={props.tournamentStatistics.most_dominant_team}
|
||||||
|
title="Stärkstes Team"/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs="6">
|
<Col xs="6">
|
||||||
<DominanceShower stats={props.tournamentStatistics.least_dominant_team} title="Schwächstes Team"/>
|
<DominanceShower stats={props.tournamentStatistics.least_dominant_team}
|
||||||
|
title="Schwächstes Team"/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {Col, Container, ListGroup, ListGroupItem, Row} from 'reactstrap';
|
import {Col, Container, Row} from 'reactstrap';
|
||||||
|
|
||||||
import {ErrorPageComponent} from '../js/components/ErrorComponents';
|
import {ErrorPageComponent} from '../js/components/ErrorComponents';
|
||||||
import {Footer} from '../js/components/Footer';
|
import {Footer} from '../js/components/Footer';
|
||||||
|
|
@ -19,14 +19,14 @@ import {Match} from '../js/components/Match';
|
||||||
|
|
||||||
class PrivateTournamentPage extends React.Component {
|
class PrivateTournamentPage extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const {owner_username, playoffStages} = this.props.tournament;
|
const {ownerUsername, playoffStages} = this.props.tournament;
|
||||||
const {isSignedIn, username} = this.props;
|
const {isSignedIn, username} = this.props;
|
||||||
|
|
||||||
// TODO: Change href-prop of the anchor tag to contain the tournament code
|
// TODO: Change href-prop of the anchor tag to contain the tournament code
|
||||||
return (<div className='pb-5'>
|
return (<div className='pb-5'>
|
||||||
<TournamentInformationView tournament={this.props.tournament} currentpage='tournament'/>
|
<TournamentInformationView tournament={this.props.tournament} currentpage='tournament'/>
|
||||||
<div className='stages pt-5'>
|
<div className='stages pt-5'>
|
||||||
{playoffStages.map(stage => <Stage isSignedIn={isSignedIn} isOwner={username === owner_username}
|
{playoffStages.map(stage => <Stage isSignedIn={isSignedIn} isOwner={username === ownerUsername}
|
||||||
level={getLevelName(stage.level)} matches={stage.matches}
|
level={getLevelName(stage.level)} matches={stage.matches}
|
||||||
key={stage.level}/>)}
|
key={stage.level}/>)}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -85,7 +85,7 @@ function convertTournament(apiTournament) {
|
||||||
description: apiTournament.description,
|
description: apiTournament.description,
|
||||||
name: apiTournament.name,
|
name: apiTournament.name,
|
||||||
isPublic: apiTournament.public,
|
isPublic: apiTournament.public,
|
||||||
owner_username: apiTournament.owner_username,
|
ownerUsername: apiTournament.owner_username,
|
||||||
groupStage: groupStage,
|
groupStage: groupStage,
|
||||||
playoffStages: playoffStages
|
playoffStages: playoffStages
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ app.prepare()
|
||||||
|
|
||||||
server.get('/t/:code/statistics', (req, res) => {
|
server.get('/t/:code/statistics', (req, res) => {
|
||||||
const actualPage = '/tournament-statistics';
|
const actualPage = '/tournament-statistics';
|
||||||
const queryParam = { code: req.params.code };
|
const queryParam = {code: req.params.code};
|
||||||
app.render(req, res, actualPage, queryParam);
|
app.render(req, res, actualPage, queryParam);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3291,7 +3291,7 @@ eslint-visitor-keys@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
|
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
|
||||||
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
|
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
|
||||||
|
|
||||||
eslint@^5.9.0:
|
eslint@^5.16.0:
|
||||||
version "5.16.0"
|
version "5.16.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
|
||||||
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==
|
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue