Add button to return to tournament from statistics

This commit is contained in:
Jonny 2019-05-02 08:37:44 +02:00 committed by JP1998
parent 435f24cef8
commit 3bc7768bec
1 changed files with 16 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class PrivateTournamentPage extends React.Component {
// TODO: Change href-prop of the anchor tag to contain the tournament code
return (<div className='pb-5'>
<Container>
<EditButton id={id} ownerName={ownerUsername} isSignedIn={isSignedIn} username={username}/>
<ButtonsBadge id={id} ownerName={ownerUsername} isSignedIn={isSignedIn} username={username}/>
<p>{description}</p>
<ListGroup>
<ListGroupItem>
@ -50,6 +50,16 @@ function mapStateToTournamentPageProperties(state) {
const TournamentPage = connect(mapStateToTournamentPageProperties)(PrivateTournamentPage);
function ButtonsBadge(props) {
const { id, ownerName, isSignedIn, username } = props;
return (
<div>
<EditButton id={id} ownerName={ownerName} isSignedIn={isSignedIn} username={username}/>
<StatisticsButton id={id}/>
</div>
);
}
function EditButton(props) {
const {id, ownerName, isSignedIn, username} = props;
@ -60,6 +70,11 @@ function EditButton(props) {
}
}
function StatisticsButton(props) {
const { id } = props;
return <a href={'/t/' + id + '/statistics'} className='btn btn-outline-secondary'>Statistiken zum Turnier</a>;
}
function getLevelName(levelNumber) {
const names = ['Finale', 'Halbfinale', 'Viertelfinale', 'Achtelfinale'];
if (levelNumber < names.length) {