diff --git a/pages/list.js b/pages/list.js index 768b105..1cf8496 100644 --- a/pages/list.js +++ b/pages/list.js @@ -1,22 +1,16 @@ -import Head from 'next/head'; -import React from 'react'; -import { - Card, - CardBody, - Container -} from 'reactstrap'; +import Head from 'next/head'; +import React from 'react'; +import {Card, CardBody, Container} from 'reactstrap'; -import { TurniereNavigation } from '../js/components/Navigation'; -import { Footer } from '../js/components/Footer'; -import { - getRequest, - getState -} from '../js/api'; +import {TurniereNavigation} from '../js/components/Navigation'; +import {Footer} from '../js/components/Footer'; import '../static/everypage.css'; +import TournamentList from '../js/components/TournamentList'; +import {connect} from 'react-redux'; + +export default class PublicTournamentsPage extends React.Component { -export default class ListPage extends React.Component { - render() { return (
@@ -25,7 +19,7 @@ export default class ListPage extends React.Component {
- +
@@ -33,55 +27,38 @@ export default class ListPage extends React.Component { } } -class TournamentList extends React.Component { - constructor(props) { - super(props); - this.state = { - error: null, - isLoaded: false, - items: [] - }; - } +function mapStateToProperties(state) { + const {isSignedIn} = state.userinfo; + return {isSignedIn}; +} - componentDidMount() { - getRequest(getState(), '/tournaments?type=public') - .then( - response => { - this.setState({ - isLoaded: true, - items: response.data - }); - }, - error => { - this.setState({ - isLoaded: true, - error - }); - } - ); - } +const PublicTournamentPageContent = connect( + mapStateToProperties, +)(PublicTournaments); - render() { - return ( - - - -

Öffentliche Turniere

- {this.state.items.map(item => ( - //The code should be item.code but the api just supports it this way by now - - ))} -
-
+function PublicTournaments(props) { + if (props.isSignedIn) { + return (
+ + - ); + + zu den privaten Turnieren + +
); + + } else { + return ( + + ); } } -function TournamentListEntry(props) { - return ( - - {props.name} - - ); +function PublicTournamentsCard() { + return ( + +

Öffentliche Turniere

+ +
+
); }