'use strict'; import React from 'react'; import { Link } from 'react-router'; import Nav from 'react-bootstrap/lib/Nav'; import Navbar from 'react-bootstrap/lib/Navbar'; import DropdownButton from 'react-bootstrap/lib/DropdownButton'; import MenuItem from 'react-bootstrap/lib/MenuItem'; import NavItem from 'react-bootstrap/lib/NavItem'; import LinkContainer from 'react-router-bootstrap/lib/LinkContainer'; import PieceListStore from '../stores/piece_list_store'; import AclProxy from './acl_proxy'; import withContext from './context/with_context'; import HeaderNotifications from './header_notifications'; import HeaderNotificationDebug from './header_notification_debug'; import NavRoutesLinks from './nav_routes_links'; import { currentUserShape, whitelabelShape } from './prop_types'; import { constructHead } from '../utils/dom'; import { getLangText } from '../utils/lang'; let Header = React.createClass({ propTypes: { routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, // Injected through HOCs currentUser: currentUserShape.isRequired, // eslint-disable-line react/sort-prop-types isLoggedIn: React.PropTypes.bool.isRequired, // eslint-disable-line react/sort-prop-types whitelabel: whitelabelShape.isRequired // eslint-disable-line react/sort-prop-types }, getInitialState() { return PieceListStore.getState(); }, componentDidMount() { // Listen to the piece list store, but don't fetch immediately to avoid // conflicts with routes that may need to wait to load the piece list PieceListStore.listen(this.onChange); }, componentWillUnmount() { PieceListStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, getLogo() { const { whitelabel } = this.props; if (whitelabel.head) { constructHead(whitelabel.head); } if (whitelabel.subdomain && whitelabel.subdomain !== 'www' && whitelabel.logo){ return ( ); } else { return ( ); } }, getPoweredBy() { return (