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);
|
||||
case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS:
|
||||
action.parameters.successCallback();
|
||||
return Object.assign({}, state, tournamentStatistics);
|
||||
return Object.assign({}, state, action.parameters.tournamentStatistics);
|
||||
default: return state;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const reducerTournamentlist = (state = defaultStateTournamentlist, action) => {
|
||||
switch (action.type) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import {
|
|||
} from 'reactstrap';
|
||||
|
||||
export class DominanceShower extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Card className="shadow-sm">
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@ import {
|
|||
Table
|
||||
} from 'reactstrap';
|
||||
|
||||
import { rangedmap } from '../utils/rangedmap';
|
||||
import {rangedmap} from '../utils/rangedmap';
|
||||
|
||||
export class StandingsTable extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
|
|
@ -21,7 +20,7 @@ export class StandingsTable extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let performances = this.props.data.group_phase_performances;
|
||||
const performances = this.props.data.group_phase_performances;
|
||||
|
||||
return (
|
||||
<Card className="shadow-sm">
|
||||
|
|
@ -38,18 +37,21 @@ export class StandingsTable extends React.Component {
|
|||
</thead>
|
||||
<tbody>
|
||||
{ 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) }
|
||||
</tbody>
|
||||
<Collapse isOpen={ this.state.showFullTable } tag="tbody">
|
||||
{ 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) }
|
||||
</Collapse>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colSpan='4'>
|
||||
<TableButton isFullTableShown={this.state.showFullTable} onToggle={this.toggleShowFullTable}/>
|
||||
<TableButton isFullTableShown={this.state.showFullTable}
|
||||
onToggle={this.toggleShowFullTable}/>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
@ -60,7 +62,7 @@ export class StandingsTable extends React.Component {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
||||
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>;
|
||||
} else {
|
||||
return <Button className="w-100" onClick={this.props.onToggle}>Zeige alle Teams</Button>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import React from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
Button,
|
||||
ButtonGroup,
|
||||
|
|
@ -12,15 +12,14 @@ import {
|
|||
|
||||
|
||||
class PrivateTournamentInformationView extends React.Component {
|
||||
|
||||
render() {
|
||||
const { tournament, isSignedIn, username, currentpage } = this.props;
|
||||
const {tournament, isSignedIn, username, currentpage} = this.props;
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col xs="6">
|
||||
<ButtonsBadge
|
||||
<ButtonsBadge
|
||||
id={tournament.id}
|
||||
ownerName={tournament.owner_username}
|
||||
isSignedIn={isSignedIn}
|
||||
|
|
@ -45,8 +44,8 @@ class PrivateTournamentInformationView extends React.Component {
|
|||
}
|
||||
|
||||
function mapStateToPrivateTournamentInformationViewProps(state) {
|
||||
const { isSignedIn, username } = state.userinfo;
|
||||
return { isSignedIn, username };
|
||||
const {isSignedIn, username} = state.userinfo;
|
||||
return {isSignedIn, username};
|
||||
}
|
||||
|
||||
export const TournamentInformationView = connect(
|
||||
|
|
@ -54,9 +53,9 @@ export const TournamentInformationView = connect(
|
|||
)(PrivateTournamentInformationView);
|
||||
|
||||
function ButtonsBadge(props) {
|
||||
const { id, ownerName, isSignedIn, username, currentpage } = props;
|
||||
|
||||
switch(currentpage) {
|
||||
const {id, ownerName, isSignedIn, username, currentpage} = props;
|
||||
|
||||
switch (currentpage) {
|
||||
case 'statistics':
|
||||
return (
|
||||
<ButtonGroup className={props.className}>
|
||||
|
|
@ -83,14 +82,14 @@ function ButtonsBadge(props) {
|
|||
}
|
||||
|
||||
function TournamentButton(props) {
|
||||
const { id } = props;
|
||||
const {id} = props;
|
||||
return <Button href={'/t/' + id} color='success'>Zum Turnier</Button>;
|
||||
}
|
||||
|
||||
function EditButton(props) {
|
||||
const { id, ownerName, isSignedIn, username } = props;
|
||||
const {id, ownerName, isSignedIn, username} = props;
|
||||
|
||||
if(isSignedIn && ownerName === username) {
|
||||
if (isSignedIn && ownerName === username) {
|
||||
return (
|
||||
<Button href={'/t/' + id + '/edit'} color='success'>Turnier bearbeiten</Button>
|
||||
);
|
||||
|
|
@ -100,7 +99,7 @@ function EditButton(props) {
|
|||
}
|
||||
|
||||
function StatisticsButton(props) {
|
||||
const { id } = props;
|
||||
const {id} = props;
|
||||
return <Button href={'/t/' + id + '/statistics'} color='success'>Statistiken zum Turnier</Button>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const defaultStateTournamentStatistics = {
|
|||
|
||||
statistics_available: false,
|
||||
|
||||
most_dominant_team: {},
|
||||
most_dominant_team: {},
|
||||
least_dominant_team: {},
|
||||
group_phase_performances: []
|
||||
};
|
||||
|
|
@ -36,7 +36,7 @@ export function transformTournamentInfoToStatistics(data) {
|
|||
}
|
||||
|
||||
export function transformTournamentStatsToStatistics(data) {
|
||||
if(statisticsUnavailable(data)) {
|
||||
if (statisticsUnavailable(data)) {
|
||||
return {
|
||||
statistics_available: false,
|
||||
most_dominant_team: {},
|
||||
|
|
@ -61,14 +61,14 @@ export function transformTournamentStatsToStatistics(data) {
|
|||
};
|
||||
|
||||
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] = {
|
||||
win_loss_differential: score.group_points,
|
||||
point_differential: score.scored_points - score.received_points,
|
||||
rank: i + 1,
|
||||
team_name: score.team.name
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return statistics;
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ class TurniereApp extends App {
|
|||
render() {
|
||||
const {Component, pageProps, reduxStore} = this.props;
|
||||
return (<Container>
|
||||
<Notifications />
|
||||
<Favicon url="/static/icons/favicon.ico"/>
|
||||
<Provider store={reduxStore}>
|
||||
<Component {...pageProps} />
|
||||
</Provider>
|
||||
</Container>);
|
||||
<Notifications />
|
||||
<Favicon url="/static/icons/favicon.ico"/>
|
||||
<Provider store={reduxStore}>
|
||||
<Component {...pageProps} />
|
||||
</Provider>
|
||||
</Container>);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,21 @@
|
|||
import Head from 'next/head';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import Head from 'next/head';
|
||||
import React from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import {
|
||||
Col,
|
||||
Container,
|
||||
Row
|
||||
} from 'reactstrap';
|
||||
|
||||
import { TurniereNavigation } from '../js/components/Navigation';
|
||||
import { TournamentInformationView } from '../js/components/TournamentInformationView';
|
||||
import { BigImage } from '../js/components/BigImage';
|
||||
import { StandingsTable } from '../js/components/StandingsTable';
|
||||
import { DominanceShower } from '../js/components/DominanceShower';
|
||||
import { Footer } from '../js/components/Footer';
|
||||
import { requestTournamentStatistics } from '../js/api';
|
||||
import {TurniereNavigation} from '../js/components/Navigation';
|
||||
import {TournamentInformationView} from '../js/components/TournamentInformationView';
|
||||
import {BigImage} from '../js/components/BigImage';
|
||||
import {StandingsTable} from '../js/components/StandingsTable';
|
||||
import {DominanceShower} from '../js/components/DominanceShower';
|
||||
import {Footer} from '../js/components/Footer';
|
||||
import {requestTournamentStatistics} from '../js/api';
|
||||
|
||||
class StatisticsTournamentPage extends React.Component {
|
||||
|
||||
static async getInitialProps({query}) {
|
||||
return {query};
|
||||
}
|
||||
|
|
@ -26,7 +25,7 @@ class StatisticsTournamentPage extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { tournamentStatistics } = this.props;
|
||||
const {tournamentStatistics} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
@ -51,10 +50,12 @@ function StatisticsView(props) {
|
|||
<Container className="py-5">
|
||||
<Row>
|
||||
<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 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>
|
||||
</Row>
|
||||
</Container>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import Head from 'next/head';
|
||||
import React from 'react';
|
||||
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 {Footer} from '../js/components/Footer';
|
||||
|
|
@ -19,14 +19,14 @@ import {Match} from '../js/components/Match';
|
|||
|
||||
class PrivateTournamentPage extends React.Component {
|
||||
render() {
|
||||
const {owner_username, playoffStages} = this.props.tournament;
|
||||
const {ownerUsername, playoffStages} = this.props.tournament;
|
||||
const {isSignedIn, username} = this.props;
|
||||
|
||||
|
||||
// TODO: Change href-prop of the anchor tag to contain the tournament code
|
||||
return (<div className='pb-5'>
|
||||
<TournamentInformationView tournament={this.props.tournament} currentpage='tournament'/>
|
||||
<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}
|
||||
key={stage.level}/>)}
|
||||
</div>
|
||||
|
|
@ -85,7 +85,7 @@ function convertTournament(apiTournament) {
|
|||
description: apiTournament.description,
|
||||
name: apiTournament.name,
|
||||
isPublic: apiTournament.public,
|
||||
owner_username: apiTournament.owner_username,
|
||||
ownerUsername: apiTournament.owner_username,
|
||||
groupStage: groupStage,
|
||||
playoffStages: playoffStages
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ app.prepare()
|
|||
|
||||
server.get('/t/:code/statistics', (req, res) => {
|
||||
const actualPage = '/tournament-statistics';
|
||||
const queryParam = { code: req.params.code };
|
||||
const queryParam = {code: req.params.code};
|
||||
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"
|
||||
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
|
||||
|
||||
eslint@^5.9.0:
|
||||
eslint@^5.16.0:
|
||||
version "5.16.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
|
||||
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==
|
||||
|
|
|
|||
Loading…
Reference in New Issue