diff --git a/js/api.js b/js/api.js index 0ad5034..7a81e2d 100644 --- a/js/api.js +++ b/js/api.js @@ -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) { diff --git a/js/components/DominanceShower.js b/js/components/DominanceShower.js index 01dc571..5861858 100644 --- a/js/components/DominanceShower.js +++ b/js/components/DominanceShower.js @@ -7,7 +7,6 @@ import { } from 'reactstrap'; export class DominanceShower extends React.Component { - render() { return ( diff --git a/js/components/StandingsTable.js b/js/components/StandingsTable.js index b2db7cb..c82d8ad 100644 --- a/js/components/StandingsTable.js +++ b/js/components/StandingsTable.js @@ -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 ( @@ -38,18 +37,21 @@ export class StandingsTable extends React.Component { { rangedmap(performances, (team, index) => ( - + ), 0, 3) } { rangedmap(performances, (team, index) => ( - + ), 3) } - + @@ -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 ; } else { return ; diff --git a/js/components/TournamentInformationView.js b/js/components/TournamentInformationView.js index c34b4b4..b31c695 100644 --- a/js/components/TournamentInformationView.js +++ b/js/components/TournamentInformationView.js @@ -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 ( - @@ -83,14 +82,14 @@ function ButtonsBadge(props) { } function TournamentButton(props) { - const { id } = props; + const {id} = props; return ; } function EditButton(props) { - const { id, ownerName, isSignedIn, username } = props; + const {id, ownerName, isSignedIn, username} = props; - if(isSignedIn && ownerName === username) { + if (isSignedIn && ownerName === username) { return ( ); @@ -100,7 +99,7 @@ function EditButton(props) { } function StatisticsButton(props) { - const { id } = props; + const {id} = props; return ; } diff --git a/js/redux/tournamentStatistics.js b/js/redux/tournamentStatistics.js index 600c272..4d426ec 100644 --- a/js/redux/tournamentStatistics.js +++ b/js/redux/tournamentStatistics.js @@ -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; diff --git a/pages/_app.js b/pages/_app.js index a2e98b1..6bc4dcb 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -15,12 +15,12 @@ class TurniereApp extends App { render() { const {Component, pageProps, reduxStore} = this.props; return ( - - - - - - ); + + + + + + ); } } diff --git a/pages/tournament-statistics.js b/pages/tournament-statistics.js index a38aefc..1fb27bb 100644 --- a/pages/tournament-statistics.js +++ b/pages/tournament-statistics.js @@ -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 (
@@ -51,10 +50,12 @@ function StatisticsView(props) { - + - + diff --git a/pages/tournament.js b/pages/tournament.js index b5972b2..1b14ce7 100644 --- a/pages/tournament.js +++ b/pages/tournament.js @@ -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 (
- {playoffStages.map(stage => )}
@@ -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 }; diff --git a/server.js b/server.js index 9b30a15..8772603 100644 --- a/server.js +++ b/server.js @@ -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); }); diff --git a/yarn.lock b/yarn.lock index 65790b4..6eb06b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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==