diff --git a/client/src/components/AppHeader/AppHeader.js b/client/src/components/AppHeader/AppHeader.js index 2ca198c..5e89fd4 100644 --- a/client/src/components/AppHeader/AppHeader.js +++ b/client/src/components/AppHeader/AppHeader.js @@ -38,7 +38,8 @@ class AppHeader extends Component { super(props); this.state = { logoutSuccess: false, - redirectToStart: false + redirectToStart: false, + redirectToAdmin: false } } @@ -53,11 +54,15 @@ class AppHeader extends Component { console.log('error logging out: ' + error); }); break; - case 'start': - this.setState({ - redirectToStart: true - }); - break; + case 'start': + this.setState({ + redirectToStart: true + }); + break; + case 'admin': + this.setState({ + redirectToAdmin: true + }); default: break; } @@ -73,6 +78,12 @@ class AppHeader extends Component { const redirectAfterLogout = this.state.logoutSuccess ? :
const redirectToStart = this.state.redirectToStart ? :
+ const redirectToAdmin = this.state.redirectToAdmin ? :
+ + let adminSubmenu; + if (this.props.user && this.props.user.role === 'admin') { + adminSubmenu = admin + } if (this.props.user) { userInfo = ( @@ -86,6 +97,7 @@ class AppHeader extends Component { }> start + {adminSubmenu} logout @@ -96,6 +108,7 @@ class AppHeader extends Component {
{redirectAfterLogout} {redirectToStart} + {redirectToAdmin}
Die Gesellschaft der Gegenwart diff --git a/client/src/components/PublicStateList/PublicStateList.js b/client/src/components/PublicStateList/PublicStateList.js index aeb5515..c33e4ff 100644 --- a/client/src/components/PublicStateList/PublicStateList.js +++ b/client/src/components/PublicStateList/PublicStateList.js @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { loadPublicStates } from '../../actions/gameActions'; import { connect } from 'react-redux'; +import { Link } from 'react-router-dom'; class PublicStateList extends Component { @@ -11,11 +12,13 @@ class PublicStateList extends Component { render() { - console.log('public states: ' + this.props.publicStates); - const pubStateList = this.props.publicStates.map((ps) => { return ( -
{ps.name}
+
+ + {ps.name} + +
) });