diff --git a/js/components/StandingsTable.js b/js/components/StandingsTable.js
new file mode 100644
index 0000000..ecdb6ce
--- /dev/null
+++ b/js/components/StandingsTable.js
@@ -0,0 +1,104 @@
+import React from 'react';
+import {
+ Button,
+ Card,
+ CardBody,
+ Collapse,
+ Table
+} from 'reactstrap';
+
+import { rangedmap } from '../utils/rangedmap';
+import { findTeam } from '../utils/findTeam';
+import { Order, sort } from '../utils/sort';
+
+export class StandingsTable extends React.Component {
+
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ showFullTable: false
+ };
+ this.toggleShowFullTable = this.toggleShowFullTable.bind(this);
+ }
+
+ render() {
+ let performances = this.props.data.groupPhasePerformances;
+
+ /**
+ * comparison(p1, p2) < 0 => p1 < p2
+ * comparison(p1, p2) = 0 => p1 = p2
+ * comparison(p1, p2) > 0 => p1 > p2
+ */
+ let sortedPerformances = sort(performances, (p1, p2) => p1.rank - p2.rank, Order.descending);
+
+ return (
+
+
+ Aktuelle Rangliste
+
+
+
+ | # |
+ Team Name |
+ Match Differenz |
+ Punkt Differenz |
+
+
+
+ { rangedmap(sortedPerformances, (team, index) => (
+
+ ), 0, 3) }
+
+
+ { rangedmap(sortedPerformances, (team, index) => (
+
+ ), 3) }
+
+
+
+ |
+
+ |
+
+
+
+
+
+ );
+ }
+
+ toggleShowFullTable() {
+ this.setState({ showFullTable: !this.state.showFullTable });
+ }
+}
+
+class TeamRow extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ render() {
+ return (
+
+ | { this.props.teamToShow.rank } |
+ {findTeam(this.props.teams, this.props.teamToShow.team).name} |
+ { this.props.teamToShow.winlossdifferential } |
+ { this.props.teamToShow.pointDifferential } |
+
+ );
+ }
+}
+
+class TableButton extends React.Component {
+
+ render() {
+ const { isFullTableShown } = this.props;
+
+ if(isFullTableShown) {
+ return ;
+ } else {
+ return ;
+ }
+ }
+}
diff --git a/js/components/TournamentInformationView.js b/js/components/TournamentInformationView.js
index 99c465c..c34b4b4 100644
--- a/js/components/TournamentInformationView.js
+++ b/js/components/TournamentInformationView.js
@@ -57,28 +57,28 @@ function ButtonsBadge(props) {
const { id, ownerName, isSignedIn, username, currentpage } = props;
switch(currentpage) {
- case 'statistics':
- return (
-
-
-
-
- );
- case 'tournament':
- return (
-
-
-
-
- );
- case 'edit':
- return (
-
-
-
-
- );
- default: return null;
+ case 'statistics':
+ return (
+
+
+
+
+ );
+ case 'tournament':
+ return (
+
+
+
+
+ );
+ case 'edit':
+ return (
+
+
+
+
+ );
+ default: return null;
}
}
diff --git a/pages/tournament-statistics.js b/pages/tournament-statistics.js
index 0a33e5b..e65710c 100644
--- a/pages/tournament-statistics.js
+++ b/pages/tournament-statistics.js
@@ -2,15 +2,11 @@ import Head from 'next/head';
import React from 'react';
import { connect } from 'react-redux';
import {
- Button,
Card,
CardBody,
CardTitle,
Col,
- Collapse,
Container,
- ListGroup,
- ListGroupItem,
Row,
Table
} from 'reactstrap';
@@ -18,10 +14,9 @@ import {
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 { Footer } from '../js/components/Footer';
import { findTeam } from '../js/utils/findTeam';
-import { rangedmap } from '../js/utils/rangedmap';
-import { Order, sort } from '../js/utils/sort';
class DominanceShower extends React.Component {
@@ -51,98 +46,6 @@ class DominanceShower extends React.Component {
}
}
-class StandingsTable extends React.Component {
-
- constructor(props) {
- super(props);
-
- this.state = {
- showFullTable: false
- };
- this.toggleShowFullTable = this.toggleShowFullTable.bind(this);
- }
-
- render() {
- let performances = this.props.data.groupPhasePerformances;
-
- /**
- * comparison(p1, p2) < 0 => p1 < p2
- * comparison(p1, p2) = 0 => p1 = p2
- * comparison(p1, p2) > 0 => p1 > p2
- */
- let sortedPerformances = sort(performances, (p1, p2) => p1.rank - p2.rank, Order.descending);
-
- return (
-
-
- Aktuelle Rangliste
-
-
-
- | # |
- Team Name |
- Match Differenz |
- Punkt Differenz |
-
-
-
- { rangedmap(sortedPerformances, (team, index) => (
-
- ), 0, 3) }
-
-
- { rangedmap(sortedPerformances, (team, index) => (
-
- ), 3) }
-
-
-
- |
-
- |
-
-
-
-
-
- );
- }
-
- toggleShowFullTable() {
- this.setState({ showFullTable: !this.state.showFullTable });
- }
-}
-
-class TeamRow extends React.Component {
- constructor(props) {
- super(props);
- }
-
- render() {
- return (
-
- | { this.props.teamToShow.rank } |
- {findTeam(this.props.teams, this.props.teamToShow.team).name} |
- { this.props.teamToShow.winlossdifferential } |
- { this.props.teamToShow.pointDifferential } |
-
- );
- }
-}
-
-class TableButton extends React.Component {
-
- render() {
- const { isFullTableShown } = this.props;
-
- if(isFullTableShown) {
- return ;
- } else {
- return ;
- }
- }
-}
-
class StatisticsTournamentPage extends React.Component {
static async getInitialProps({query}) {
diff --git a/pages/tournament.js b/pages/tournament.js
index 6066739..13d6b6d 100644
--- a/pages/tournament.js
+++ b/pages/tournament.js
@@ -19,9 +19,9 @@ import {Match} from '../js/components/Match';
class PrivateTournamentPage extends React.Component {
render() {
- const {id, description, isPublic, code, ownerUsername, 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 (