diff --git a/js/components/TournamentBigImage.js b/js/components/TournamentBigImage.js
new file mode 100644
index 0000000..ed304f0
--- /dev/null
+++ b/js/components/TournamentBigImage.js
@@ -0,0 +1,22 @@
+import {Container, ListGroup, ListGroupItem} from 'reactstrap';
+import React from 'react';
+
+export function TournamentBigImage(props) {
+ return (
+
{props.name}
+
+
+
+ );
+}
+
+function TournamentProperties(props) {
+ return (
+ {props.description && {props.description}}
+
+ {props.isPublic ? 'Das Turnier ist öffentlich.' : 'Das Turnier ist privat.'}
+
+ Turnier-Code: {props.code}
+ von {props.ownerUsername}
+ );
+}
diff --git a/js/components/TournamentInformationView.js b/js/components/TournamentInformationView.js
deleted file mode 100644
index b31c695..0000000
--- a/js/components/TournamentInformationView.js
+++ /dev/null
@@ -1,105 +0,0 @@
-import React from 'react';
-import {connect} from 'react-redux';
-import {
- Button,
- ButtonGroup,
- Col,
- Container,
- ListGroup,
- ListGroupItem,
- Row
-} from 'reactstrap';
-
-
-class PrivateTournamentInformationView extends React.Component {
- render() {
- const {tournament, isSignedIn, username, currentpage} = this.props;
-
- return (
-
-
-
-
- {tournament.description}
-
-
-
-
- {tournament.isPublic ? 'Das Turnier ist öffentlich.' : 'Das Turnier ist privat.'}
-
- Turnier-Code: {tournament.code}
- von {tournament.owner_username}
-
-
-
-
- );
- }
-}
-
-function mapStateToPrivateTournamentInformationViewProps(state) {
- const {isSignedIn, username} = state.userinfo;
- return {isSignedIn, username};
-}
-
-export const TournamentInformationView = connect(
- mapStateToPrivateTournamentInformationViewProps
-)(PrivateTournamentInformationView);
-
-function ButtonsBadge(props) {
- const {id, ownerName, isSignedIn, username, currentpage} = props;
-
- switch (currentpage) {
- case 'statistics':
- return (
-
-
-
-
- );
- case 'tournament':
- return (
-
-
-
-
- );
- case 'edit':
- return (
-
-
-
-
- );
- default: return null;
- }
-}
-
-function TournamentButton(props) {
- const {id} = props;
- return ;
-}
-
-function EditButton(props) {
- const {id, ownerName, isSignedIn, username} = props;
-
- if (isSignedIn && ownerName === username) {
- return (
-
- );
- } else {
- return null;
- }
-}
-
-function StatisticsButton(props) {
- const {id} = props;
- return ;
-}
-
diff --git a/js/components/TournamentStatusBar.js b/js/components/TournamentStatusBar.js
new file mode 100644
index 0000000..0fd018a
--- /dev/null
+++ b/js/components/TournamentStatusBar.js
@@ -0,0 +1,29 @@
+import Navbar from 'react-bootstrap/Navbar';
+import {Container} from 'reactstrap';
+import React from 'react';
+
+export function TournamentStatusBar(props) {
+ return (
+
+ {props.children}
+
+ );
+}
+
+export function TournamentStatusBarButton(props) {
+ return (
+ {props.children}
+ );
+}
+
+export function EditButton(props) {
+ const {tournamentId, isOwner, isSignedIn} = props;
+
+ if (isSignedIn && isOwner) {
+ return (
+ Turnier bearbeiten
+ );
+ } else {
+ return null;
+ }
+}
diff --git a/js/redux/tournamentStatistics.js b/js/redux/tournamentStatistics.js
index 4d426ec..4004982 100644
--- a/js/redux/tournamentStatistics.js
+++ b/js/redux/tournamentStatistics.js
@@ -30,7 +30,7 @@ export function transformTournamentInfoToStatistics(data) {
description: data.description,
id: data.id,
name: data.name,
- owner_username: data.owner_username,
+ ownerUsername: data.owner_username,
isPublic: data.public
};
}
diff --git a/pages/tournament-statistics.js b/pages/tournament-statistics.js
index 1fb27bb..0beb23b 100644
--- a/pages/tournament-statistics.js
+++ b/pages/tournament-statistics.js
@@ -1,19 +1,16 @@
import Head from 'next/head';
import React from 'react';
import {connect} from 'react-redux';
-import {
- Col,
- Container,
- Row
-} from 'reactstrap';
+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 {EditButton, TournamentStatusBar, TournamentStatusBarButton} from '../js/components/TournamentStatusBar';
+import Navbar from 'react-bootstrap/Navbar';
+import {TournamentBigImage} from '../js/components/TournamentBigImage';
class StatisticsTournamentPage extends React.Component {
static async getInitialProps({query}) {
@@ -33,9 +30,19 @@ class StatisticsTournamentPage extends React.Component {
{tournamentStatistics.name}: turnie.re
-
+
+
+
+ {tournamentStatistics.name}
+
+
+ zurück zum Turnier
+
+
+
-
@@ -72,7 +79,8 @@ function StatisticsView(props) {
function mapTournamentStatisticsToProps(state) {
const {tournamentStatistics} = state;
- return {tournamentStatistics};
+ const {isSignedIn, username} = state.userinfo;
+ return {tournamentStatistics, isSignedIn, username};
}
export default connect(
diff --git a/pages/tournament.js b/pages/tournament.js
index eac688a..341adfe 100644
--- a/pages/tournament.js
+++ b/pages/tournament.js
@@ -1,7 +1,6 @@
import Head from 'next/head';
import React from 'react';
import {connect} from 'react-redux';
-import {Container, ListGroup, ListGroupItem} from 'reactstrap';
import Navbar from 'react-bootstrap/Navbar';
@@ -16,6 +15,8 @@ import '../static/css/tournament.css';
import {getTournament} from '../js/redux/tournamentApi';
import {PlayoffStages} from '../js/components/PlayoffStages';
import GroupStage from '../js/components/GroupStage';
+import {TournamentBigImage} from '../js/components/TournamentBigImage';
+import {EditButton, TournamentStatusBar, TournamentStatusBarButton} from '../js/components/TournamentStatusBar';
class PrivateTournamentPage extends React.Component {
render() {
@@ -38,45 +39,22 @@ class PrivateTournamentPage extends React.Component {
}
function StatusBar(props) {
- return (
-
-
- {props.tournament.name}
-
-
-
-
- );
+ return (
+
+ {props.tournament.name}
+
+
+
+ );
}
function StatisticsButton(props) {
- return (
+ return (
Statistiken
- );
+ );
}
-function TournamentBigImage(props) {
- return (
-
{props.name}
-
-
-
- );
-}
-
-function TournamentProperties(props) {
- return (
- {props.description && {props.description}}
-
- {props.isPublic ? 'Das Turnier ist öffentlich.' : 'Das Turnier ist privat.'}
-
- Turnier-Code: {props.code}
- von {props.ownerUsername}
- );
-}
-
function mapStateToTournamentPageProperties(state) {
const {isSignedIn, username} = state.userinfo;
return {isSignedIn, username};
@@ -84,18 +62,6 @@ function mapStateToTournamentPageProperties(state) {
const TournamentPage = connect(mapStateToTournamentPageProperties)(PrivateTournamentPage);
-function EditButton(props) {
- const {tournamentId, isOwner, isSignedIn} = props;
-
- if (isSignedIn && isOwner) {
- return (
- Turnier bearbeiten
- );
- } else {
- return null;
- }
-}
-
class Main extends React.Component {
static async getInitialProps({query}) {
return {query};