import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { NavLink, withRouter } from 'react-router-dom'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; import Icon from 'soapbox/components/icon'; import IconWithCounter from 'soapbox/components/icon_with_counter'; import { isStaff } from 'soapbox/utils/accounts'; import { getFeatures } from 'soapbox/utils/features'; const mapStateToProps = state => { const me = state.get('me'); const reportsCount = state.getIn(['admin', 'openReports']).count(); const approvalCount = state.getIn(['admin', 'awaitingApproval']).count(); const instance = state.get('instance'); return { account: state.getIn(['accounts', me]), logo: getSoapboxConfig(state).get('logo'), notificationCount: state.getIn(['notifications', 'unread']), chatsCount: state.getIn(['chats', 'items']).reduce((acc, curr) => acc + Math.min(curr.get('unread', 0), 1), 0), dashboardCount: reportsCount + approvalCount, features: getFeatures(instance), }; }; export default @withRouter @connect(mapStateToProps) class ThumbNavigation extends React.PureComponent { static propTypes = { logo: PropTypes.string, account: ImmutablePropTypes.map, dashboardCount: PropTypes.number, notificationCount: PropTypes.number, chatsCount: PropTypes.number, features: PropTypes.object.isRequired, location: PropTypes.object, } render() { const { account, notificationCount, chatsCount, dashboardCount, location, features } = this.props; return (