1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 09:50:31 +01:00
onion/js/components/header.js

58 lines
1.9 KiB
JavaScript
Raw Normal View History

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';
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';
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 (
<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}>
<MenuItem eventKey="1" href="/art/account_settings/">{getLangText('Account Settings')}</MenuItem>
<li className="divider"></li>
<MenuItem eventKey="2" href="/art/faq/">{getLangText('FAQ')}</MenuItem>
<MenuItem eventKey="3" href="/art/terms/">{getLangText('Terms of Service')}</MenuItem>
<MenuItem divider />
<MenuItem eventKey="4" href="/api/users/logout/">{getLangText('Log out')}</MenuItem>
</DropdownButton>
</Nav>
</Navbar>
2015-05-21 15:20:02 +02:00
);
2015-05-20 16:19:40 +02:00
}
});
export default Header;