@@ -149,29 +145,29 @@ function MatchModal(props) {
let actionButton = '';
//possible states: single_team not_ready not_started in_progress team1_won team2_won undecided
switch (props.match.state) {
- case 'in_progress':
- title = 'Spiel läuft';
- actionButton =
;
- break;
- case 'team1_won':
- title = 'Spiel beendet';
- break;
- case 'team2_won':
- title = 'Spiel beendet';
- break;
- case 'single_team':
- title = 'kein Gegner, Team kommt weiter';
- break;
- case 'not_ready':
- title = 'Spiel kann noch nicht gestartet werden';
- break;
- case 'not_started':
- title = 'Spiel kann gestartet werden';
- actionButton =
;
- break;
- case 'undecided':
- title = 'Spiel beendet';
- break;
+ case 'in_progress':
+ title = 'Spiel läuft';
+ actionButton =
;
+ break;
+ case 'team1_won':
+ title = 'Spiel beendet';
+ break;
+ case 'team2_won':
+ title = 'Spiel beendet';
+ break;
+ case 'single_team':
+ title = 'kein Gegner, Team kommt weiter';
+ break;
+ case 'not_ready':
+ title = 'Spiel kann noch nicht gestartet werden';
+ break;
+ case 'not_started':
+ title = 'Spiel kann gestartet werden';
+ actionButton =
;
+ break;
+ case 'undecided':
+ title = 'Spiel beendet';
+ break;
}
return (
@@ -192,54 +188,54 @@ function MatchTable(props) {
let team1Class, team2Class;
//possible states: single_team not_ready not_started in_progress team1_won team2_won undecided
switch (props.match.state) {
- case 'in_progress':
- break;
- case 'team1_won':
- team1Class = 'font-weight-bold';
- team2Class = 'lost-team';
- break;
- case 'team2_won':
- team1Class = 'lost-team';
- team2Class = 'font-weight-bold';
- break;
- case 'single_team':
- team2Class = 'text-muted';
- break;
- case 'not_ready':
- break;
- case 'not_started':
- break;
- case 'undecided':
- break;
+ case 'in_progress':
+ break;
+ case 'team1_won':
+ team1Class = 'font-weight-bold';
+ team2Class = 'lost-team';
+ break;
+ case 'team2_won':
+ team1Class = 'lost-team';
+ team2Class = 'font-weight-bold';
+ break;
+ case 'single_team':
+ team2Class = 'text-muted';
+ break;
+ case 'not_ready':
+ break;
+ case 'not_started':
+ break;
+ case 'undecided':
+ break;
}
if(props.match.state === 'single_team'){
return (
-
- | {props.match.team1} |
-
-
- | kein Gegner |
-
+
+ | {props.match.team1} |
+
+
+ | kein Gegner |
+
- )
- }else{
+ );
+ } else {
return (
-
- | {props.match.scoreTeam1} |
- {props.match.team1} |
-
-
- | {props.match.scoreTeam2} |
- {props.match.team2} |
-
+
+ | {props.match.scoreTeam1} |
+ {props.match.team1} |
+
+
+ | {props.match.scoreTeam2} |
+ {props.match.team2} |
+
- )
+ );
}
}
@@ -247,21 +243,21 @@ function EditableMatchTable(props) {
return (
-
- |
-
- |
- {props.match.team1} |
-
-
- |
-
- |
- {props.match.team2} |
-
+
+ |
+
+ |
+ {props.match.team1} |
+
+
+ |
+
+ |
+ {props.match.team2} |
+
- )
+ );
}
class ScoreInput extends React.Component {
@@ -307,7 +303,7 @@ function convertTournament(apiTournament) {
id: stage.id,
level: stage.level,
matches: stage.matches.map(match => convertMatch(match))
- })
+ });
}
}
return {
@@ -328,7 +324,7 @@ function convertGroup(apiGroup) {
number: apiGroup.number,
scores: apiGroup.group_scores,
matches: apiGroup.matches.map(match => convertMatch(match))
- }
+ };
}
function convertMatch(apiMatch) {
@@ -339,18 +335,18 @@ function convertMatch(apiMatch) {
team2: apiMatch.match_scores[1].team.name,
scoreTeam1: apiMatch.match_scores[0].points,
scoreTeam2: apiMatch.match_scores[1].points
- }
+ };
}
class Main extends React.Component {
constructor(props) {
super(props);
const code = this.props.query.code;
- getRequest('/tournaments/' + code, {})
+ getRequest(getState(), '/tournaments/' + code)
.then(response => {
this.setState({tournament: convertTournament(response.data)});
})
- .catch(error => console.log(error));
+ .catch(() => { /* TODO: Show some kind of error or smth */ });
}
static async getInitialProps({query}) {
@@ -373,4 +369,4 @@ class Main extends React.Component {
}
}
-export default Main
+export default Main;