Make code for MatchTable in tournament view more readable (fFix react error message)

This commit is contained in:
Felix Hamme 2018-12-11 16:01:25 +01:00
parent b30971385f
commit 115df26572
1 changed files with 30 additions and 17 deletions

View File

@ -145,7 +145,7 @@ function MatchModal(props) {
switch (props.match.state) {
case 'in_progress':
title = 'Spiel läuft';
actionButton = <Button color='primary' onClick={props.toggle}>Spiel beenden</Button>
actionButton = <Button color='primary' onClick={props.toggle}>Spiel beenden</Button>;
break;
case 'team1_won':
title = 'Spiel beendet';
@ -206,22 +206,35 @@ function MatchTable(props) {
case 'undecided':
break;
}
if(props.match.state === 'single_team'){
return (
<Table className='mb-0'>
<tbody>
<tr>
{props.match.state !== 'single_team' ?
<th className='stage border-top-0'>{props.match.scoreTeam1}</th> : ''}
<td className={'border-top-0 ' + team1Class}>{props.match.team1}</td>
</tr>
<tr>
{props.match.state !== 'single_team' ?
<th className='stage'>{props.match.scoreTeam2}</th> : ''}
<td className={team2Class}>{props.match.state === 'single_team' ? 'kein Gegner' : props.match.team2}</td>
<td className={team2Class}>kein Gegner</td>
</tr>
</tbody>
</Table>
)
}else{
return (
<Table className='mb-0'>
<tbody>
<tr>
<th className='stage border-top-0'>{props.match.scoreTeam1}</th>
<td className={'border-top-0 ' + team1Class}>{props.match.team1}</td>
</tr>
<tr>
<th className='stage'>{props.match.scoreTeam2}</th>
<td className={team2Class}>{props.match.team2}</td>
</tr>
</tbody>
</Table>
)
}
}
function EditableMatchTable(props) {