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-06-01 18:20:15 +02:00
|
|
|
import Nav from 'react-bootstrap/lib/Nav';
|
|
|
|
import Navbar from 'react-bootstrap/lib/Navbar';
|
|
|
|
import NavItem from 'react-bootstrap/lib/NavItem';
|
|
|
|
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
|
|
|
|
import MenuItem from 'react-bootstrap/lib/MenuItem';
|
|
|
|
|
2015-06-02 14:25:26 +02:00
|
|
|
import { getLangText } from '../utils/lang_utils';
|
|
|
|
|
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-06-01 18:20:15 +02:00
|
|
|
<Navbar>
|
|
|
|
<Nav>
|
|
|
|
<a className="navbar-brand" href="#">
|
|
|
|
<span>ascribe </span>
|
|
|
|
<span className="glyph-ascribe-spool-chunked ascribe-color"></span>
|
|
|
|
</a>
|
|
|
|
</Nav>
|
|
|
|
<Nav right>
|
|
|
|
<DropdownButton eventKey={3} title={this.state.currentUser.username}>
|
2015-06-02 14:25:26 +02:00
|
|
|
<MenuItem eventKey="1" href="/art/account_settings/">{getLangText('Account Settings')}</MenuItem>
|
2015-06-01 18:20:15 +02:00
|
|
|
<li className="divider"></li>
|
2015-06-02 14:25:26 +02:00
|
|
|
<MenuItem eventKey="2" href="/art/faq/">{getLangText('FAQ')}</MenuItem>
|
|
|
|
<MenuItem eventKey="3" href="/art/terms/">{getLangText('Terms of Service')}</MenuItem>
|
2015-06-01 18:20:15 +02:00
|
|
|
<MenuItem divider />
|
2015-06-02 14:25:26 +02:00
|
|
|
<MenuItem eventKey="4" href="/api/users/logout/">{getLangText('Log out')}</MenuItem>
|
2015-06-01 18:20:15 +02:00
|
|
|
</DropdownButton>
|
|
|
|
</Nav>
|
|
|
|
</Navbar>
|
2015-05-21 15:20:02 +02:00
|
|
|
);
|
2015-05-20 16:19:40 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Header;
|