2015-05-20 16:19:40 +02:00
|
|
|
import React from 'react';
|
2015-05-21 15:16:56 +02:00
|
|
|
import Router from 'react-router';
|
2015-05-21 15:14:05 +02:00
|
|
|
|
2015-05-20 16:19:40 +02:00
|
|
|
import AltContainer from 'alt/AltContainer';
|
|
|
|
import UserActions from '../actions/user_actions';
|
|
|
|
import UserStore from '../stores/user_store';
|
|
|
|
|
2015-05-21 15:16:56 +02:00
|
|
|
let Link = Router.Link;
|
2015-05-20 16:19:40 +02:00
|
|
|
|
|
|
|
let Header = React.createClass({
|
|
|
|
|
|
|
|
getInitialState() {
|
|
|
|
return UserStore.getState();
|
|
|
|
},
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
UserStore.listen(this.onChange)
|
|
|
|
UserActions.fetchCurrentUser();
|
|
|
|
},
|
|
|
|
|
|
|
|
onChange(state) {
|
|
|
|
this.setState(state);
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2015-05-29 16:28:05 +02:00
|
|
|
<nav className="navbar navbar-default">
|
2015-05-21 15:20:02 +02:00
|
|
|
<div className="container">
|
|
|
|
<div className="navbar-header">
|
|
|
|
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
|
|
|
<span className="sr-only">Toggle navigation</span>
|
|
|
|
<span className="icon-bar"></span>
|
|
|
|
<span className="icon-bar"></span>
|
|
|
|
<span className="icon-bar"></span>
|
|
|
|
</button>
|
|
|
|
<a className="navbar-brand" href="#">
|
|
|
|
<span>ascribe </span>
|
2015-05-29 16:28:05 +02:00
|
|
|
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
|
2015-05-21 15:20:02 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="navbar" className="navbar-collapse collapse">
|
|
|
|
<ul className="nav navbar-nav navbar-left">
|
|
|
|
</ul>
|
|
|
|
<ul className="nav navbar-nav navbar-right">
|
|
|
|
<li className="dropdown">
|
|
|
|
<a href="#" className="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{this.state.currentUser.username} <span className="caret"></span></a>
|
|
|
|
<ul className="dropdown-menu" role="menu">
|
|
|
|
<li><a href="/art/faq/">Account Settings</a></li>
|
|
|
|
<li className="divider"></li>
|
|
|
|
<li><a href="/art/faq/">FAQ</a></li>
|
|
|
|
<li><a href="/art/terms/">Terms of Service</a></li>
|
|
|
|
<li className="divider"></li>
|
|
|
|
<li><a href="/api/users/logout/">Log out</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2015-05-20 17:35:52 +02:00
|
|
|
</div>
|
|
|
|
</nav>
|
2015-05-21 15:20:02 +02:00
|
|
|
);
|
2015-05-20 16:19:40 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Header;
|