import React from 'react' import PropTypes from 'prop-types' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import { connect } from 'react-redux' import { withRouter } from 'react-router-dom' import { me } from '../initial_state' import { openSidebar } from '../actions/sidebar' import { CX } from '../constants' import Button from './button' import Avatar from './avatar' class FooterBar extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object, } render() { const { account, notificationCount, homeItemsQueueCount, onOpenSidebar, } = this.props const noRouter = !this.context.router const currentPathname = noRouter ? '' : this.context.router.route.location.pathname const buttons = [ { to: !me ? '/' : '/home', icon: 'home', title: 'Home', active: !me ? currentPathname === '/' : currentPathname === '/home', }, { to: '/notifications', icon: 'notifications', title: 'Notifications', isHidden: !me, active: currentPathname.indexOf('/notifications') > -1, }, { to: '/groups', icon: 'group', title: 'Groups', active: currentPathname.indexOf('/groups') > -1, }, { to: '/explore', icon: 'explore', title: 'Explore', isHidden: !me, active: currentPathname.indexOf('/explore') > -1, }, { to: '/news', icon: 'news', title: 'News', isHidden: !!me, active: currentPathname.indexOf('/news') > -1, }, { title: 'Menu', isHidden: !me, active: !!account ? currentPathname === `/${account.get('username')}` : false, onClick: onOpenSidebar, }, ] return (